2022-06-20 19:38:44 +02:00
|
|
|
import filterTests from "../../support/filterTests"
|
|
|
|
const interact = require('../../support/interact')
|
|
|
|
|
|
|
|
filterTests(["smoke", "all"], () => {
|
2023-01-05 17:55:26 +01:00
|
|
|
xcontext("Account Portals", () => {
|
2022-12-19 18:23:13 +01:00
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
const bbUserEmail = "bbuser@test.com"
|
2022-12-19 18:23:13 +01:00
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.deleteApp("Cypress Tests")
|
2022-07-06 16:56:02 +02:00
|
|
|
cy.createApp("Cypress Tests", false)
|
2022-12-19 18:23:13 +01:00
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
// Create new user
|
2022-07-06 16:56:02 +02:00
|
|
|
cy.wait(500)
|
2022-12-19 18:23:13 +01:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-06-20 19:38:44 +02:00
|
|
|
cy.createUser(bbUserEmail)
|
|
|
|
cy.contains("bbuser").click()
|
|
|
|
cy.wait(500)
|
|
|
|
|
|
|
|
// Reset 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-12-19 18:23:13 +01:00
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID)
|
2022-12-19 18:23:13 +01:00
|
|
|
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd')
|
2022-06-20 19:38:44 +02:00
|
|
|
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
|
2022-12-19 18:23:13 +01:00
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
// Login as new user and set password
|
|
|
|
cy.logOut()
|
|
|
|
cy.get('@pwd').then((pwd) => {
|
|
|
|
cy.login(bbUserEmail, pwd)
|
|
|
|
})
|
2022-12-19 18:23:13 +01:00
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
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 })
|
2022-08-11 13:28:20 +02:00
|
|
|
//cy.logoutNoAppGrid()
|
|
|
|
})
|
|
|
|
|
2023-01-05 17:55:26 +01:00
|
|
|
xit("should verify Standard Portal", () => {
|
2022-08-11 13:28:20 +02:00
|
|
|
// Development access should be disabled (Admin access is already disabled)
|
|
|
|
cy.login()
|
|
|
|
cy.setUserRole("bbuser", "App User")
|
|
|
|
bbUserLogin()
|
|
|
|
|
|
|
|
// Verify Standard Portal
|
|
|
|
cy.get(interact.SPECTRUM_SIDENAV).should('not.exist') // No config sections
|
|
|
|
cy.get(interact.CREATE_APP_BUTTON).should('not.exist') // No create app button
|
|
|
|
cy.get(".app").should('not.exist') // No apps -> no roles assigned to user
|
|
|
|
cy.get(interact.CONTAINER).should('contain', bbUserEmail) // Message containing users email
|
|
|
|
|
2022-06-20 19:38:44 +02:00
|
|
|
cy.logoutNoAppGrid()
|
|
|
|
})
|
2022-12-19 18:23:13 +01:00
|
|
|
|
|
|
|
xit("should verify Admin Portal", () => {
|
|
|
|
cy.login()
|
|
|
|
// Configure user role
|
|
|
|
cy.setUserRole("bbuser", "Admin")
|
|
|
|
bbUserLogin()
|
|
|
|
|
|
|
|
// Verify available options for Admin portal
|
|
|
|
cy.get(interact.SPECTRUM_SIDENAV)
|
2022-06-20 19:38:44 +02:00
|
|
|
.should('contain', 'Apps')
|
|
|
|
//.and('contain', 'Usage')
|
|
|
|
.and('contain', 'Users')
|
|
|
|
.and('contain', 'Auth')
|
|
|
|
.and('contain', 'Email')
|
|
|
|
.and('contain', 'Organisation')
|
|
|
|
.and('contain', 'Theming')
|
|
|
|
.and('contain', 'Update')
|
2022-12-19 18:23:13 +01:00
|
|
|
//.and('contain', 'Upgrade')
|
2022-06-20 19:38:44 +02:00
|
|
|
|
2022-12-19 18:23:13 +01:00
|
|
|
cy.logOut()
|
2022-06-20 19:38:44 +02:00
|
|
|
})
|
|
|
|
|
2022-12-19 18:23:13 +01:00
|
|
|
xit("should verify Development Portal", () => {
|
2022-06-20 19:38:44 +02:00
|
|
|
// Only Development access should be enabled
|
|
|
|
cy.login()
|
2022-07-29 19:41:57 +02:00
|
|
|
cy.setUserRole("bbuser", "Developer")
|
2022-06-20 19:38:44 +02:00
|
|
|
bbUserLogin()
|
|
|
|
|
|
|
|
// Verify available options for Admin portal
|
|
|
|
cy.get(interact.SPECTRUM_SIDENAV)
|
|
|
|
.should('contain', 'Apps')
|
|
|
|
//.and('contain', 'Usage')
|
|
|
|
.and('not.contain', 'Users')
|
|
|
|
.and('not.contain', 'Auth')
|
|
|
|
.and('not.contain', 'Email')
|
|
|
|
.and('not.contain', 'Organisation')
|
|
|
|
.and('contain', 'Theming')
|
|
|
|
.and('not.contain', 'Update')
|
|
|
|
.and('not.contain', 'Upgrade')
|
|
|
|
|
2022-12-19 18:23:13 +01:00
|
|
|
cy.logOut()
|
2022-06-20 19:38:44 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
const bbUserLogin = () => {
|
|
|
|
// Login as bbuser
|
|
|
|
cy.logOut()
|
|
|
|
cy.login(bbUserEmail, "test")
|
|
|
|
}
|
2022-06-22 19:55:43 +02:00
|
|
|
|
|
|
|
after(() => {
|
|
|
|
cy.login()
|
|
|
|
// Delete BB user
|
|
|
|
cy.deleteUser(bbUserEmail)
|
|
|
|
})
|
2022-06-20 19:38:44 +02:00
|
|
|
})
|
|
|
|
})
|