2022-06-17 18:41:07 +02:00
|
|
|
import filterTests from "../../support/filterTests"
|
|
|
|
const interact = require('../../support/interact')
|
2021-11-15 16:25:58 +01:00
|
|
|
|
2022-02-23 14:14:28 +01:00
|
|
|
filterTests(["smoke", "all"], () => {
|
2022-06-17 18:41:07 +02:00
|
|
|
context("User Management", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
2022-05-17 14:32:29 +02:00
|
|
|
cy.deleteApp("Cypress Tests")
|
2022-07-06 18:32:27 +02:00
|
|
|
cy.createApp("Cypress Tests", false)
|
2021-11-15 16:25:58 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
2022-06-17 18:41:07 +02:00
|
|
|
it("should create a user via basic onboarding", () => {
|
2022-07-06 16:56:02 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.createUser("bbuser@test.com")
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE).should("contain", "bbuser")
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
it("should confirm App User role for a New User", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("bbuser").click()
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(".spectrum-Form-itemField").eq(3).should('contain', 'App User')
|
2022-07-29 19:41:57 +02:00
|
|
|
|
|
|
|
// User should not have app access
|
|
|
|
cy.get(interact.LIST_ITEMS, { timeout: 500 }).should("contain", "No apps")
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-03-29 19:32:36 +02:00
|
|
|
if (Cypress.env("TEST_ENV")) {
|
2022-07-29 19:41:57 +02:00
|
|
|
xit("should assign role types", () => {
|
2022-03-29 19:32:36 +02:00
|
|
|
// 3 apps minimum required - to assign an app to each role type
|
|
|
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
|
|
|
.its("body")
|
|
|
|
.then(val => {
|
|
|
|
if (val.length < 3) {
|
|
|
|
for (let i = 1; i < 3; i++) {
|
|
|
|
const uuid = () => Cypress._.random(0, 1e6)
|
|
|
|
const name = uuid()
|
|
|
|
if(i < 1){
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.createApp(name, false)
|
2022-03-29 19:32:36 +02:00
|
|
|
} else {
|
2022-07-06 18:32:27 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.wait(1000)
|
|
|
|
cy.get(interact.CREATE_APP_BUTTON, { timeout: 2000 }).click({ force: true })
|
2022-03-29 19:32:36 +02:00
|
|
|
cy.createAppFromScratch(name)
|
|
|
|
}
|
2022-03-29 00:21:38 +02:00
|
|
|
}
|
2022-02-23 14:14:28 +01:00
|
|
|
}
|
2022-03-29 19:32:36 +02:00
|
|
|
})
|
|
|
|
// Navigate back to the user
|
2022-07-06 18:32:27 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click()
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click()
|
2022-07-26 15:43:06 +02:00
|
|
|
cy.get(interact.SPECTRUM_HEADING).contains("bbuser", { timeout: 2000})
|
2022-03-29 19:32:36 +02:00
|
|
|
for (let i = 0; i < 3; i++) {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE, { timeout: 3000})
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(1)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_ROW)
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_CELL)
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(0)
|
|
|
|
.click()
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 })
|
2022-03-29 19:32:36 +02:00
|
|
|
.contains("Choose an option")
|
|
|
|
.click()
|
|
|
|
.then(() => {
|
|
|
|
if (i == 0) {
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Admin").click({ force: true })
|
2022-03-29 19:32:36 +02:00
|
|
|
}
|
2022-05-05 12:22:04 +02:00
|
|
|
else if (i == 1) {
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Power").click({ force: true })
|
2022-03-29 19:32:36 +02:00
|
|
|
}
|
2022-05-05 12:22:04 +02:00
|
|
|
else if (i == 2) {
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Basic").click({ force: true })
|
2022-03-29 19:32:36 +02:00
|
|
|
}
|
2022-07-08 12:33:11 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON, { timeout: 2000 })
|
2022-03-29 19:32:36 +02:00
|
|
|
.contains("Update role")
|
|
|
|
.click({ force: true })
|
|
|
|
})
|
2022-09-06 10:12:34 +02:00
|
|
|
cy.reload()
|
2022-06-27 19:28:21 +02:00
|
|
|
cy.wait(1000)
|
2022-03-29 19:32:36 +02:00
|
|
|
}
|
|
|
|
// Confirm roles exist within Configure roles table
|
2022-09-06 10:12:34 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE, { timeout: 20000 })
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(0)
|
2022-03-29 19:32:36 +02:00
|
|
|
.within(assginedRoles => {
|
|
|
|
expect(assginedRoles).to.contain("Admin")
|
|
|
|
expect(assginedRoles).to.contain("Power")
|
|
|
|
expect(assginedRoles).to.contain("Basic")
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
xit("should unassign role types", () => {
|
2022-03-29 19:32:36 +02:00
|
|
|
// Set each app within Configure roles table to 'No Access'
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE)
|
2022-02-23 14:53:15 +01:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_ROW)
|
2022-03-29 19:32:36 +02:00
|
|
|
.its("length")
|
|
|
|
.then(len => {
|
|
|
|
for (let i = 0; i < len; i++) {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE)
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_ROW)
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_CELL)
|
2022-03-29 19:32:36 +02:00
|
|
|
.eq(0)
|
|
|
|
.click()
|
|
|
|
.then(() => {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_PICKER).eq(1).click({ force: true })
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_POPOVER, { timeout: 500 }).contains("No Access").click()
|
2022-03-29 19:32:36 +02:00
|
|
|
})
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON)
|
2022-03-29 19:32:36 +02:00
|
|
|
.contains("Update role")
|
|
|
|
.click({ force: true })
|
2022-02-23 14:14:28 +01:00
|
|
|
}
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-03-29 19:32:36 +02:00
|
|
|
// Confirm Configure roles table no longer has any apps in it
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).eq(0).contains("No rows found")
|
2022-03-29 19:32:36 +02:00
|
|
|
})
|
|
|
|
}
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
xit("should enable Developer access and verify application access", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
// Enable Developer access
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.FIELD)
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(4)
|
|
|
|
.within(() => {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true })
|
2022-02-23 14:14:28 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
// No Access table should now be empty
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.CONTAINER)
|
2022-02-23 14:14:28 +01:00
|
|
|
.contains("No Access")
|
|
|
|
.parent()
|
|
|
|
.within(() => {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE).contains("No rows found")
|
2022-02-23 14:14:28 +01:00
|
|
|
})
|
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
// Each app within Configure roles should have Admin access
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE)
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_ROW)
|
2022-02-23 14:14:28 +01:00
|
|
|
.its("length")
|
|
|
|
.then(len => {
|
|
|
|
for (let i = 0; i < len; i++) {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE)
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(0)
|
2022-06-06 17:03:41 +02:00
|
|
|
.find(interact.SPECTRUM_TABLE_ROW)
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(i)
|
|
|
|
.contains("Admin")
|
|
|
|
cy.wait(500)
|
|
|
|
}
|
|
|
|
})
|
2021-11-15 16:25:58 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
xit("should disable Developer access and verify application access", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
// Disable Developer access
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.FIELD)
|
2022-02-23 14:14:28 +01:00
|
|
|
.eq(4)
|
|
|
|
.within(() => {
|
|
|
|
cy.get(".spectrum-Switch-input").click({ force: true })
|
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
// Configure roles table should now be empty
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.CONTAINER)
|
2022-02-23 14:14:28 +01:00
|
|
|
.contains("Configure roles")
|
|
|
|
.parent()
|
|
|
|
.within(() => {
|
2022-06-06 17:03:41 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE).contains("No rows found")
|
2022-02-23 14:14:28 +01:00
|
|
|
})
|
2021-11-18 14:47:41 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-06-17 18:41:07 +02:00
|
|
|
it("Should edit user details within user details page", () => {
|
2022-06-08 19:08:45 +02:00
|
|
|
// Add First name
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => {
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.wait(500)
|
2022-07-07 13:50:30 +02:00
|
|
|
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).wait(500).clear().click().type("bb")
|
2022-06-08 19:08:45 +02:00
|
|
|
})
|
|
|
|
// Add Last name
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => {
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.wait(500)
|
2022-07-07 13:50:30 +02:00
|
|
|
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).click().wait(500).clear().type("test")
|
2022-06-08 19:08:45 +02:00
|
|
|
})
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.get(interact.FIELD, { timeout: 1000 }).eq(0).click()
|
2022-06-17 18:41:07 +02:00
|
|
|
// Reload page
|
|
|
|
cy.reload()
|
2022-06-08 19:08:45 +02:00
|
|
|
|
|
|
|
// Confirm details have been saved
|
2022-09-06 10:12:34 +02:00
|
|
|
cy.get(interact.FIELD, { timeout: 20000 }).eq(1).within(() => {
|
2022-06-08 19:08:45 +02:00
|
|
|
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb")
|
|
|
|
})
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => {
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).should('have.value', "test")
|
2022-06-08 19:08:45 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-06-17 18:41:07 +02:00
|
|
|
it("should reset the users password", () => {
|
2022-07-29 19:41:57 +02:00
|
|
|
cy.get(".title").within(() => {
|
|
|
|
cy.get(interact.SPECTRUM_ICON).click({ force: true })
|
|
|
|
})
|
|
|
|
cy.get(interact.SPECTRUM_MENU).within(() => {
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force password reset").click({ force: true })
|
2022-07-29 19:41:57 +02:00
|
|
|
})
|
2022-06-17 18:41:07 +02:00
|
|
|
|
|
|
|
// Reset password modal
|
2022-06-27 19:28:21 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID)
|
|
|
|
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd')
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").should('not.exist')
|
2022-06-17 18:41:07 +02:00
|
|
|
|
|
|
|
// Logout, then login with new password
|
|
|
|
cy.logOut()
|
2022-06-27 19:28:21 +02:00
|
|
|
cy.get('@pwd').then((pwd) => {
|
|
|
|
cy.login("bbuser@test.com", pwd)
|
|
|
|
})
|
2022-06-17 18:41:07 +02:00
|
|
|
|
|
|
|
// 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
|
2022-08-11 13:28:20 +02:00
|
|
|
cy.login("bbuser@test.com", "test")
|
2022-06-27 19:28:21 +02:00
|
|
|
cy.get(".avatar > .icon").click({ force: true })
|
2022-06-17 18:41:07 +02:00
|
|
|
|
2022-06-27 19:28:21 +02:00
|
|
|
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')
|
2022-06-17 18:41:07 +02:00
|
|
|
|
|
|
|
// Logout and login as previous user
|
2022-06-27 19:28:21 +02:00
|
|
|
cy.logoutNoAppGrid()
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.login()
|
|
|
|
})
|
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("should delete a user", () => {
|
2022-06-22 19:55:43 +02:00
|
|
|
cy.deleteUser("bbuser@test.com")
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_TABLE, { timeout: 4000 }).should("not.have.text", "bbuser")
|
2021-11-15 16:25:58 +01:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|