Test Refactoring

AdminAndManagement + Datasources tests are being being refactored here
This commit is contained in:
Mitch-Budibase 2022-06-27 18:28:21 +01:00
parent a36420225b
commit e8e857c43d
6 changed files with 31 additions and 19 deletions

View File

@ -20,8 +20,10 @@ filterTests(["smoke", "all"], () => {
cy.contains("bbuser").click() cy.contains("bbuser").click()
// Confirm development and admin access are disabled // Confirm development and admin access are disabled
for (let i = 4; i < 6; i++) { for (let i = 4; i < 6; i++) {
cy.wait(500)
cy.get(interact.FIELD).eq(i).within(() => { cy.get(interact.FIELD).eq(i).within(() => {
cy.get(interact.SPECTRUM_SWITCH_INPUT).should('be.disabled') //cy.get(interact.SPECTRUM_SWITCH_INPUT).should('be.disabled')
cy.get(".spectrum-Switch-switch").should('not.be.checked')
}) })
} }
// Existing apps appear within the No Access table // Existing apps appear within the No Access table
@ -80,6 +82,7 @@ filterTests(["smoke", "all"], () => {
.click({ force: true }) .click({ force: true })
}) })
cy.reload() cy.reload()
cy.wait(1000)
} }
// Confirm roles exist within Configure roles table // Confirm roles exist within Configure roles table
cy.get(interact.SPECTRUM_TABLE, { timeout: 2000 }) cy.get(interact.SPECTRUM_TABLE, { timeout: 2000 })
@ -171,12 +174,13 @@ filterTests(["smoke", "all"], () => {
it("Should edit user details within user details page", () => { it("Should edit user details within user details page", () => {
// Add First name // Add First name
cy.get(interact.FIELD, { timeout: 500 }).eq(2).within(() => { cy.get(interact.FIELD, { timeout: 500 }).eq(2).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("bb") cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 500 }).type("bb")
}) })
// Add Last name // Add Last name
cy.get(interact.FIELD).eq(3).within(() => { cy.get(interact.FIELD).eq(3).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("test") cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("test")
}) })
cy.get(interact.FIELD).eq(0).click()
// Reload page // Reload page
cy.reload() cy.reload()
@ -185,20 +189,23 @@ filterTests(["smoke", "all"], () => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb") cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb")
}) })
cy.get(interact.FIELD).eq(3).within(() => { cy.get(interact.FIELD).eq(3).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "test") cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 500 }).should('have.value', "test")
}) })
}) })
it("should reset the users password", () => { it("should reset the users password", () => {
cy.get(interact.REGENERATE, { timeout: 500 }).click({ force: true }) cy.get(interact.REGENERATE, { timeout: 500 }).contains("Force password reset").click({ force: true })
// Reset password modal // Reset password modal
const newPwd = cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value') cy.get(interact.SPECTRUM_DIALOG_GRID)
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd')
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true }) cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
// Logout, then login with new password // Logout, then login with new password
cy.logOut() cy.logOut()
cy.login("bbuser@test.com", newPwd) cy.get('@pwd').then((pwd) => {
cy.login("bbuser@test.com", pwd)
})
// Reset password screen // Reset password screen
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {
@ -207,15 +214,15 @@ filterTests(["smoke", "all"], () => {
cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true }) cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true })
// Confirm user logged in afer password change // Confirm user logged in afer password change
cy.get(".user-dropdown .avatar > .icon").click({ force: true }) cy.get(".avatar > .icon").click({ force: true })
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { cy.get(".spectrum-Menu-item").contains("Update user information").click({ force: true })
cy.get("li[data-cy='user-info']").click({ force: true }) cy.get(interact.SPECTRUM_TEXTFIELD_INPUT)
}) .eq(0)
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value').should('eq', 'bbuser@test.com') .invoke('val').should('eq', 'bbuser@test.com')
// Logout and login as previous user // Logout and login as previous user
cy.logOut() cy.logoutNoAppGrid()
cy.login() cy.login()
}) })

View File

