mirror of https://github.com/Budibase/budibase.git
committed by
GitHub
23 changed files with 519 additions and 244 deletions
@ -0,0 +1,131 @@ |
|||
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") |
|||
cy.createApp("Cypress Tests") |
|||
|
|||
// Create new user
|
|||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 1000}) |
|||
cy.createUser(bbUserEmail) |
|||
cy.contains("bbuser").click() |
|||
cy.wait(500) |
|||
|
|||
// Reset password
|
|||
cy.get(".spectrum-ActionButton-label", { timeout: 2000 }).contains("Force password reset").click({ force: true }) |
|||
|
|||
cy.get(".spectrum-Dialog-grid") |
|||
.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() |
|||
}) |
|||
|
|||
it("should verify Admin Portal", () => { |
|||
cy.login() |
|||
cy.contains("Users").click() |
|||
cy.contains("bbuser").click() |
|||
|
|||
// Enable Development & Administration access
|
|||
cy.wait(500) |
|||
for (let i = 4; i < 6; i++) { |
|||
cy.get(interact.FIELD).eq(i).within(() => { |
|||
cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true }) |
|||
cy.get(interact.SPECTRUM_SWITCH_INPUT).should('be.enabled') |
|||
}) |
|||
} |
|||
bbUserLogin() |
|||
|
|||
// Verify available options for Admin portal
|
|||
cy.get(".spectrum-SideNav") |
|||
.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() |
|||
cy.contains("Users").click() |
|||
cy.contains("bbuser").click() |
|||
cy.wait(500) |
|||
cy.get(interact.FIELD).eq(5).within(() => { |
|||
cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true }) |
|||
}) |
|||
|
|||
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() |
|||
cy.contains("Users").click() |
|||
cy.contains("bbuser").click() |
|||
cy.wait(500) |
|||
cy.get(interact.FIELD).eq(4).within(() => { |
|||
cy.get(interact.SPECTRUM_SWITCH_INPUT).click({ force: true }) |
|||
}) |
|||
|
|||
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
|
|||
|
|||
cy.logoutNoAppGrid() |
|||
}) |
|||
|
|||
const bbUserLogin = () => { |
|||
// Login as bbuser
|
|||
cy.logOut() |
|||
cy.login(bbUserEmail, "test") |
|||
} |
|||
|
|||
after(() => { |
|||
cy.login() |
|||
// Delete BB user
|
|||
cy.deleteUser(bbUserEmail) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,108 @@ |
|||
import filterTests from "../../support/filterTests" |
|||
const interact = require('../../support/interact') |
|||
|
|||
filterTests(["smoke", "all"], () => { |
|||
context("User Settings Menu", () => { |
|||
|
|||
before(() => { |
|||
cy.login() |
|||
}) |
|||
|
|||
it("should update user information via user settings menu", () => { |
|||
const fname = "test" |
|||
const lname = "user" |
|||
|
|||
cy.visit(`${Cypress.config().baseUrl}/builder`) |
|||
cy.updateUserInformation(fname, lname) |
|||
|
|||
// Go to user info and confirm name update
|
|||
cy.contains("Users").click() |
|||
cy.contains("test@test.com").click() |
|||
|
|||
cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => { |
|||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', fname) |
|||
}) |
|||
cy.get(interact.FIELD).eq(3).within(() => { |
|||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', lname) |
|||
}) |
|||
}) |
|||
|
|||
it("should allow copying of the users API key", () => { |
|||
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) |
|||
cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true }) |
|||
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { |
|||
cy.get(interact.SPECTRUM_ICON).click({force: true}) |
|||
}) |
|||
// There may be timing issues with this on the smoke build
|
|||
cy.wait(500) |
|||
cy.get(".spectrum-Toast-content") |
|||
.contains("URL copied to clipboard") |
|||
.should("be.visible") |
|||
}) |
|||
|
|||
it("should allow API key regeneration", () => { |
|||
// Get initial API key value
|
|||
cy.get(interact.SPECTRUM_DIALOG_CONTENT) |
|||
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne') |
|||
|
|||
// Click re-generate key button
|
|||
cy.get("button").contains("Re-generate key").click({ force: true }) |
|||
|
|||
// Verify API key was changed
|
|||
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { |
|||
cy.get('@keyOne').then((keyOne) => { |
|||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').should('not.eq', keyOne) |
|||
}) |
|||
}) |
|||
cy.closeModal() |
|||
}) |
|||
|
|||
it("should update password", () => { |
|||
// Access Update password modal
|
|||
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) |
|||
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) |
|||
|
|||
// Enter new password and update
|
|||
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { |
|||
for (let i = 0; i < 2; i++) { |
|||
// password set to 'newpwd'
|
|||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("newpwd") |
|||
} |
|||
cy.get("button").contains("Update password").click({ force: true }) |
|||
}) |
|||
|
|||
// Logout & in with new password
|
|||
cy.logOut() |
|||
cy.login("test@test.com", "newpwd") |
|||
}) |
|||
|
|||
it("should open and close developer mode", () => { |
|||
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) |
|||
|
|||
// Close developer mode & verify
|
|||
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true }) |
|||
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') // At least one app should be available
|
|||
|
|||
// Open developer mode & verify
|
|||
cy.get(".avatar > .icon").click({ force: true }) |
|||
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true }) |
|||
cy.get(interact.SPECTRUM_SIDENAV).should('exist') // config sections available
|
|||
cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available
|
|||
cy.get(interact.APP_TABLE).should('exist') // App table available
|
|||
}) |
|||
|
|||
after(() => { |
|||
// Change password back to original value
|
|||
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) |
|||
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) |
|||
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { |
|||
for (let i = 0; i < 2; i++) { |
|||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).eq(i).type("test") |
|||
} |
|||
cy.get("button").contains("Update password").click({ force: true }) |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
Loading…
Reference in new issue