mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-10 17:04:36 +00:00
test: cypress running with debug on and off, testing all request approaches
This commit is contained in:
@@ -8,7 +8,11 @@ context('sasjs-tests', function() {
|
||||
cy.visit(sasjsTestsUrl)
|
||||
})
|
||||
|
||||
it ('Should have all tests successfull', (done) => {
|
||||
this.beforeEach(() => {
|
||||
cy.reload()
|
||||
})
|
||||
|
||||
it('Should have all tests successfull', (done) => {
|
||||
cy.get('body').then($body => {
|
||||
if ($body.find('input[placeholder="User Name"]').length > 0) {
|
||||
cy.get('input[placeholder="User Name"]').type(username)
|
||||
@@ -27,4 +31,27 @@ context('sasjs-tests', function() {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Should have all tests successfull with debug on', (done) => {
|
||||
cy.get('body').then($body => {
|
||||
if ($body.find('input[placeholder="User Name"]').length > 0) {
|
||||
cy.get('input[placeholder="User Name"]').type(username)
|
||||
cy.get('input[placeholder="Password"]').type(password)
|
||||
cy.get('.submit-button').click()
|
||||
}
|
||||
|
||||
cy.get('.ui.fitted.toggle.checkbox label').click().then(() => {
|
||||
cy.get('input[placeholder="User Name"]', {timeout: 40000}).should('not.exist').then(() => {
|
||||
cy.get('.ui.massive.icon.primary.left.labeled.button').click().then(() => {
|
||||
cy.get('.ui.massive.loading.primary.button', {timeout: testingFinishTimeout}).should('not.exist').then(() => {
|
||||
cy.get('span.icon.failed').should('not.exist').then(() => {
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -146,44 +146,12 @@ export const basicTests = (
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Compute API request',
|
||||
description: 'Should run the request with compute API approach',
|
||||
test: async () => {
|
||||
if (adapter.getSasjsConfig().serverType !== 'SASVIYA')
|
||||
return Promise.resolve('skip')
|
||||
|
||||
return await adapter.request('common/sendArr', stringData)
|
||||
},
|
||||
assertion: (response: any) => {
|
||||
if (response === 'skip') return true
|
||||
return response.table1[0][0] === stringData.table1[0].col1
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'JES API request',
|
||||
description: 'Should run the request with JES API approach',
|
||||
test: async () => {
|
||||
if (adapter.getSasjsConfig().serverType !== 'SASVIYA')
|
||||
return Promise.resolve('skip')
|
||||
|
||||
const config = {
|
||||
useComputeApi: false
|
||||
}
|
||||
|
||||
return await adapter.request('common/sendArr', stringData, config)
|
||||
},
|
||||
assertion: (response: any) => {
|
||||
if (response === 'skip') return true
|
||||
return response.table1[0][0] === stringData.table1[0].col1
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Web request',
|
||||
description: 'Should run the request with old web approach',
|
||||
test: async () => {
|
||||
const config = {
|
||||
useComputeApi: null
|
||||
useComputeApi: undefined
|
||||
}
|
||||
|
||||
return await adapter.request('common/sendArr', stringData, config)
|
||||
|
||||
@@ -1,9 +1,35 @@
|
||||
import SASjs from '@sasjs/adapter'
|
||||
import { TestSuite } from '@sasjs/test-framework'
|
||||
|
||||
const stringData: any = { table1: [{ col1: 'first col value' }] }
|
||||
|
||||
export const computeTests = (adapter: SASjs): TestSuite => ({
|
||||
name: 'Compute',
|
||||
tests: [
|
||||
{
|
||||
title: 'Compute API request',
|
||||
description: 'Should run the request with compute API approach',
|
||||
test: async () => {
|
||||
return await adapter.request('common/sendArr', stringData)
|
||||
},
|
||||
assertion: (response: any) => {
|
||||
return response.table1[0][0] === stringData.table1[0].col1
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'JES API request',
|
||||
description: 'Should run the request with JES API approach',
|
||||
test: async () => {
|
||||
const config = {
|
||||
useComputeApi: false
|
||||
}
|
||||
|
||||
return await adapter.request('common/sendArr', stringData, config)
|
||||
},
|
||||
assertion: (response: any) => {
|
||||
return response.table1[0][0] === stringData.table1[0].col1
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Start Compute Job - not waiting for result',
|
||||
description: 'Should start a compute job and return the session',
|
||||
|
||||
Reference in New Issue
Block a user