Merge pull request #5832 from Budibase/cypress-testing

Cypress testing - Commands.js update & Enable video flag
This commit is contained in:
Mitch-Budibase 2022-05-12 11:20:34 +01:00 committed by GitHub
commit 9947adb40f
4 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{
"baseUrl": "http://localhost:4100",
"video": false,
"video": true,
"projectId": "bmbemn",
"env": {
"PORT": "4100",

View File

@ -135,7 +135,7 @@ filterTests(['smoke', 'all'], () => {
cy.wait(5000)
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.wait(2000)
cy.applicationInAppTable(templateNameText)
cy.deleteApp(templateNameText)

View File

@ -24,7 +24,7 @@ filterTests(['smoke', 'all'], () => {
})
})
it("should add a URL param binding", () => {
xit("should add a URL param binding", () => {
const paramName = "foo"
cy.createScreen(`/test/:${paramName}`)
cy.addComponent("Elements", "Paragraph").then(componentId => {

View File

@ -18,14 +18,14 @@ Cypress.Commands.add("login", () => {
cy.get("input").first().type("test@test.com")
cy.get('input[type="password"]').first().type("test")
cy.get('input[type="password"]').eq(1).type("test")
cy.contains("Create super admin user").click()
cy.contains("Create super admin user").click({ force: true })
}
if (url.includes("builder/auth/login") || url.includes("builder/admin")) {
// login
cy.contains("Sign in to Budibase").then(() => {
cy.get("input").first().type("test@test.com")
cy.get('input[type="password"]').type("test")
cy.get("button").first().click()
cy.get("button").first().click({ force: true })
cy.wait(1000)
})
}
@ -58,7 +58,9 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => {
cy.get(".spectrum-Modal").within(() => {
cy.get("input").eq(0).type(name).should("have.value", name).blur()
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
cy.get(".spectrum-ButtonGroup")
.contains("Create app")
.click({ force: true })
cy.wait(10000)
})
if (shouldCreateDefaultTable) {
@ -75,9 +77,6 @@ Cypress.Commands.add("deleteApp", name => {
const findAppName = val.some(val => val.name == name)
if (findAppName) {
if (val.length > 0) {
if (Cypress.env("TEST_ENV")) {
cy.searchForApplication(name)
}
const appId = val.reduce((acc, app) => {
if (name === app.name) {
acc = app.appId
@ -92,7 +91,7 @@ Cypress.Commands.add("deleteApp", name => {
const appIdParsed = appId.split("_").pop()
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
cy.get(actionEleId).within(() => {
cy.get(".spectrum-Icon").eq(0).click()
cy.get(".spectrum-Icon").eq(0).click({ force: true })
})
cy.get(".spectrum-Menu").then($menu => {
if ($menu.text().includes("Unpublish")) {
@ -102,7 +101,7 @@ Cypress.Commands.add("deleteApp", name => {
})
cy.get(actionEleId).within(() => {
cy.get(".spectrum-Icon").eq(0).click()
cy.get(".spectrum-Icon").eq(0).click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click()
cy.get(".spectrum-Dialog-grid").within(() => {
@ -128,7 +127,7 @@ Cypress.Commands.add("deleteAllApps", () => {
const appIdParsed = val[i].appId.split("_").pop()
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
cy.get(actionEleId).within(() => {
cy.get(".spectrum-Icon").eq(0).click()
cy.get(".spectrum-Icon").eq(0).click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click()
@ -145,6 +144,7 @@ Cypress.Commands.add("createTestApp", () => {
const appName = "Cypress Tests"
cy.deleteApp(appName)
cy.createApp(appName, "This app is used for Cypress testing.")
//cy.createScreen("home")
})
Cypress.Commands.add("createTestTableWithData", () => {
@ -245,12 +245,12 @@ Cypress.Commands.add("createUser", email => {
Cypress.Commands.add("addComponent", (category, component) => {
if (category) {
cy.get(`[data-cy="category-${category}"]`).click()
cy.get(`[data-cy="category-${category}"]`).click({ force: true })
}
if (component) {
cy.get(`[data-cy="component-${component}"]`).click()
cy.get(`[data-cy="component-${component}"]`).click({ force: true })
}
cy.wait(1000)
cy.wait(2000)
cy.location().then(loc => {
const params = loc.pathname.split("/")
const componentId = params[params.length - 1]