Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
peggles2 committed Jan 24, 2024
1 parent 4a2998b commit 0795bae
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Resources you can access include policy documents internal to CMCS.
{% else %}
CMCS staff participating in the Policy Repository pilot can
<a id="loginSidebar" href="{% url 'login' %}?next={{ request.path }}"
<a id="loginSidebar" href="{% url 'custom_login' %}?next={{ request.path }}"
>sign in</a
>
to see internal resources.
Expand Down
43 changes: 43 additions & 0 deletions solution/ui/e2e/cypress/e2e/custom-login-page.cy.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
26 changes: 13 additions & 13 deletions solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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");
Expand Down Expand Up @@ -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 });
Expand All @@ -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/");

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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",
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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) => {
Expand All @@ -423,15 +423,15 @@ 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");
});

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");
Expand Down
4 changes: 2 additions & 2 deletions solution/ui/e2e/cypress/support/common-commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

6 changes: 0 additions & 6 deletions solution/ui/regulations/css/scss/partials/_about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions solution/ui/regulations/css/scss/partials/_login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -28,5 +28,4 @@ main.login {
ul {
padding-left: 40px;
}

}

0 comments on commit 0795bae

Please sign in to comment.