1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

chore(cypress): update integration test

This commit is contained in:
2025-03-14 01:29:03 +05:00
parent 302752d79e
commit d35f1617b8

View File

@@ -4,93 +4,56 @@ const password = Cypress.env('password')
const testingFinishTimeout = Cypress.env('testingFinishTimeout') const testingFinishTimeout = Cypress.env('testingFinishTimeout')
context('sasjs-tests', function () { context('sasjs-tests', function () {
this.beforeAll(() => { before(() => {
cy.visit(sasjsTestsUrl) cy.visit(sasjsTestsUrl)
}) })
this.beforeEach(() => { beforeEach(() => {
cy.reload() cy.reload()
}) })
it('Should have all tests successfull', (done) => { function loginIfNeeded() {
cy.get('body').then(($body) => { cy.get('body').then(($body) => {
cy.wait(1000).then(() => { if ($body.find('input[placeholder="User Name"]').length > 0) {
const startButton = $body.find( cy.get('input[placeholder="User Name"]')
'.ui.massive.icon.primary.left.labeled.button' .should('be.visible')
)[0] .type(username)
cy.get('input[placeholder="Password"]')
if ( .should('be.visible')
!startButton || .type(password)
(startButton && !Cypress.dom.isVisible(startButton)) cy.get('.submit-button').should('be.visible').click()
) { cy.get('input[placeholder="User Name"]').should('not.exist') // Wait for login to finish
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()
})
})
})
})
})
}) })
}
it('Should have all tests successful', () => {
loginIfNeeded()
cy.get('.ui.massive.icon.primary.left.labeled.button')
.should('be.visible')
.click()
cy.get('.ui.massive.loading.primary.button', {
timeout: testingFinishTimeout
}).should('not.exist')
cy.get('span.icon.failed').should('not.exist')
}) })
it('Should have all tests successfull with debug on', (done) => { it('Should have all tests successful with debug on', () => {
cy.get('body').then(($body) => { loginIfNeeded()
cy.wait(1000).then(() => {
const startButton = $body.find(
'.ui.massive.icon.primary.left.labeled.button'
)[0]
if ( cy.get('.ui.fitted.toggle.checkbox label').should('be.visible').click()
!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') cy.get('.ui.massive.icon.primary.left.labeled.button')
.click() .should('be.visible')
.then(() => { .click()
cy.get('input[placeholder="User Name"]', { timeout: 40000 })
.should('not.exist') cy.get('.ui.massive.loading.primary.button', {
.then(() => { timeout: testingFinishTimeout
cy.get('.ui.massive.icon.primary.left.labeled.button') }).should('not.exist')
.click()
.then(() => { cy.get('span.icon.failed').should('not.exist')
cy.get('.ui.massive.loading.primary.button', {
timeout: testingFinishTimeout
})
.should('not.exist')
.then(() => {
cy.get('span.icon.failed')
.should('not.exist')
.then(() => {
done()
})
})
})
})
})
})
})
}) })
}) })