Merge pull request #6613 from Budibase/cypress-testing

Cypress: Smoke Build Test Changes
This commit is contained in:
Mitch-Budibase 2022-07-08 11:50:14 +01:00 committed by GitHub
commit 2c4423ec8b
6 changed files with 33 additions and 27 deletions

View File

@ -10,6 +10,7 @@ filterTests(['all'], () => {
it("should add Radio Buttons options picker on form, add data, and confirm", () => { it("should add Radio Buttons options picker on form, add data, and confirm", () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.wait(500)
cy.addComponent("Form", "Form") cy.addComponent("Form", "Form")
cy.addComponent("Form", "Options Picker").then((componentId) => { cy.addComponent("Form", "Options Picker").then((componentId) => {
// Provide field setting // Provide field setting

View File

@ -43,7 +43,7 @@ filterTests(["smoke", "all"], () => {
const uuid = () => Cypress._.random(0, 1e6) const uuid = () => Cypress._.random(0, 1e6)
const name = uuid() const name = uuid()
if(i < 1){ if(i < 1){
cy.createApp(name) cy.createApp(name, false)
} else { } else {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
cy.wait(1000) cy.wait(1000)
@ -56,7 +56,7 @@ filterTests(["smoke", "all"], () => {
// Navigate back to the user // Navigate back to the user
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click() cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click()
cy.get(interact.SPECTRUM_TABLE, { timeout: 500 }).contains("bbuser").click() cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click()
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
cy.get(interact.SPECTRUM_TABLE, { timeout: 3000}) cy.get(interact.SPECTRUM_TABLE, { timeout: 3000})
.eq(1) .eq(1)
@ -65,24 +65,24 @@ filterTests(["smoke", "all"], () => {
.find(interact.SPECTRUM_TABLE_CELL) .find(interact.SPECTRUM_TABLE_CELL)
.eq(0) .eq(0)
.click() .click()
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 500 }) cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 })
.contains("Choose an option") .contains("Choose an option")
.click() .click()
.then(() => { .then(() => {
if (i == 0) { if (i == 0) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Admin").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Admin").click({ force: true })
} }
else if (i == 1) { else if (i == 1) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Power").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Power").click({ force: true })
} }
else if (i == 2) { else if (i == 2) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Basic").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Basic").click({ force: true })
} }
cy.get(interact.SPECTRUM_BUTTON, { timeout: 1000 }) cy.get(interact.SPECTRUM_BUTTON, { timeout: 2000 })
.contains("Update role") .contains("Update role")
.click({ force: true }) .click({ force: true })
}) })
cy.reload() cy.reload({ timeout: 5000 })
cy.wait(1000) cy.wait(1000)
} }
// Confirm roles exist within Configure roles table // Confirm roles exist within Configure roles table

View File

@ -6,7 +6,7 @@ filterTests(["all"], () => {
before(() => { before(() => {
cy.login() cy.login()
cy.deleteAllApps() cy.deleteAllApps()
cy.createTestApp() cy.createApp("Cypress Tests")
}) })
it("Should be accessible from the applications list", () => { it("Should be accessible from the applications list", () => {
@ -82,13 +82,14 @@ filterTests(["all"], () => {
}) })
it("Should reflect the app deployment state", () => { it("Should reflect the app deployment state", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
cy.get(".appTable .app-row-actions button") cy.get(".appTable .app-row-actions button")
.contains("Edit") .contains("Edit")
.eq(0) .eq(0)
.click({ force: true }) .click({ force: true })
cy.get(".toprightnav button.spectrum-Button") cy.wait(500)
cy.get(".toprightnav button.spectrum-Button", { timeout: 2000 })
.contains("Publish") .contains("Publish")
.click({ force: true }) .click({ force: true })
cy.get(".spectrum-Modal [data-cy='deploy-app-modal']") cy.get(".spectrum-Modal [data-cy='deploy-app-modal']")

View File

@ -5,7 +5,6 @@ filterTests(['smoke', 'all'], () => {
context("Create a View", () => { context("Create a View", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
cy.createTable("data") cy.createTable("data")
cy.addColumn("data", "group", "Text") cy.addColumn("data", "group", "Text")

View File

@ -217,20 +217,21 @@ filterTests(["all"], () => {
it("should edit a query name", () => { it("should edit a query name", () => {
// Access query // Access query
cy.get(".hierarchy-items-container") cy.get(".hierarchy-items-container", { timeout: 2000 })
.contains(queryName + " (1)") .contains(queryName + " (1)")
.click() .click()
// Rename query // Rename query
cy.get(".spectrum-Form-item") cy.wait(1000)
cy.get(".spectrum-Form-item", { timeout: 2000 })
.eq(0) .eq(0)
.within(() => { .within(() => {
cy.get("input").clear().type(queryRename) cy.get("input").clear().type(queryRename)
}) })
// Run and Save query // Run and Save query
cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 }).contains("Run Query").click({ force: true })
cy.wait(500) cy.wait(1000)
cy.get(".spectrum-Button", { timeout: 2000 }).contains("Save Query").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 }).contains("Save Query").click({ force: true })
cy.reload({ timeout: 5000 }) cy.reload({ timeout: 5000 })
cy.get(".nav-item", { timeout: 2000 }).should("contain", queryRename) cy.get(".nav-item", { timeout: 2000 }).should("contain", queryRename)
@ -250,6 +251,7 @@ filterTests(["all"], () => {
.contains("Delete Query") .contains("Delete Query")
.click({ force: true }) .click({ force: true })
// Confirm deletion // Confirm deletion
cy.reload({ timeout: 5000 })
cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName) cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName)
}) })

View File

@ -403,17 +403,19 @@ Cypress.Commands.add("createAppFromScratch", appName => {
Cypress.Commands.add("createTable", (tableName, initialTable) => { Cypress.Commands.add("createTable", (tableName, initialTable) => {
if (!initialTable) { if (!initialTable) {
cy.navigateToDataSection() cy.navigateToDataSection()
cy.get(`[data-cy="new-table"]`).click() cy.get(`[data-cy="new-table"]`, { timeout: 2000 }).click()
} }
cy.wait(2000) cy.wait(2000)
cy.get(".item") cy.get(".item", { timeout: 2000 })
.contains("Budibase DB") .contains("Budibase DB")
.click({ force: true }) .click({ force: true })
.then(() => { .then(() => {
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 })
.contains("Continue")
.click({ force: true })
}) })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => {
cy.get("input", { timeout: 1000 }).first().type(tableName).blur() cy.get("input", { timeout: 2000 }).first().type(tableName).blur()
cy.get(".spectrum-ButtonGroup").contains("Create").click() cy.get(".spectrum-ButtonGroup").contains("Create").click()
}) })
cy.contains(tableName).should("be.visible") cy.contains(tableName).should("be.visible")
@ -507,12 +509,13 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
// DESIGN AREA // DESIGN AREA
Cypress.Commands.add("addComponent", (category, component) => { Cypress.Commands.add("addComponent", (category, component) => {
if (category) { if (category) {
cy.get(`[data-cy="category-${category}"]`, { timeout: 1000 }).click({ cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({
force: true, force: true,
}) })
} }
cy.wait(500)
if (component) { if (component) {
cy.get(`[data-cy="component-${component}"]`, { timeout: 1000 }).click({ cy.get(`[data-cy="component-${component}"]`, { timeout: 3000 }).click({
force: true, force: true,
}) })
} }
@ -520,7 +523,7 @@ Cypress.Commands.add("addComponent", (category, component) => {
cy.location().then(loc => { cy.location().then(loc => {
const params = loc.pathname.split("/") const params = loc.pathname.split("/")
const componentId = params[params.length - 1] const componentId = params[params.length - 1]
cy.getComponent(componentId).should("exist") cy.getComponent(componentId, { timeout: 3000 }).should("exist")
return cy.wrap(componentId) return cy.wrap(componentId)
}) })
}) })
@ -624,8 +627,8 @@ Cypress.Commands.add("navigateToFrontend", () => {
// Clicks on Design tab and then the Home nav item // Clicks on Design tab and then the Home nav item
cy.wait(500) cy.wait(500)
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".spectrum-Search").type("/") cy.get(".spectrum-Search", { timeout: 2000 }).type("/")
cy.get(".nav-item").contains("home").click() cy.get(".nav-item", { timeout: 2000 }).contains("home").click()
}) })
Cypress.Commands.add("navigateToDataSection", () => { Cypress.Commands.add("navigateToDataSection", () => {
@ -785,7 +788,7 @@ Cypress.Commands.add("createRestQuery", (method, restUrl, queryPrettyName) => {
// MISC // MISC
Cypress.Commands.add("closeModal", () => { Cypress.Commands.add("closeModal", () => {
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => {
cy.get(".close-icon").click() cy.get(".close-icon").click()
cy.wait(1000) // Wait for modal to close cy.wait(1000) // Wait for modal to close
}) })