From 41f5e3dbfd12aa123b7c75727b9f638ea4fb87b5 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Thu, 11 Aug 2022 12:28:20 +0100 Subject: [PATCH] Smoke build test changes - adminAndManagement Some test changes for test files within the adminAndManagement folder - Changes related to UI - Restructured accountPortals tests - Changes related to changing passwords (flow is different now) --- .../adminAndManagement/accountPortals.spec.js | 34 +++++++++---------- .../adminAndManagement/userManagement.spec.js | 14 ++++---- .../adminAndManagement/userSettings.spec.js | 7 ++-- packages/builder/cypress/support/commands.js | 4 +-- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js b/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js index 7b2c68089a..448240f81d 100644 --- a/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js +++ b/packages/builder/cypress/integration/adminAndManagement/accountPortals.spec.js @@ -23,7 +23,7 @@ filterTests(["smoke", "all"], () => { 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 }) + cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force password reset").click({ force: true }) }) cy.get(interact.SPECTRUM_DIALOG_GRID) @@ -41,10 +41,25 @@ filterTests(["smoke", "all"], () => { 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 Standard Portal", () => { + // 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 + cy.logoutNoAppGrid() }) - xit("should verify Admin Portal", () => { + it("should verify Admin Portal", () => { cy.login() // Configure user role cy.setUserRole("bbuser", "Admin") @@ -86,21 +101,6 @@ filterTests(["smoke", "all"], () => { cy.logOut() }) - it("should verify Standard Portal", () => { - // 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 - - cy.logoutNoAppGrid() - }) - const bbUserLogin = () => { // Login as bbuser cy.logOut() diff --git a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js b/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js index 3dfffb1d39..5a864e3bb3 100644 --- a/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js +++ b/packages/builder/cypress/integration/adminAndManagement/userManagement.spec.js @@ -17,7 +17,7 @@ filterTests(["smoke", "all"], () => { it("should confirm App User role for a New User", () => { cy.contains("bbuser").click() - cy.get(".spectrum-Form-itemField").eq(2).should('contain', 'App User') + cy.get(".spectrum-Form-itemField").eq(3).should('contain', 'App User') // User should not have app access cy.get(interact.LIST_ITEMS, { timeout: 500 }).should("contain", "No apps") @@ -166,12 +166,12 @@ filterTests(["smoke", "all"], () => { it("Should edit user details within user details page", () => { // Add First name - cy.get(interact.FIELD, { timeout: 1000 }).eq(0).within(() => { + cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { cy.wait(500) cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).wait(500).clear().click().type("bb") }) // Add Last name - cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { + cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => { cy.wait(500) cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).click().wait(500).clear().type("test") }) @@ -180,10 +180,10 @@ filterTests(["smoke", "all"], () => { cy.reload() // Confirm details have been saved - cy.get(interact.FIELD, { timeout: 1000 }).eq(0).within(() => { + cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', "bb") }) - cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { + cy.get(interact.FIELD, { timeout: 1000 }).eq(2).within(() => { cy.get(interact.SPECTRUM_TEXTFIELD_INPUT, { timeout: 1000 }).should('have.value', "test") }) }) @@ -193,13 +193,14 @@ filterTests(["smoke", "all"], () => { 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 }) + cy.get(interact.SPECTRUM_MENU_ITEM).contains("Force password reset").click({ force: true }) }) // Reset password modal 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 }) + cy.get(interact.SPECTRUM_BUTTON).contains("Reset password").should('not.exist') // Logout, then login with new password cy.logOut() @@ -214,6 +215,7 @@ filterTests(["smoke", "all"], () => { cy.get(interact.SPECTRUM_BUTTON).contains("Reset your password").click({ force: true }) // Confirm user logged in afer password change + cy.login("bbuser@test.com", "test") cy.get(".avatar > .icon").click({ force: true }) cy.get(".spectrum-Menu-item").contains("Update user information").click({ force: true }) diff --git a/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js b/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js index d388d9c7a5..a2b0d32d02 100644 --- a/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js +++ b/packages/builder/cypress/integration/adminAndManagement/userSettings.spec.js @@ -19,10 +19,10 @@ filterTests(["smoke", "all"], () => { cy.contains("Users").click() cy.contains("test@test.com").click() - cy.get(interact.FIELD, { timeout: 1000 }).eq(0).within(() => { + cy.get(interact.FIELD, { timeout: 1000 }).eq(1).within(() => { cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', fname) }) - cy.get(interact.FIELD).eq(1).within(() => { + cy.get(interact.FIELD).eq(2).within(() => { cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).should('have.value', lname) }) }) @@ -72,7 +72,7 @@ filterTests(["smoke", "all"], () => { }) // Logout & in with new password - cy.logOut() + //cy.logOut() cy.login("test@test.com", "newpwd") }) @@ -90,7 +90,6 @@ filterTests(["smoke", "all"], () => { 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(() => { diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 7efd32d258..dbcdb04acb 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -140,14 +140,14 @@ Cypress.Commands.add("setUserRole", (user, role) => { // Set Role cy.wait(500) cy.get(".spectrum-Form-itemField") - .eq(2) + .eq(3) .within(() => { cy.get(".spectrum-Picker-label").click({ force: true }) }) cy.get(".spectrum-Menu").within(() => { cy.get(".spectrum-Menu-itemLabel").contains(role).click({ force: true }) }) - cy.get(".spectrum-Form-itemField").eq(2).should("contain", role) + cy.get(".spectrum-Form-itemField").eq(3).should("contain", role) }) // APPLICATIONS