AdminAndManagement test changes + Commands update

Specifically changes for accountPortals & userManagement

Commands
- Delete user function added
- Few timing changes
This commit is contained in:
Mitch-Budibase 2022-06-22 18:55:43 +01:00
parent f98f306491
commit 4b92b5557b
3 changed files with 42 additions and 28 deletions

View File

@ -113,7 +113,7 @@ filterTests(["smoke", "all"], () => {
cy.get(".app").should('not.exist') // No apps -> no roles assigned to user
cy.get(interact.CONTAINER).should('contain', bbUserEmail) // Message containing users email
cy.logOut()
cy.logoutNoAppGrid()
})
const bbUserLogin = () => {
@ -121,5 +121,11 @@ filterTests(["smoke", "all"], () => {
cy.logOut()
cy.login(bbUserEmail, "test")
}
after(() => {
cy.login()
// Delete BB user
cy.deleteUser(bbUserEmail)
})
})
})

View File

@ -220,22 +220,7 @@ filterTests(["smoke", "all"], () => {
})
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.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 500 }).within(() => {
cy.get(interact.SPECTRUM_BUTTON)
.contains("Delete user")
.click({ force: true })
})
})
cy.deleteUser("bbuser@test.com")
cy.get(interact.SPECTRUM_TABLE, { timeout: 4000 }).should("not.have.text", "bbuser")
})
})

View File

@ -32,7 +32,7 @@ Cypress.Commands.add("login", (email, password) => {
})
Cypress.Commands.add("logOut", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 })
cy.get(".user-dropdown .avatar > .icon").click({ force: true })
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
cy.get("li[data-cy='user-logout']").click({ force: true })
@ -54,16 +54,38 @@ Cypress.Commands.add("createUser", email => {
// quick hacky recorded way to create a user
cy.contains("Users").click()
cy.get(`[data-cy="add-user"]`).click()
cy.get(".spectrum-Picker-label").click()
cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click()
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Picker-label").click()
cy.get(
".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel"
).click()
// Onboarding type selector
cy.get(
":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input"
)
.first()
.type(email, { force: true })
cy.get(".spectrum-Button--cta").click({ force: true })
// Onboarding type selector
cy.get(".spectrum-Textfield-input")
.eq(0)
.first()
.type(email, { force: true })
cy.get(".spectrum-Button--cta").click({ force: true })
})
})
Cypress.Commands.add("deleteUser", email => {
// Assumes user has access to Users section
cy.contains("Users", { timeout: 2000 }).click()
cy.contains(email).click()
// Click Delete user button
cy.get(".spectrum-Button")
.contains("Delete user")
.click({ force: true })
.then(() => {
// Confirm deletion within modal
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button")
.contains("Delete user")
.click({ force: true })
})
})
})
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
@ -377,7 +399,8 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => {
cy.navigateToDataSection()
cy.get(`[data-cy="new-table"]`).click()
}
cy.get(".spectrum-Dialog-grid", { timeout: 5000 })
cy.wait(500)
cy.get(".spectrum-Dialog-grid")
.contains("Budibase DB")
.click({ force: true })
.then(() => {