From bbe52562da1e7b62c0a34424d692c612c9dd4c96 Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Mon, 10 Apr 2023 13:15:41 +0200 Subject: [PATCH] ci: sasjs tests --- cypress/integration/sasjs.tests.ts | 124 +++++++++++++++-------------- 1 file changed, 66 insertions(+), 58 deletions(-) diff --git a/cypress/integration/sasjs.tests.ts b/cypress/integration/sasjs.tests.ts index 4970c32..f7579c7 100644 --- a/cypress/integration/sasjs.tests.ts +++ b/cypress/integration/sasjs.tests.ts @@ -14,75 +14,83 @@ context('sasjs-tests', function () { it('Should have all tests successfull', (done) => { cy.get('body').then(($body) => { - const startButton = $body.find( - '.ui.massive.icon.primary.left.labeled.button' - )[0] - cy.wait(1000) + cy.wait(1000).then(() => { + const startButton = $body.find( + '.ui.massive.icon.primary.left.labeled.button' + )[0] - if (startButton && !Cypress.dom.isVisible(startButton)) { - cy.get('input[placeholder="User Name"]').type(username) - cy.get('input[placeholder="Password"]').type(password) - cy.get('.submit-button').click() - } + if ( + !startButton || + (startButton && !Cypress.dom.isVisible(startButton)) + ) { + cy.get('input[placeholder="User Name"]').type(username) + cy.get('input[placeholder="Password"]').type(password) + cy.get('.submit-button').click() + } - 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() - }) + 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() + }) + }) + }) + }) + }) }) }) it('Should have all tests successfull with debug on', (done) => { cy.get('body').then(($body) => { - const startButton = $body.find( - '.ui.massive.icon.primary.left.labeled.button' - )[0] - cy.wait(1000) + cy.wait(1000).then(() => { + const startButton = $body.find( + '.ui.massive.icon.primary.left.labeled.button' + )[0] - if (startButton && !Cypress.dom.isVisible(startButton)) { - cy.get('input[placeholder="User Name"]').type(username) - cy.get('input[placeholder="Password"]').type(password) - cy.get('.submit-button').click() - } + if ( + !startButton || + (startButton && !Cypress.dom.isVisible(startButton)) + ) { + 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() - }) + 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() + }) + }) + }) + }) + }) + }) }) }) })