1
0
Fork 0
mirror of synced 2024-06-21 11:51:00 +12:00

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 3f597ba6e0
commit 60592616f8
6 changed files with 31 additions and 19 deletions

View file

@ -20,8 +20,10 @@ filterTests(["smoke", "all"], () => {
cy.contains("bbuser").click()
// Confirm development and admin access are disabled
for (let i = 4; i < 6; i++) {
cy.wait(500)
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
@ -80,6 +82,7 @@ filterTests(["smoke", "all"], () => {
.click({ force: true })
})
cy.reload()
cy.wait(1000)
}
// Confirm roles exist within Configure roles table
cy.get(interact.SPECTRUM_TABLE, { timeout: 2000 })
@ -171,12 +174,13 @@ filterTests(["smoke", "all"], () => {
it("Should edit user details within user details page", () => {
// Add First name
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
cy.get(interact.FIELD).eq(3).within(() => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("test")
})
cy.get(interact.FIELD).eq(0).click()
// Reload page
cy.reload()
@ -185,20 +189,23 @@ filterTests(["smoke", "all"], () => {
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb")
})
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", () => {
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
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 })
// Logout, then login with new password
cy.logOut()
cy.login("bbuser@test.com", newPwd)
cy.get('@pwd').then((pwd) => {
cy.login("bbuser@test.com", pwd)
})
// Reset password screen
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 })
// 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("li[data-cy='user-info']").click({ force: true })
})
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).its('value').should('eq', 'bbuser@test.com')
cy.get(".spectrum-Menu-item").contains("Update user information").click({ force: true })
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT)
.eq(0)
.invoke('val').should('eq', 'bbuser@test.com')
// Logout and login as previous user
cy.logOut()
cy.logoutNoAppGrid()
cy.login()
})

View file

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

View file

@ -135,7 +135,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table")
.eq(1)
.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-Button")
@ -143,6 +143,7 @@ filterTests(["all"], () => {
.click({ force: true })
})
cy.reload()
cy.wait(500)
}
// Confirm relationships no longer exist
cy.get(".spectrum-Body").should(

View file

@ -18,6 +18,7 @@ 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", { timeout: 500 })
.eq(1)

View file

@ -35,6 +35,7 @@ filterTests(["all"], () => {
// Check response from datasource after adding configuration
cy.wait("@datasource")
cy.get("@datasource").its("response.statusCode").should("eq", 200)
cy.wait(2000)
// Confirm fetch tables was successful
cy.get(".spectrum-Table")
.eq(0)
@ -113,12 +114,13 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table")
.eq(1)
.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-Button").contains("Delete").click({ force: true })
})
cy.reload()
cy.wait(500)
// Confirm relationship was deleted
cy.get(".spectrum-Table")
.eq(1)
@ -228,7 +230,10 @@ filterTests(["all"], () => {
// Run and Save query
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.reload()
//cy.wait(500)
cy.get(".nav-item").should("contain", queryRename)
})
@ -268,6 +273,7 @@ filterTests(["all"], () => {
.click({ force: true })
})
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-Button").contains("Continue").click({ force: true })
})
cy.wait(500)
})
Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => {