From 0795bae0c8179c9ea8b78495788ac2c2f8a8e8f7 Mon Sep 17 00:00:00 2001 From: Parissa Date: Wed, 24 Jan 2024 15:13:21 -0500 Subject: [PATCH] code review feedback --- .../partials/login_sidebar_banner.html | 2 +- .../e2e/cypress/e2e/custom-login-page.cy.js | 43 +++++++++++++++++++ .../cypress/e2e/policy-repository.spec.cy.js | 26 +++++------ .../cypress/support/common-commands/login.js | 4 +- .../regulations/css/scss/partials/_about.scss | 6 --- .../regulations/css/scss/partials/_login.scss | 3 +- 6 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 solution/ui/e2e/cypress/e2e/custom-login-page.cy.js diff --git a/solution/backend/regulations/templates/regulations/partials/login_sidebar_banner.html b/solution/backend/regulations/templates/regulations/partials/login_sidebar_banner.html index f039e8d67a..54cf6bfec7 100644 --- a/solution/backend/regulations/templates/regulations/partials/login_sidebar_banner.html +++ b/solution/backend/regulations/templates/regulations/partials/login_sidebar_banner.html @@ -3,7 +3,7 @@ Resources you can access include policy documents internal to CMCS. {% else %} CMCS staff participating in the Policy Repository pilot can - sign in to see internal resources. diff --git a/solution/ui/e2e/cypress/e2e/custom-login-page.cy.js b/solution/ui/e2e/cypress/e2e/custom-login-page.cy.js new file mode 100644 index 0000000000..fb266641cd --- /dev/null +++ b/solution/ui/e2e/cypress/e2e/custom-login-page.cy.js @@ -0,0 +1,43 @@ +describe("custom login page", { scrollBehavior: "center" }, () => { + beforeEach(() => { + cy.clearIndexedDB(); + cy.intercept("/**", (req) => { + req.headers["x-automated-test"] = Cypress.env("DEPLOYING"); + }); + }); + + it("has a flash banner at the top with a link to a feedback survey", () => { + cy.viewport("macbook-15"); + cy.visit("/login"); + cy.checkFlashBanner(); + }); + + it("shows feedback form in modal when clicking feedback link in flash banner", () => { + // feedback link is in banner + cy.viewport("macbook-15"); + cy.visit("/login"); + cy.checkBlockingModal(); + }); + + it("error-page - jumps to a regulation Part using the jump-to select", () => { + cy.viewport("macbook-15"); + cy.visit("/login"); + cy.jumpToRegulationPart({ title: "45", part: "95" }); + }); + + it("error-page - jumps to a regulation Part section using the section number text input", () => { + cy.viewport("macbook-15"); + cy.visit("/login"); + cy.jumpToRegulationPartSection({ + title: "42", + part: "433", + section: "40", + }); + }); + + it("allows a user to go back to the homepage by clicking the top left link", () => { + cy.viewport("macbook-15"); + cy.visit("/login"); + cy.goHome(); + }); +}); diff --git a/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js b/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js index fa3b59428c..eff073ebc1 100644 --- a/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js +++ b/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js @@ -31,7 +31,7 @@ Cypress.Commands.add("getPolicyDocs", ({ username, password }) => { fixture: "policy-docs.json", }).as("subjectFiles"); cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository/?q=mock"); cy.injectAxe(); cy.wait("@subjectFiles").then((interception) => { @@ -50,7 +50,7 @@ describe("Policy Repository", () => { it("show the policy repository page when logged in", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.url().should("include", "/policy-repository/"); cy.get("#loginIndicator").should("be.visible"); @@ -82,7 +82,7 @@ describe("Policy Repository", () => { it("should make a successful request to the content-search endpoint", () => { cy.intercept("**/v3/content-search/?**").as("files"); cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.url().should("include", "/policy-repository/"); cy.get(".subj-toc__list li:nth-child(1) a").click({ force: true }); @@ -93,7 +93,7 @@ describe("Policy Repository", () => { it("loads the correct subject and search query when the URL is changed", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.url().should("include", "/policy-repository/"); @@ -210,7 +210,7 @@ describe("Policy Repository", () => { fixture: "policy-docs.json", }).as("subjectFiles"); cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository/"); cy.get(".doc-type__toggle fieldset > div") .eq(0) @@ -271,7 +271,7 @@ describe("Policy Repository", () => { it("should display correct subject ID number in the URL if one is included in the URL on load and different one is selected via the Subject Selector", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository/?subjects=77"); cy.url().should("include", "/policy-repository/?subjects=77"); cy.get(`button[data-testid=remove-subject-77]`).should("exist"); @@ -293,7 +293,7 @@ describe("Policy Repository", () => { it("should filter the subject list when a search term is entered into the subject filter", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository/"); cy.injectAxe(); @@ -344,7 +344,7 @@ describe("Policy Repository", () => { it("should display and fetch the correct search query on load if it is included in URL", () => { cy.intercept("**/v3/content-search/?q=test**").as("qFiles"); cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository/?q=test"); cy.wait("@qFiles").then((interception) => { expect(interception.response.statusCode).to.eq(200); @@ -355,7 +355,7 @@ describe("Policy Repository", () => { it("should have a Documents to Show checkbox list", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.get(".doc-type__toggle-container h3").should( "have.text", @@ -385,7 +385,7 @@ describe("Policy Repository", () => { it("should show only the Table of Contents if both or neither checkboxes are checked", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.get(".subj-toc__container").should("exist"); cy.get(".doc-type__toggle fieldset > div") @@ -413,7 +413,7 @@ describe("Policy Repository", () => { it("should not make a request to the content-search endpoint if both checkboxes are checked on load", () => { cy.intercept("**/v3/content-search/**").as("contentSearch"); cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.wait(2000); cy.get("@contentSearch.all").then((interception) => { @@ -423,7 +423,7 @@ describe("Policy Repository", () => { it("goes to another SPA page from the policy repository page", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.clickHeaderLink({ page: "Resources", screen: "wide" }); cy.url().should("include", "/resources"); @@ -431,7 +431,7 @@ describe("Policy Repository", () => { it("returns you to the custom eua login page when you log out", () => { cy.viewport("macbook-15"); - cy.eregsLogin({ username, password }); + cy.eregsLogin({ username, password, '/policy-repository/' }); cy.visit("/policy-repository"); cy.get("#logout").click(); cy.url().should("include", "/login"); diff --git a/solution/ui/e2e/cypress/support/common-commands/login.js b/solution/ui/e2e/cypress/support/common-commands/login.js index 6892eeb404..99a145789d 100644 --- a/solution/ui/e2e/cypress/support/common-commands/login.js +++ b/solution/ui/e2e/cypress/support/common-commands/login.js @@ -2,13 +2,13 @@ export const eregsLogin = ({ username, password, - landingPage = "/policy-repository/", + landingPage = "/", }) => { cy.visit('/admin'); cy.wait(1000); cy.get("#id_username").type(username); cy.get("#id_password").type(password); cy.get("#login-form").submit(); - cy.visit('/policy-repository/'); + cy.visit(landingPage); }; diff --git a/solution/ui/regulations/css/scss/partials/_about.scss b/solution/ui/regulations/css/scss/partials/_about.scss index ffc43e3788..b594b2f66a 100644 --- a/solution/ui/regulations/css/scss/partials/_about.scss +++ b/solution/ui/regulations/css/scss/partials/_about.scss @@ -14,12 +14,6 @@ main.about { clear: both; } - button.action-btn.default-btn { - margin-top:16px; - color: #fff; - font-weight: bold; - } - .ds-l-container { padding: 0; diff --git a/solution/ui/regulations/css/scss/partials/_login.scss b/solution/ui/regulations/css/scss/partials/_login.scss index 474e9e299a..f81907ada8 100644 --- a/solution/ui/regulations/css/scss/partials/_login.scss +++ b/solution/ui/regulations/css/scss/partials/_login.scss @@ -10,7 +10,7 @@ main.login { max-width: $text-max-width; max-height: 100%; button.action-btn.default-btn { - margin-top:16px; + margin-top: 16px; color: #fff; font-weight: bold; } @@ -28,5 +28,4 @@ main.login { ul { padding-left: 40px; } - }