@ -158,11 +158,7 @@ filterTests(["all"], () => {
.contains("Manage") .contains("Manage")
.eq(0) .eq(0)
.click({ force: true }) .click({ force: true })
cy.wait(1000) cy.get(".app-icon", { timwout: 1000 }).click({ force: true })
cy.get(".app-overview-actions-icon").within(() => {
cy.get(".spectrum-Icon").click({ force: true })
})
cy.get(".spectrum-Menu").contains("Edit icon").click()
// Select random icon // Select random icon
cy.get(".grid").within(() => { cy.get(".grid").within(() => {
cy.get(".icon-item") cy.get(".icon-item")

View File

@ -135,7 +135,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table") cy.get(".spectrum-Table")
.eq(1) .eq(1)
.within(() => { .within(() => {
cy.get(".spectrum-Table-row").eq(0).click({ force: true }) cy.get(".spectrum-Table-cell").eq(0).click({ force: true })
}) })
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button") cy.get(".spectrum-Button")
@ -143,6 +143,7 @@ filterTests(["all"], () => {
.click({ force: true }) .click({ force: true })
}) })
cy.reload() cy.reload()
cy.wait(500)
} }
// Confirm relationships no longer exist // Confirm relationships no longer exist
cy.get(".spectrum-Body").should( cy.get(".spectrum-Body").should(

View File

@ -18,6 +18,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button") cy.get(".spectrum-Button")
.contains("Skip table fetch") .contains("Skip table fetch")
.click({ force: true }) .click({ force: true })
cy.wait(500)
// Confirm config contains localhost // Confirm config contains localhost
cy.get(".spectrum-Textfield-input", { timeout: 500 }) cy.get(".spectrum-Textfield-input", { timeout: 500 })
.eq(1) .eq(1)

View File

@ -35,6 +35,7 @@ filterTests(["all"], () => {
// Check response from datasource after adding configuration // Check response from datasource after adding configuration
cy.wait("@datasource") cy.wait("@datasource")
cy.get("@datasource").its("response.statusCode").should("eq", 200) cy.get("@datasource").its("response.statusCode").should("eq", 200)
cy.wait(2000)
// Confirm fetch tables was successful // Confirm fetch tables was successful
cy.get(".spectrum-Table") cy.get(".spectrum-Table")
.eq(0) .eq(0)
@ -113,12 +114,13 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table") cy.get(".spectrum-Table")
.eq(1) .eq(1)
.within(() => { .within(() => {
cy.get(".spectrum-Table-row").eq(0).click({ force: true }) cy.get(".spectrum-Table-cell").eq(0).click({ force: true })
}) })
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => {
cy.get(".spectrum-Button").contains("Delete").click({ force: true }) cy.get(".spectrum-Button").contains("Delete").click({ force: true })
}) })
cy.reload() cy.reload()
cy.wait(500)
// Confirm relationship was deleted // Confirm relationship was deleted
cy.get(".spectrum-Table") cy.get(".spectrum-Table")
.eq(1) .eq(1)
@ -228,7 +230,10 @@ filterTests(["all"], () => {
// Run and Save query // Run and Save query
cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) cy.get(".spectrum-Button").contains("Run Query").click({ force: true })
cy.wait(500)
cy.get(".spectrum-Button", { timeout: 500 }).contains("Save Query").click({ force: true }) cy.get(".spectrum-Button", { timeout: 500 }).contains("Save Query").click({ force: true })
//cy.reload()
//cy.wait(500)
cy.get(".nav-item").should("contain", queryRename) cy.get(".nav-item").should("contain", queryRename)
}) })
@ -268,6 +273,7 @@ filterTests(["all"], () => {
.click({ force: true }) .click({ force: true })
}) })
cy.reload() cy.reload()
cy.wait(1000)
} }
} }
}) })

View File

@ -650,6 +650,7 @@ Cypress.Commands.add("selectExternalDatasource", datasourceName => {
cy.get(".spectrum-Dialog-grid").within(() => { cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.get(".spectrum-Button").contains("Continue").click({ force: true })
}) })
cy.wait(500)
}) })
Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => { Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => {