AdminAndManagement Test folder + timeouts refactoring

Created a new folder called adminAndManagement
- contains user and portal based tests

Timeouts refactoring
- Replacing a large number of waits with timeouts - this will prevent less time waiting during all testing
This commit is contained in:
Mitch-Budibase 2022-06-17 17:41:07 +01:00
parent b73652f36a
commit ce1fa11db3
19 changed files with 192 additions and 151 deletions

View File

@ -16,18 +16,15 @@ filterTests(['all'], () => {
it("should add form with multi select picker, containing 5 options", () => {
cy.navigateToFrontend()
cy.wait(500)
// Add data provider
cy.get(interact.CATEGORY_DATA).click()
cy.get(interact.CATEGORY_DATA, { timeout: 500 }).click()
cy.get(interact.COMPONENT_DATA_PROVIDER).click()
cy.get(interact.DATASOURCE_PROP_CONTROL).click()
cy.get(interact.DROPDOWN).contains("Multi Data").click()
cy.wait(500)
// Add Form with schema to match table
cy.addComponent("Form", "Form")
cy.get(interact.DATASOURCE_PROP_CONTROL).click()
cy.get(interact.DROPDOWN).contains("Multi Data").click()
cy.wait(500)
// Add multi-select picker to form
cy.addComponent("Form", "Multi-select Picker").then(componentId => {
cy.get(interact.DATASOURCE_FIELD_CONTROL).type("Test Data").type("{enter}")

View File

@ -0,0 +1,59 @@
import filterTests from "../../support/filterTests"
const interact = require('../../support/interact')
filterTests(["smoke", "all"], () => {
context("Account Portal", () => {
before(() => {
cy.login()
cy.deleteApp("Cypress Tests")
cy.createApp("Cypress Tests")
// Create new user
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 1000})
cy.createUser("bbuser@test.com")
cy.contains("bbuser").click()
// Reset password
cy.get(interact.REGENERATE, { timeout: 500 }).click({ force: true })
const newPwd = cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value')
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
// Login as new user and set password
cy.logOut()
cy.login("bbuser@test.com", newPwd)
for (let i = 0; i < 2; i++) {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test")
}
cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true })
cy.logOut()
})
it("should verify Admin Portal", () => {
cy.login()
// Enable Development & Administration access
for (let i = 4; i < 6; i++) {
cy.get(interact.FIELD).eq(i).within(() => {
cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true })
cy.get(interact.SPECTRUM_SWITCH_INPUT).should('be.enabled')
})
}
// Login as new user
cy.logOut()
cy.login("bbuser@test.com", "test")
// Enter developer mode
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true })
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
cy.get(".spectrum-Menu-itemLabel").contains("Open developer mode").click({ force: true })
})
cy.get(".spectrum-SideNav")
.should('contain', 'Apps')
.and('contain', 'Users')
.and('contain', 'Auth')
.and('contain', 'Email')
.and('contain', 'Organisation')
.and('contain', 'Theming')
.and('contain', 'Update')
})
})
})

View File

