Merge pull request #9392 from Budibase/cypress

Cypress - New Portal Test Updates
This commit is contained in:
Mitch-Budibase 2023-01-19 19:57:06 +00:00 committed by GitHub
commit 7605d8ba1a
6 changed files with 146 additions and 128 deletions

View File

@ -11,9 +11,5 @@
"WORKER_PORT": "4200", "WORKER_PORT": "4200",
"JWT_SECRET": "test", "JWT_SECRET": "test",
"HOST_IP": "" "HOST_IP": ""
},
"retries": {
"runMode": 1,
"openMode": 0
} }
} }

View File

@ -2,7 +2,7 @@ import filterTests from "../../support/filterTests"
// const interact = require("../support/interact") // const interact = require("../support/interact")
filterTests(["smoke", "all"], () => { filterTests(["smoke", "all"], () => {
context("Auth Configuration", () => { xcontext("Auth Configuration", () => {
before(() => { before(() => {
cy.login() cy.login()
}) })

View File

@ -27,7 +27,7 @@ filterTests(["smoke", "all"], () => {
}) })
}) })
it("should allow copying of the users API key", () => { xit("should allow copying of the users API key", () => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
@ -41,12 +41,17 @@ filterTests(["smoke", "all"], () => {
}) })
it("should allow API key regeneration", () => { it("should allow API key regeneration", () => {
cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
cy.get(interact.SPECTRUM_ICON).click({ force: true })
})
// Get initial API key value // Get initial API key value
cy.get(interact.SPECTRUM_DIALOG_CONTENT) cy.get(interact.SPECTRUM_DIALOG_CONTENT)
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne') .find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne')
// Click re-generate key button // Click re-generate key button
cy.get("button").contains("Re-generate key").click({ force: true }) cy.get("button").contains("Regenerate key").click({ force: true })
// Verify API key was changed // Verify API key was changed
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
@ -59,7 +64,7 @@ filterTests(["smoke", "all"], () => {
it("should update password", () => { it("should update password", () => {
// Access Update password modal // Access Update password modal
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true })
// Enter new password and update // Enter new password and update
@ -76,8 +81,8 @@ filterTests(["smoke", "all"], () => {
cy.login("test@test.com", "newpwd") cy.login("test@test.com", "newpwd")
}) })
it("should open and close developer mode", () => { xit("should open and close developer mode", () => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
// Close developer mode & verify // Close developer mode & verify
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true })
@ -88,13 +93,13 @@ filterTests(["smoke", "all"], () => {
// Open developer mode & verify // Open developer mode & verify
cy.get(".avatar > .icon").click({ force: true }) cy.get(".avatar > .icon").click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true })
cy.get(interact.SPECTRUM_SIDENAV).should('exist') // config sections available cy.get(".app-table").should('exist') // config sections available
cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available
}) })
after(() => { after(() => {
// Change password back to original value // Change password back to original value
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {

View File

@ -2,7 +2,7 @@ import filterTests from "../support/filterTests"
import clientPackage from "@budibase/client/package.json" import clientPackage from "@budibase/client/package.json"
filterTests(["all"], () => { filterTests(["all"], () => {
context("Application Overview screen", () => { xcontext("Application Overview screen", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.deleteAllApps() cy.deleteAllApps()

View File

@ -22,7 +22,7 @@ filterTests(['smoke', 'all'], () => {
}) })
} }
it("should provide filterable templates", () => { xit("should provide filterable templates", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
cy.wait(500) cy.wait(500)
@ -30,7 +30,7 @@ filterTests(['smoke', 'all'], () => {
.its("body") .its("body")
.then(val => { .then(val => {
if (val.length > 0) { if (val.length > 0) {
cy.get(interact.SPECTRUM_BUTTON).contains("Templates").click({force: true}) cy.get(interact.SPECTRUM_BUTTON).contains("View Templates").click({ force: true })
} }
}) })
@ -123,35 +123,49 @@ filterTests(['smoke', 'all'], () => {
const exportedApp = 'cypress/fixtures/exported-app.txt' const exportedApp = 'cypress/fixtures/exported-app.txt'
cy.importApp(exportedApp, "") cy.importApp(exportedApp, "")
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 })
cy.applicationInAppTable("My app") cy.applicationInAppTable("My app")
cy.get(".app-table .name").eq(0).click()
cy.get(".appTable .name").eq(0).click() cy.closeModal()
cy.get(`[aria-label="ShowMenu"]`).click()
cy.deleteApp("My app") cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
})
cy.get(".app-overview-actions-icon").within(() => {
cy.get(".spectrum-Icon").click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click({ force: true })
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get("input").type("My app")
})
cy.get(".spectrum-Button--warning").click()
}) })
it("should create an application from an export, using the users first name as the default app name", () => { it("should create an application from an export, using the users first name as the default app name", () => {
const exportedApp = 'cypress/fixtures/exported-app.txt' const exportedApp = 'cypress/fixtures/exported-app.txt'
cy.updateUserInformation("Ted", "Userman") cy.updateUserInformation("Ted", "Userman")
cy.importApp(exportedApp, "") cy.importApp(exportedApp, "")
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.applicationInAppTable("Teds app") cy.applicationInAppTable("Teds app")
cy.get(".app-table .name").eq(0).click()
cy.get(".appTable .name").eq(0).click() cy.closeModal()
cy.get(`[aria-label="ShowMenu"]`).click()
cy.deleteApp("Teds app") cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
})
cy.get(".app-overview-actions-icon").within(() => {
cy.get(".spectrum-Icon").click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click({ force: true })
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get("input").type("Teds app")
})
cy.get(".spectrum-Button--warning").click()
cy.updateUserInformation("", "") cy.updateUserInformation("", "")
}) })
it("should generate the first application from a template", () => { xit("should generate the first application from a template", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500) cy.wait(500)

View File

@ -101,7 +101,7 @@ Cypress.Commands.add("deleteUser", email => {
}) })
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ cy.get(".user-dropdown .icon", { timeout: 2000 }).click({
force: true, force: true,
}) })
@ -132,7 +132,7 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
.blur() .blur()
} }
cy.get(".confirm-wrap").within(() => { cy.get(".confirm-wrap").within(() => {
cy.get("button").contains("Update information").click({ force: true }) cy.get("button").contains("Save").click({ force: true })
}) })
cy.get(".spectrum-Dialog-grid").should("not.exist") cy.get(".spectrum-Dialog-grid").should("not.exist")
}) })
@ -222,9 +222,12 @@ Cypress.Commands.add("deleteApp", name => {
// Go to app overview // Go to app overview
const appIdParsed = appId.split("_").pop() const appIdParsed = appId.split("_").pop()
const actionEleId = `[data-cy=row_actions_${appIdParsed}]` const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
cy.get(actionEleId).within(() => { cy.get(actionEleId).click()
cy.contains("Manage").click({ force: true }) cy.get(`[aria-label="ShowMenu"]`).click()
cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
}) })
cy.wait(500) cy.wait(500)
// Unpublish first if needed // Unpublish first if needed
@ -400,7 +403,7 @@ Cypress.Commands.add("searchForApplication", appName => {
return return
} else { } else {
// Searches for the app // Searches for the app
cy.get(".filter").then(() => { cy.get(".spectrum-Search").then(() => {
cy.get(".spectrum-Textfield").within(() => { cy.get(".spectrum-Textfield").within(() => {
cy.get("input").eq(0).clear({ force: true }) cy.get("input").eq(0).clear({ force: true })
cy.get("input").eq(0).type(appName, { force: true }) cy.get("input").eq(0).type(appName, { force: true })
@ -413,7 +416,7 @@ Cypress.Commands.add("searchForApplication", appName => {
// Assumes there are no others // Assumes there are no others
Cypress.Commands.add("applicationInAppTable", appName => { Cypress.Commands.add("applicationInAppTable", appName => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
cy.get(".appTable", { timeout: 30000 }).within(() => { cy.get(".app-table", { timeout: 30000 }).within(() => {
cy.get(".title").contains(appName).should("exist") cy.get(".title").contains(appName).should("exist")
}) })
}) })