Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EREGCSC-1015 Resolve dependabot alerts #287

Merged
merged 19 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
e2e:
image: cypress/included:7.0.1
image: cypress/included:9.1.1
container_name: cypress
network_mode: host
depends_on:
Expand Down
28 changes: 14 additions & 14 deletions e2e/cypress/integration/homepage.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const mainContentId = "#main-content";

describe("Homepage", { scrollBehavior: "center" }, () => {
beforeEach(() => {
cy.intercept("/**", (req) => {
Expand All @@ -13,7 +15,7 @@ describe("Homepage", { scrollBehavior: "center" }, () => {
cy.checkAccessibility();
});

it("has a hidden Skip to main content button", () => {
it("has a hidden Skip to main content link", () => {
cy.viewport("macbook-15");
cy.visit("/");
cy.get(".ds-c-skip-nav").then(($el) => {
Expand All @@ -22,28 +24,26 @@ describe("Homepage", { scrollBehavior: "center" }, () => {
});
});

it("focuses the Skip to main content button after tab is pressed", () => {
it("should have a div id on the page that matches the href of the skip to main content link", () => {
cy.viewport("macbook-15");
cy.visit("/");
cy.get("body").tab();
cy.wait(500); // animation
cy.focused().should("have.attr", "class", "ds-c-skip-nav");
cy.focused().then(($el) => {
const rect = $el[0].getBoundingClientRect();
expect(rect.top).to.equal(0);
});
cy.get(".ds-c-skip-nav").should(
"have.attr",
"href",
mainContentId
);
cy.get(mainContentId).should("exist");
});

it("jumps to main content when clicking Skip to main content button", () => {
it("focuses and displays the Skip to main content link after tab is pressed one time", () => {
cy.viewport("macbook-15");
cy.visit("/");
cy.get("body").tab();
cy.wait(500); // animation
cy.focused().click(); // click instead of typing space/enter b/c of cypress limitations
cy.wait(500); // scrolling
cy.get("#main-content").then(($el) => {
cy.focused().should("have.attr", "class", "ds-c-skip-nav");
cy.focused().then(($el) => {
const rect = $el[0].getBoundingClientRect();
expect(rect.top).to.be.oneOf([60, 70, 80]); // header heights based on breakpoints
expect(rect.top).to.equal(0);
});
});

Expand Down
Loading