Cypress Tests Refactoring

Refactoring a large portion of tests - necessary updates to have them working (may still be timing issues on the smoke build)
This commit is contained in:
Mitch-Budibase 2022-06-29 18:28:32 +01:00
parent cc65d54902
commit 7495b859c8
9 changed files with 24 additions and 14 deletions

View File

@ -136,7 +136,6 @@ filterTests(["all"], () => {
.within(() => {
cy.get(".confirm-wrap button").click({ force: true })
})
cy.wait(1000)
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(".appTable .app-row-actions button")
@ -376,7 +375,7 @@ filterTests(["all"], () => {
.should("be.visible")
})
it("Should allow unpublishing of the application", () => {
it("Should allow unpublishing of the application via the Unpublish link", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(".appTable .app-row-actions button")
.contains("Manage")

View File

@ -12,7 +12,7 @@ filterTests(['all'], () => {
it("Should reflect the unpublished status correctly", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(interact.APP_TABLE_STATUS, { timeout: 1000 }).eq(0)
cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0)
.within(() => {
cy.contains("Unpublished")
cy.get(interact.GLOBESTRIKE).should("exist")
@ -47,7 +47,7 @@ filterTests(['all'], () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(interact.APP_TABLE_STATUS, { timeout: 1000 }).eq(0)
cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0)
.within(() => {
cy.contains("Published")
cy.get(interact.GLOBE).should("exist")
@ -55,7 +55,7 @@ filterTests(['all'], () => {
cy.get(interact.APP_TABLE_ROW_ACTION).eq(0)
.within(() => {
cy.get(interact.SPECTRUM_BUTTON).contains("View")
cy.get(interact.SPECTRUM_BUTTON).contains("Manage")
cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true })
})
@ -85,7 +85,12 @@ filterTests(['all'], () => {
cy.get(interact.APP_TABLE_APP_NAME).click({ force: true })
})
cy.get(interact.SPECTRUM_LINK).contains('Unpublish').click();
cy.get(interact.DEPLOYMENT_TOP_NAV).click()
cy.get(interact.PUBLISH_POPOVER_ACTION).click({ force: true })
cy.get(interact.UNPUBLISH_MODAL)
.within(() => {
cy.get(interact.CONFIRM_WRAP_BUTTON).click({ force: true })
})
cy.get(interact.UNPUBLISH_MODAL).should("be.visible")
.within(() => {

View File

@ -39,8 +39,9 @@ filterTests(["smoke", "all"], () => {
it("edits a row", () => {
cy.contains("button", "Edit").click({ force: true })
cy.get(interact.SPECTRUM_MODAL_INPUT, { timeout: 1000 }).clear()
cy.get(interact.SPECTRUM_MODAL_INPUT, { timeout: 1000 }).type("Updated")
cy.wait(500)
cy.get(interact.SPECTRUM_MODAL_INPUT).clear()
cy.get(interact.SPECTRUM_MODAL_INPUT).type("Updated")
cy.contains("Save").click()
cy.contains("Updated").should("have.text", "Updated")
})

View File

@ -70,7 +70,8 @@ filterTests(['smoke', 'all'], () => {
cy.get(interact.SPECTRUM_BUTTON).contains("Save").click({ force: true })
})
cy.get(interact.TITLE, { timeout: 1000 }).then($headers => {
cy.wait(1000)
cy.get(interact.TITLE).then($headers => {
expect($headers).to.have.length(7)
const headers = Array.from($headers).map(header =>
header.textContent.trim()

View File

@ -51,7 +51,6 @@ filterTests(["all"], () => {
renameApp(appName, " ", false, true)
// Close modal and confirm name has not been changed
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 }).contains("Cancel").click()
cy.reload()
cy.applicationInAppTable(appName)
})

View File

@ -36,6 +36,7 @@ filterTests(['smoke', 'all'], () => {
cy.get(interact.SPECTRUM_BUTTON_GROUP).within(() => {
cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true })
})
cy.wait(1000) // Wait for next modal to finish loading
cy.get(interact.SPECTRUM_BUTTON_GROUP, { timeout: 1000 }).within(() => {
cy.get(interact.SPECTRUM_BUTTON).contains("Done").click({ force: true })
})
@ -49,7 +50,7 @@ filterTests(['smoke', 'all'], () => {
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
// Click Revert
cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true })
cy.wait(2000) // Wait for app to finish reverting
})
// Confirm Paragraph component is still visible
cy.get(interact.ROOT, { timeout: 1000 }).contains("New Paragraph")

View File

@ -372,7 +372,8 @@ Cypress.Commands.add("searchForApplication", appName => {
// Assumes there are no others
Cypress.Commands.add("applicationInAppTable", appName => {
cy.get(".appTable", { timeout: 1000 }).within(() => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(".appTable", { timeout: 2000 }).within(() => {
cy.get(".title").contains(appName).should("exist")
})
})
@ -400,7 +401,7 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => {
cy.navigateToDataSection()
cy.get(`[data-cy="new-table"]`).click()
}
cy.wait(500)
cy.wait(2000)
cy.get(".item")
.contains("Budibase DB")
.click({ force: true })
@ -539,9 +540,10 @@ Cypress.Commands.add("createScreen", (route, accessLevelLabel) => {
cy.get("[data-cy='blank-screen']").click()
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
})
cy.wait(500)
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Form-itemField").eq(0).type(route)
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
cy.get(".confirm-wrap").contains("Continue").click({ force: true })
})
cy.get(".spectrum-Modal", { timeout: 1000 }).within(() => {
@ -567,6 +569,7 @@ Cypress.Commands.add(
timeout: 500,
}).within(() => {
for (let i = 0; i < datasourceNames.length; i++) {
cy.wait(500)
cy.get(".data-source-entry").contains(datasourceNames[i]).click()
//Ensure the check mark is visible
cy.get(".data-source-entry")

View File

@ -62,6 +62,7 @@ export const GLOBESTRIKE = "svg[aria-label=GlobeStrike]"
export const GLOBE = "svg[aria-label=Globe]"
export const UNPUBLISH_MODAL = "[data-cy=unpublish-modal]"
export const CONFIRM_WRAP_BUTTON = ".confirm-wrap button"
export const DEPLOYMENT_TOP_NAV = ".deployment-top-nav"
//changeAppiconAndColour
export const APP_ROW_ACTION = ".app-row-actions-icon"