diff --git a/cypress/integration/sasjs.tests.ts b/cypress/integration/sasjs.tests.ts index 994be1a..3d96c7a 100644 --- a/cypress/integration/sasjs.tests.ts +++ b/cypress/integration/sasjs.tests.ts @@ -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() + }) + }) + }) + }) + }) + + }) + }) }) \ No newline at end of file diff --git a/sasjs-tests/src/testSuites/Basic.ts b/sasjs-tests/src/testSuites/Basic.ts index 538992e..a5e7d7d 100644 --- a/sasjs-tests/src/testSuites/Basic.ts +++ b/sasjs-tests/src/testSuites/Basic.ts @@ -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) diff --git a/sasjs-tests/src/testSuites/Compute.ts b/sasjs-tests/src/testSuites/Compute.ts index 7fec591..9aee0d6 100644 --- a/sasjs-tests/src/testSuites/Compute.ts +++ b/sasjs-tests/src/testSuites/Compute.ts @@ -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',