@ -1,27 +1,32 @@
import filterTests from "../support/filterTests"
const interact = require('../support/interact')
import filterTests from "../../support/filterTests"
const interact = require('../../support/interact')
filterTests(["smoke", "all"], () => {
context("Create a User and Assign Roles", () => {
context("User Management", () => {
before(() => {
cy.login()
cy.deleteApp("Cypress Tests")
cy.createApp("Cypress Tests")
})
it("should create a user", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
it("should create a user via basic onboarding", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 1000})
cy.createUser("bbuser@test.com")
cy.get(interact.SPECTRUM_TABLE).should("contain", "bbuser")
})
it("should confirm there is No Access for a New User", () => {
// Click into the user
it("should confirm basic permission for a New User", () => {
// Basic permission = development & administraton disabled
cy.contains("bbuser").click()
// Get No Access table - Confirm it has apps in it
// Confirm development and admin access are disabled
for (let i = 4; i < 6; i++) {
cy.get(interact.FIELD).eq(i).within(() => {
cy.get(interact.SPECTRUM_SWITCH_INPUT).should('be.disabled')
})
}
// Existing apps appear within the No Access table
cy.get(interact.SPECTRUM_TABLE, { timeout: 500 }).eq(1).should("not.contain", "No rows found")
// Get Configure Roles table - Confirm it has no apps
// Configure roles table should not contain apps
cy.get(interact.SPECTRUM_TABLE).eq(0).contains("No rows found")
})
@ -46,12 +51,9 @@ filterTests(["smoke", "all"], () => {
}
})
// Navigate back to the user
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 500})
cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click()
cy.wait(500)
cy.get(interact.SPECTRUM_TABLE).contains("bbuser").click()
cy.wait(1000)
cy.get(interact.SPECTRUM_TABLE, { timeout: 500 }).contains("bbuser").click()
for (let i = 0; i < 3; i++) {
cy.get(interact.SPECTRUM_TABLE, { timeout: 3000})
.eq(1)
@ -60,31 +62,27 @@ filterTests(["smoke", "all"], () => {
.find(interact.SPECTRUM_TABLE_CELL)
.eq(0)
.click()
cy.wait(500)
cy.get(interact.SPECTRUM_DIALOG_GRID)
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 500 })
.contains("Choose an option")
.click()
.then(() => {
cy.wait(1000)
if (i == 0) {
cy.get(interact.SPECTRUM_MENU).contains("Admin").click({ force: true })
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Admin").click({ force: true })
}
else if (i == 1) {
cy.get(interact.SPECTRUM_MENU).contains("Power").click({ force: true })
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Power").click({ force: true })
}
else if (i == 2) {
cy.get(interact.SPECTRUM_MENU).contains("Basic").click({ force: true })
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Basic").click({ force: true })
}
cy.wait(1000)
cy.get(interact.SPECTRUM_BUTTON)
cy.get(interact.SPECTRUM_BUTTON, { timeout: 1000 })
.contains("Update role")
.click({ force: true })
})
cy.reload()
}
// Confirm roles exist within Configure roles table
cy.wait(2000)
cy.get(interact.SPECTRUM_TABLE)
cy.get(interact.SPECTRUM_TABLE, { timeout: 2000 })
.eq(0)
.within(assginedRoles => {
expect(assginedRoles).to.contain("Admin")
@ -110,21 +108,19 @@ filterTests(["smoke", "all"], () => {
.click()
.then(() => {
cy.get(interact.SPECTRUM_PICKER).eq(1).click({ force: true })
cy.wait(500)
cy.get(interact.SPECTRUM_POPOVER).contains("No Access").click()
cy.get(interact.SPECTRUM_POPOVER, { timeout: 500 }).contains("No Access").click()
})
cy.get(interact.SPECTRUM_BUTTON)
.contains("Update role")
.click({ force: true })
cy.wait(1000)
}
})
// Confirm Configure roles table no longer has any apps in it
cy.get(interact.SPECTRUM_TABLE).eq(0).contains("No rows found")
cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).eq(0).contains("No rows found")
})
}
it("should enable Developer access", () => {
it("should enable Developer access and verify application access", () => {
// Enable Developer access
cy.get(interact.FIELD)
.eq(4)
@ -156,15 +152,15 @@ filterTests(["smoke", "all"], () => {
})
})
it("should disable Developer access", () => {
it("should disable Developer access and verify application access", () => {
// Disable Developer access
cy.get(".field")
cy.get(interact.FIELD)
.eq(4)
.within(() => {
cy.get(".spectrum-Switch-input").click({ force: true })
})
// Configure roles table should now be empty
cy.get(".container")
cy.get(interact.CONTAINER)
.contains("Configure roles")
.parent()
.within(() => {
@ -172,45 +168,75 @@ filterTests(["smoke", "all"], () => {
})
})
it("Should edit user details", () => {
it("Should edit user details within user details page", () => {
// Add First name
cy.get(".field").eq(2).within(() => {
cy.get(interact.FIELD, { timeout: 500 }).eq(2).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("bb")
})
// Add Last name
cy.get(".field").eq(3).within(() => {
cy.get(interact.FIELD).eq(3).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("test")
})
// Navigate away and back to the user
cy.contains("Apps").click()
cy.contains("Users").click()
cy.contains("bbuser").click()
// Reload page
cy.reload()
// Confirm details have been saved
cy.get(".field").eq(2).within(() => {
cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb")
})
cy.get(".field").eq(3).within(() => {
cy.get(interact.FIELD).eq(3).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "test")
})
})
it("should reset the users password", () => {
cy.get(interact.REGENERATE, { timeout: 500 }).click({ force: true })
// Reset password modal
const newPwd = cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value')
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
// Logout, then login with new password
cy.logOut()
cy.login("bbuser@test.com", newPwd)
// Reset password screen
for (let i = 0; i < 2; i++) {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test")
}
cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true })
// Confirm user logged in afer password change
cy.get(".user-dropdown .avatar > .icon").click({ force: true })
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
cy.get("li[data-cy='user-info']").click({ force: true })
})
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value').should('eq', 'bbuser@test.com')
// Logout and login as previous user
cy.logOut()
cy.login()
})
it("should delete a user", () => {
// Navigate to test user
cy.contains("Users").click()
cy.contains("bbuser").click()
// Click Delete user button
cy.get(interact.SPECTRUM_BUTTON)
.contains("Delete user")
.click({ force: true })
.then(() => {
// Confirm deletion within modal
cy.wait(500)
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 500 }).within(() => {
cy.get(interact.SPECTRUM_BUTTON)
.contains("Delete user")
.click({ force: true })
cy.wait(4000)
})
})
cy.get(interact.SPECTRUM_TABLE).should("not.have.text", "bbuser")
cy.get(interact.SPECTRUM_TABLE, { timeout: 4000 }).should("not.have.text", "bbuser")
})
})
})

