2022-06-20 19:38:44 +02:00
|
|
|
import filterTests from "../../support/filterTests"
|
|
|
|
const interact = require('../../support/interact')
|
|
|
|
|
|
|
|
filterTests(["smoke", "all"], () => {
|
|
|
|
context("Account Portals", () => {
|
|
|
|
|
|
|
|
const bbUserEmail = "bbuser@test.com"
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.deleteApp("Cypress Tests")
|
2022-07-06 16:56:02 +02:00
|
|
|
cy.createApp("Cypress Tests", false)
|
2022-06-20 19:38:44 +02:00
|
|
|
|
|
|
|
// Create new user
|
2022-07-06 16:56:02 +02:00
|
|
|
cy.wait(500)
|
|
|
|
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(() => {
|
|
|
|
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force Password Reset").click({ force: true })
|
|
|
|
})
|
2022-06-20 19:38:44 +02:00
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID)
|
2022-06-20 19:38:44 +02:00
|
|
|
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('pwd')
|
|
|
|
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").click({ force: true })
|
|
|
|
|
|
|
|
// Login as new user and set password
|
|
|
|
cy.logOut()
|
|
|
|
cy.get('@pwd').then((pwd) => {
|
|
|
|
cy.login(bbUserEmail, pwd)
|
|
|
|
})
|
|
|
|
|
|
|
|
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 })
|
|
|
|
cy.logoutNoAppGrid()
|
|
|
|
})
|
|
|
|
|
2022-07-29 19:41:57 +02:00
|
|
|
xit("should verify Admin Portal", () => {
|
2022-06-20 19:38:44 +02:00
|
|
|
cy.login()
|
2022-07-29 19:41:57 +02:00
|
|
|
// Configure user role
|
|
|
|
cy.setUserRole("bbuser", "Admin")
|
2022-06-20 19:38:44 +02:00
|
|
|
bbUserLogin()
|
|
|
|
|
|
|
|
// Verify available options for Admin portal
|
2022-07-29 19:41:57 +02:00
|
|
|
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')
|
|
|
|
//.and('contain', 'Upgrade')
|
|
|
|
|
|
|
|
cy.logOut()
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should verify Development Portal", () => {
|
|
|
|
// 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')
|
|
|
|
|
|
|
|
cy.logOut()
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should verify Standard Portal", () => {
|
|
|
|
// Development access should be disabled (Admin access is already disabled)
|
|
|
|
cy.login()
|
2022-07-29 19:41:57 +02:00
|
|
|
cy.setUserRole("bbuser", "App User")
|
2022-06-20 19:38:44 +02:00
|
|
|
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-21 19:25:33 +02:00
|
|
|
|
2022-06-22 19:55:43 +02:00
|
|
|
cy.logoutNoAppGrid()
|
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
|
|
|
})
|
|
|
|
})
|