View File

@ -222,10 +222,9 @@ filterTests(['all'], () => {
cy.alterAppVersion(appId, "0.0.1-alpha.0")
.then(()=>{
cy.reload()
cy.wait(1000)
cy.log("Current deployment version: " + clientPackage.version)
cy.get(".version-status a").contains("Update").click()
cy.get(".version-status a", { timeout: 1000 }).contains("Update").click()
cy.get(".spectrum-Tabs-item.is-selected").contains("Settings")
cy.get(".version-section .page-action button").contains("Update").click({ force: true })
@ -273,14 +272,12 @@ filterTests(['all'], () => {
});
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.get(".appTable .name").eq(0).click()
cy.get(".appTable .name", { timeout: 1000 }).eq(0).click()
cy.get(".spectrum-Tabs-item").contains("Settings").click()
cy.get(".spectrum-Tabs-item.is-selected").contains("Settings")
cy.get(".details-section .page-action .spectrum-Button").scrollIntoView()
cy.wait(1000)
cy.get(".details-section .page-action .spectrum-Button").should("be.disabled")
cy.get(".details-section .page-action .spectrum-Button", { timeout: 1000 }).should("be.disabled")
})

View File

@ -11,9 +11,8 @@ filterTests(['all'], () => {
it("Should reflect the unpublished status correctly", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.get(interact.APP_TABLE_STATUS).eq(0)
cy.get(interact.APP_TABLE_STATUS, { timeout: 1000 }).eq(0)
.within(() => {
cy.contains("Unpublished")
cy.get(interact.GLOBESTRIKE).should("exist")
@ -35,11 +34,10 @@ filterTests(['all'], () => {
cy.get(interact.DEPLOY_APP_MODAL).should("be.visible")
.within(() => {
cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force : true })
cy.wait(1000)
});
//Verify that the app url is presented correctly to the user
cy.get(interact.DEPLOY_SUCCESS_MODAL)
cy.get(interact.DEPLOY_SUCCESS_MODAL, { timeout: 1000 })
.should("be.visible")
.within(() => {
let appUrl = Cypress.config().baseUrl + '/app/cypress-tests'
@ -48,9 +46,8 @@ filterTests(['all'], () => {
})
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.get(interact.APP_TABLE_STATUS).eq(0)
cy.get(interact.APP_TABLE_STATUS, { timeout: 1000 }).eq(0)
.within(() => {
cy.contains("Published")
cy.get(interact.GLOBE).should("exist")

View File

@ -49,10 +49,9 @@ filterTests(['smoke', 'all'], () => {
it("should enforce a valid url before submission", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
// Start create app process. If apps already exist, click second button
cy.get(interact.CREATE_APP_BUTTON).click({ force: true })
cy.get(interact.CREATE_APP_BUTTON, { timeout: 1000 }).click({ force: true })
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
.its("body")
.then(val => {
@ -95,7 +94,6 @@ filterTests(['smoke', 'all'], () => {
cy.createApp(appName)
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.applicationInAppTable(appName)
cy.deleteApp(appName)
@ -105,7 +103,6 @@ filterTests(['smoke', 'all'], () => {
cy.createApp()
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.applicationInAppTable("My app")
cy.deleteApp("My app")
@ -119,11 +116,9 @@ filterTests(['smoke', 'all'], () => {
cy.createApp()
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.applicationInAppTable("Teds app")
cy.deleteApp("Teds app")
cy.wait(2000)
//Accomodate names that end in 'S'
cy.updateUserInformation("Chris", "Userman")
@ -131,11 +126,9 @@ filterTests(['smoke', 'all'], () => {
cy.createApp()
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(1000)
cy.applicationInAppTable("Chris app")
cy.deleteApp("Chris app")
cy.wait(2000)
cy.updateUserInformation("", "")
})
@ -224,14 +217,12 @@ filterTests(['smoke', 'all'], () => {
cy.createApp(appName)
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
// Create second app
const secondAppName = "Second App Demo"
cy.createApp(secondAppName)
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
//Both applications should exist and be searchable
cy.searchForApplication(appName)

View File

@ -16,17 +16,15 @@ filterTests(['smoke', 'all'], () => {
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
cy.get("input").type("Add Row")
cy.contains("Row Created").click({ force: true })
cy.wait(500)
cy.get(interact.SPECTRUM_BUTTON_CTA).click()
cy.get(interact.SPECTRUM_BUTTON_CTA, { timeout: 500 }).click()
})
// Setup trigger
cy.get(interact.SPECTRUM_PICKER_LABEL).click()
cy.wait(500)
cy.contains("dog").click()
cy.wait(2000)
// Create action
cy.get('[aria-label="AddCircle"]').eq(1).click()
cy.get('[aria-label="AddCircle"]', { timeout: 2000 }).eq(1).click()
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
cy.wait(1000)
cy.contains("Create Row").trigger('mouseover').click().click()
@ -43,11 +41,9 @@ filterTests(['smoke', 'all'], () => {
cy.contains("Finish and test automation").click()
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
cy.wait(1000)
cy.get(interact.SPECTRUM_PICKER_LABEL).click()
cy.get(interact.SPECTRUM_PICKER_LABEL, { timeout: 1000 }).click()
cy.contains("dog").click()
cy.wait(1000)
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT)
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 })
.first()
.type("automationGoodboy")
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT)

View File

@ -10,9 +10,8 @@ filterTests(["smoke", "all"], () => {
it("should create a new Table", () => {
cy.createTable("dog")
cy.wait(1000)
// Check if Table exists
cy.get(interact.TABLE_TITLE_H1).should("have.text", "dog")
cy.get(interact.TABLE_TITLE_H1, { timeout: 1000 }).should("have.text", "dog")
})
it("adds a new column to the table", () => {
@ -40,9 +39,8 @@ filterTests(["smoke", "all"], () => {
it("edits a row", () => {
cy.contains("button", "Edit").click({ force: true })
cy.wait(1000)
cy.get(interact.SPECTRUM_MODAL_INPUT).clear()
cy.get(interact.SPECTRUM_MODAL_INPUT).type("Updated")
cy.get(interact.SPECTRUM_MODAL_INPUT, { timeout: 1000 }).clear()
cy.get(interact.SPECTRUM_MODAL_INPUT, { timeout: 1000 }).type("Updated")
cy.contains("Save").click()
cy.contains("Updated").should("have.text", "Updated")
})
@ -63,8 +61,7 @@ filterTests(["smoke", "all"], () => {
cy.addRow([i])
}
cy.reload()
cy.wait(2000)
cy.get(interact.SPECTRUM_PAGINATION).within(() => {
cy.get(interact.SPECTRUM_PAGINATION, { timeout: 2000 }).within(() => {
cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).click()
})
cy.get(interact.SPECTRUM_PAGINATION).within(() => {
@ -79,10 +76,9 @@ filterTests(["smoke", "all"], () => {
cy.get(interact.SPECTRUM_BUTTON).click({ force: true })
})
cy.get(interact.SPECTRUM_DIALOG_GRID).contains("Delete").click({ force: true })
cy.wait(1000)
// Confirm table only has one page
cy.get(interact.SPECTRUM_PAGINATION).within(() => {
cy.get(interact.SPECTRUM_PAGINATION, { timeout: 1000 }).within(() => {
cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).should("not.be.enabled")
})
})

View File

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

View File

@ -34,7 +34,6 @@ filterTests(['all'], () => {
Large = 16px */
it("should test button roundness", () => {
const buttonRoundnessValues = ["0", "4px", "8px", "16px"]
cy.wait(1000)
// Add button, change roundness and confirm value
cy.addComponent("Button", null).then((componentId) => {
buttonRoundnessValues.forEach(function (item, index){

View File

@ -17,11 +17,10 @@ filterTests(['all'], () => {
// Navigate back within datasource wizard
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Button").contains("Back").click({ force: true })
cy.wait(1000)
})
// Select PostgreSQL datasource again
cy.get(".item-list").contains(datasource).click()
cy.get(".item-list", { timeout: 1000 }).contains(datasource).click()
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
})

View File

@ -111,10 +111,9 @@ filterTests(["all"], () => {
// Save relationship & reload page
cy.get(".spectrum-Button").contains("Save").click({ force: true })
cy.reload()
cy.wait(1000)
})
// Confirm table length & relationship name
cy.get(".spectrum-Table")
cy.get(".spectrum-Table", { timeout: 1000 })
.eq(1)
.find(".spectrum-Table-row")
.its("length")
@ -137,9 +136,8 @@ filterTests(["all"], () => {
.eq(1)
.within(() => {
cy.get(".spectrum-Table-row").eq(0).click({ force: true })
cy.wait(500)
})
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button")
.contains("Delete")
.click({ force: true })
@ -217,9 +215,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button")
.contains("Delete Query")
.click({ force: true })
cy.wait(1000)
// Confirm deletion
cy.get(".nav-item").should("not.contain", queryName)
cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName)
})
}
})

View File

@ -18,9 +18,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button")
.contains("Skip table fetch")
.click({ force: true })
cy.wait(500)
// Confirm config contains localhost
cy.get(".spectrum-Textfield-input")
cy.get(".spectrum-Textfield-input", { timeout: 500 })
.eq(1)
.should("have.value", "localhost")
// Add another Oracle data source, configure & skip table fetch
@ -140,9 +139,8 @@ filterTests(["all"], () => {
.eq(1)
.within(() => {
cy.get(".spectrum-Table-row").eq(0).click()
cy.wait(500)
})
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button")
.contains("Delete")
.click({ force: true })
@ -221,10 +219,9 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button")
.contains("Delete Query")
.click({ force: true })
cy.wait(1000)
// Confirm deletion
cy.get(".nav-item").should("not.contain", queryName)
cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName)
})
}
})

View File

@ -114,9 +114,8 @@ filterTests(["all"], () => {
.eq(1)
.within(() => {
cy.get(".spectrum-Table-row").eq(0).click({ force: true })
cy.wait(500)
})
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button").contains("Delete").click({ force: true })
})
cy.reload()
@ -159,7 +158,7 @@ filterTests(["all"], () => {
switchSchema("randomText")
// No tables displayed
cy.get(".spectrum-Body").eq(2).should("contain", "No tables found")
cy.get(".spectrum-Body", { timeout: 5000 }).eq(2).should("contain", "No tables found")
// Previously created query should be visible
cy.get(".spectrum-Table").should("contain", queryName)
@ -170,7 +169,7 @@ filterTests(["all"], () => {
switchSchema("1")
// Confirm tables exist - Check for specific one
cy.get(".spectrum-Table").eq(0).should("contain", "test")
cy.get(".spectrum-Table", { timeout: 5000 }).eq(0).should("contain", "test")
cy.get(".spectrum-Table")
.eq(0)
.find(".spectrum-Table-row")
@ -184,7 +183,7 @@ filterTests(["all"], () => {
switchSchema("public")
// Confirm tables exist - again
cy.get(".spectrum-Table").eq(0).should("contain", "REGIONS")
cy.get(".spectrum-Table", { timeout: 5000 }).eq(0).should("contain", "REGIONS")
cy.get(".spectrum-Table")
.eq(0)
.find(".spectrum-Table-row")
@ -229,8 +228,7 @@ filterTests(["all"], () => {
// Run and Save query
cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
cy.wait(500)
cy.get(".spectrum-Button").contains("Save Query").click({ force: true })
cy.get(".spectrum-Button", { timeout: 500 }).contains("Save Query").click({ force: true })
cy.get(".nav-item").should("contain", queryRename)
})
@ -247,9 +245,8 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button")
.contains("Delete Query")
.click({ force: true })
cy.wait(1000)
// Confirm deletion
cy.get(".nav-item").should("not.contain", queryName)
cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName)
})
const switchSchema = schema => {
@ -271,7 +268,6 @@ filterTests(["all"], () => {
.click({ force: true })
})
cy.reload()
cy.wait(5000)
}
}
})

View File

@ -14,8 +14,7 @@ filterTests(["smoke", "all"], () => {
// Select REST data source
cy.selectExternalDatasource(datasource)
// Enter incorrect api & attempt to send query
cy.wait(500)
cy.get(".spectrum-Button").contains("Add query").click({ force: true })
cy.get(".spectrum-Button", { timeout: 500 }).contains("Add query").click({ force: true })
cy.intercept("**/preview").as("queryError")
cy.get("input").clear().type("random text")
cy.get(".spectrum-Button").contains("Send").click({ force: true })
@ -36,8 +35,7 @@ filterTests(["smoke", "all"], () => {
// createRestQuery confirms query creation
cy.createRestQuery("GET", restUrl, "/breweries")
// Confirm status code response within REST datasource
cy.wait(1000)
cy.get(".stats").within(() => {
cy.get(".stats", { timeout: 1000 }).within(() => {
cy.get(".spectrum-FieldLabel")
.eq(0)
.should("contain", 200)

View File

@ -12,16 +12,13 @@ filterTests(['all'], () => {
const appRename = "Cypress Renamed"
// Rename app, Search for app, Confirm name was changed
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
renameApp(appName, appRename)
cy.reload()
cy.wait(1000)
cy.searchForApplication(appRename)
cy.get(".appTable").find(".title").should("have.length", 1)
cy.applicationInAppTable(appRename)
// Set app name back to Cypress Tests
cy.reload()
cy.wait(1000)
renameApp(appRename, appName)
})
@ -39,7 +36,6 @@ filterTests(['all'], () => {
})
// Rename app, Search for app, Confirm name was changed
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
renameApp(appName, appRename, true)
cy.get(".appTable").find(".wrapper").should("have.length", 1)
cy.applicationInAppTable(appRename)
@ -48,13 +44,10 @@ filterTests(['all'], () => {
it("Should try to rename an application to have no name", () => {
const appName = "Cypress Tests"
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
renameApp(appName, " ", false, true)
cy.wait(500)
// Close modal and confirm name has not been changed
cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
cy.get(".spectrum-Dialog-grid", { timeout: 1000 }).contains("Cancel").click()
cy.reload()
cy.wait(1000)
cy.applicationInAppTable(appName)
})
@ -62,8 +55,7 @@ filterTests(['all'], () => {
// It is not possible to have applications with the same name
const appName = "Cypress Tests"
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
cy.get(".spectrum-Button", { timeout: 500 }).contains("Create app").click({ force: true })
cy.contains(/Start from scratch/).click()
cy.get(".spectrum-Modal")
.within(() => {
@ -80,24 +72,20 @@ filterTests(['all'], () => {
const numberName = 12345
const specialCharName = "£$%^"
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
renameApp(appName, numberName)
cy.reload()
cy.wait(1000)
cy.applicationInAppTable(numberName)
cy.reload()
cy.wait(1000)
renameApp(numberName, specialCharName)
cy.get(".error").should("have.text", "App name must be letters, numbers and spaces only")
// Set app name back to Cypress Tests
cy.reload()
cy.wait(1000)
renameApp(numberName, appName)
})
const renameApp = (originalName, changedName, published, noName) => {
cy.searchForApplication(originalName)
cy.get(".appTable")
cy.get(".appTable", { timeout: 1000 })
.within(() => {
cy.get("[aria-label='More']").eq(0).click()
})

View File

@ -35,8 +35,7 @@ filterTests(['smoke', 'all'], () => {
cy.get(".spectrum-ButtonGroup").within(() => {
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
})
cy.wait(1000)
cy.get(".spectrum-ButtonGroup").within(() => {
cy.get(".spectrum-ButtonGroup", { timeout: 1000 }).within(() => {
cy.get(".spectrum-Button").contains("Done").click({ force: true })
})
@ -49,18 +48,16 @@ filterTests(['smoke', 'all'], () => {
cy.get(".spectrum-Dialog-grid").within(() => {
// Click Revert
cy.get(".spectrum-Button").contains("Revert").click({ force: true })
cy.wait(1000)
})
// Confirm Paragraph component is still visible
cy.get(".root").contains("New Paragraph")
cy.get(".root", { timeout: 1000 }).contains("New Paragraph")
// Confirm Button component is not visible
cy.get(".root").should("not.have.text", "New Button")
cy.wait(500)
})
it("should enter incorrect app name when reverting", () => {
// Click Revert
cy.get(".toprightnav").within(() => {
cy.get(".toprightnav", { timeout: 1000 }).within(() => {
cy.get("[aria-label='Revert']").click({ force: true })
})
// Enter incorrect app name

View File

@ -3,7 +3,7 @@ Cypress.on("uncaught:exception", () => {
})
// ACCOUNTS & USERS
Cypress.Commands.add("login", () => {
Cypress.Commands.add("login", (email, password) => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(2000)
cy.url().then(url => {
@ -17,8 +17,13 @@ Cypress.Commands.add("login", () => {
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")
if (email == null || password == null) {
cy.get("input").first().type("test@test.com")
cy.get('input[type="password"]').type("test")
} else {
cy.get("input").first().type(email)
cy.get('input[type="password"]').type(password)
}
cy.get("button").first().click({ force: true })
cy.wait(1000)
})
@ -42,7 +47,7 @@ Cypress.Commands.add("createUser", email => {
cy.get(".spectrum-Picker-label").click()
cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click()
//Onboarding type selector
// Onboarding type selector
cy.get(
":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input"
)
@ -52,7 +57,9 @@ Cypress.Commands.add("createUser", email => {
})
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
cy.get(".user-dropdown .avatar > .icon").click({ force: true })
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({
force: true,
})
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
cy.get("li[data-cy='user-info']").click({ force: true })
@ -96,7 +103,7 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => {
typeof addDefaultTable != "boolean" ? true : addDefaultTable
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.get(`[data-cy="create-app-btn"]`, { timeout: 1000 }).click({ force: true })
cy.get(`[data-cy="create-app-btn"]`, { timeout: 2000 }).click({ force: true })
// If apps already exist
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
@ -335,7 +342,7 @@ Cypress.Commands.add("searchForApplication", appName => {
// Assumes there are no others
Cypress.Commands.add("applicationInAppTable", appName => {
cy.get(".appTable").within(() => {
cy.get(".appTable", { timeout: 1000 }).within(() => {
cy.get(".title").contains(appName).should("exist")
})
})
@ -464,10 +471,14 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
// DESIGN AREA
Cypress.Commands.add("addComponent", (category, component) => {
if (category) {
cy.get(`[data-cy="category-${category}"]`).click({ force: true })
cy.get(`[data-cy="category-${category}"]`, { timeout: 1000 }).click({
force: true,
})
}
if (component) {
cy.get(`[data-cy="component-${component}"]`).click({ force: true })
cy.get(`[data-cy="component-${component}"]`, { timeout: 1000 }).click({
force: true,
})
}
cy.wait(2000)
cy.location().then(loc => {

View File

@ -97,10 +97,11 @@ export const ACTION_SPECTRUM_ICON = ".actions .spectrum-Icon"
export const SPECTRUM_MENU_CHILD2 = ".spectrum-Menu > :nth-child(2)"
export const DELETE_TABLE_CONFIRM = '[data-cy="delete-table-confirm"]'
//createUSerAndRoles
//adminAndManagement Folder
export const SPECTRUM_TABLE = ".spectrum-Table"
export const SPECTRUM_SIDENAV = ".spectrum-SideNav"
export const SPECTRUM_TABLE_ROW = ".spectrum-Table-row"
export const SPECTRUM_TABLE_CELL = ".spectrum-Table-cell"
export const FIELD = ".field"
export const CONTAINER = ".container"
export const REGENERATE = ".regenerate"