Skip to content

Commit

Permalink
Merge branch 'dev' into USAGOV-2095-menu-block-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
akf authored Nov 21, 2024
2 parents 941f85c + 4234bb5 commit b276c7c
Show file tree
Hide file tree
Showing 16 changed files with 4,124 additions and 291 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/prod-a11y-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Prod A11Y Regression Tests
on: workflow_dispatch
jobs:
run-regression-tests:
name: run-regression-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set env
run: echo "CYPRESS_BASE_URL=https://usa.gov/" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: automated_tests/e2e-cypress
spec: cypress/e2e/regression_testing/*.cy.js
16 changes: 16 additions & 0 deletions .github/workflows/stage-a11y-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Stage A11Y Regression Tests
on: workflow_dispatch
jobs:
run-regression-tests:
name: run-regression-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set env
run: echo "CYPRESS_BASE_URL=https://beta-stage.usa.gov/" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: automated_tests/e2e-cypress
spec: cypress/e2e/regression_testing/*.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ const languageTests = [
"/travel-documents-children",
];

let env;
if (window.location.hostname == "cms-usagov.docker.local") {
env = "local";
} else if (window.location.hostname == "beta-stage.usa") {
env = "stage";
} else {
env = "prod";
}

paths.forEach((path, idx) => {
let lang;
let testName;
if (path === "/disaster-assistance") {
lang = "English";
testName = "BTE";
} else {
lang = "Español";
testName = "BTS";
}

describe(`${lang} Content Page`, () => {
Expand All @@ -24,7 +36,7 @@ paths.forEach((path, idx) => {
cy.injectAxe();
});

it("BTE/S 28: Left menu appears on page and indicates the page you are on", () => {
it(`${testName} 28: Left menu appears on page and indicates the page you are on`, () => {
cy.get(".usa-sidenav").should("be.visible");

// Menu indicates what page you are on
Expand All @@ -41,7 +53,7 @@ paths.forEach((path, idx) => {
});
});
});
it("BTE/S 29: Breadcrumb appears at top of page and indicates correct section", () => {
it(`${testName} 29: Breadcrumb appears at top of page and indicates correct section`, () => {
cy.get(".usa-breadcrumb__list")
.find("li")
.first()
Expand All @@ -63,7 +75,7 @@ paths.forEach((path, idx) => {
});
});
});
it("BTE/S 30: Page titles and headings are formatted correctly", () => {
it(`${testName} 30: Page titles and headings are formatted correctly`, () => {
// CSS style checks

// h1
Expand Down Expand Up @@ -115,15 +127,15 @@ paths.forEach((path, idx) => {
});
}
});
it(`BTE/S 31: ${lang} toggle appears on page and takes you to ${lang} page`, () => {
it(`${testName} 31: ${lang} toggle appears on page and takes you to ${lang} page`, () => {
cy.get(".language-link").click();
cy.url().should("include", languageTests[idx]);
});
it("BTE/S 32: Last updated date appears at bottom of content with correct padding above it", () => {
it(`${testName} 32: Last updated date appears at bottom of content with correct padding above it`, () => {
// make sure date appears
cy.get(".additional_body_info").find("#last-updated").should("exist");
});
it("BTE/S 33: Share this page function works correctly for facebook, twitter, and email", () => {
it(`${testName} 33: Share this page function works correctly for facebook, twitter, and email`, () => {
// test links for each social
const facebook = [
"disaster-assistance",
Expand All @@ -137,32 +149,44 @@ paths.forEach((path, idx) => {
"disaster-assistance",
"eses/requisitos-viaje-ninos-menores-de-edad",
];
cy.get(".additional_body_info")
.find("#sm-share")
.should("exist")
.get("div.share-icons>a")
.eq(0)
.should(
"have.attr",
"href",
`https://www.facebook.com/sharer/sharer.php?u=http://cms-usagov.docker.local/${facebook[idx]}&v=3`,
)
.get("div.share-icons>a")
.eq(1)
.should(
"have.attr",
"href",
`https://twitter.com/intent/tweet?source=webclient&text=http://cms-usagov.docker.local/${twitter[idx]}`,
)
.get("div.share-icons>a")
.eq(2)
.should(
"have.attr",
"href",
`mailto:?subject=http://cms-usagov.docker.local/${mail[idx]}`,
);

var origin;
cy.url().then((cyURL) => {
if (cyURL.includes("cms-usagov.docker.local")) {
origin = "http://cms-usagov.docker.local";
} else if (cyURL.includes("beta-stage.usa")) {
origin = "https://beta-stage.usa.gov";
} else {
origin = "https://www.usa.gov";
}

cy.get(".additional_body_info")
.find("#sm-share")
.should("exist")
.get("div.share-icons>a")
.eq(0)
.should(
"have.attr",
"href",
`https://www.facebook.com/sharer/sharer.php?u=${origin}/${facebook[idx]}&v=3`,
)
.get("div.share-icons>a")
.eq(1)
.should(
"have.attr",
"href",
`https://twitter.com/intent/tweet?source=webclient&text=${origin}/${twitter[idx]}`,
)
.get("div.share-icons>a")
.eq(2)
.should(
"have.attr",
"href",
`mailto:?subject=${origin}/${mail[idx]}`,
);
});
});
it("BTE/S 34: Do you have a question block appears at bottom of content page with icons and links to phone and chat", () => {
it(`${testName} 34: Do you have a question block appears at bottom of content page with icons and links to phone and chat`, () => {
// test question box
const phones = ["/phone", "/es/centro-de-llamadas"];
cy.get(".additional_body_info")
Expand All @@ -171,7 +195,7 @@ paths.forEach((path, idx) => {
.find("a")
.should("have.attr", "href", phones[idx]);
});
it("BTE/S 36: Back to top button", () => {
it(`${testName} 36: Back to top button`, () => {
//test back to top button
cy.scrollTo("bottom")
.get("#back-to-top")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ const paths = ["/", "/es"];

paths.forEach((path, idx) => {
let lang;
let testName;
if (path === "/") {
lang = "English";
testName = "BTE";
} else {
lang = "Español";
testName = "BTS";
}
describe(`${lang} Footer`, () => {
beforeEach(() => {
Expand All @@ -15,7 +18,7 @@ paths.forEach((path, idx) => {
});


it(`BTE/S 12: Footer links appear and work appropriately`, () => {
it(`${testName} 12: Footer links appear and work appropriately`, () => {
cy.get(".usa-footer__nav")
.find("a")
.not('[href="/website-analytics/"]')
Expand All @@ -29,7 +32,7 @@ paths.forEach((path, idx) => {
});


it("BTE/S 13: Footer: Email subscription form appears in footer and works appropriately", () => {
it(`${testName} 13: Footer: Email subscription form appears in footer and works appropriately`, () => {
const validEmail = "[email protected]";
const invalidEmails = ["test@#$1123", "test2@", "@test3.com"];
const emails = [
Expand All @@ -52,7 +55,7 @@ paths.forEach((path, idx) => {

// Origin URL should now be connect.usa.gov
const sentArgs = { email: validEmail };
cy.origin(emails[idx], { args: sentArgs }, ({ email }) => {
cy.visit(emails[idx], { args: sentArgs }, ({ email }) => {
cy.get("input").filter('[name="email"]').should("have.value", email);
});

Expand All @@ -63,13 +66,13 @@ paths.forEach((path, idx) => {
cy.get(".usa-sign-up").find('button[type="submit"]').click();

// Origin URL should now be connect.usa.gov
cy.origin(emails[idx], { args: sentArgs }, ({ email }) => {
cy.visit(emails[idx], { args: sentArgs }, ({ email }) => {
cy.get("input").filter('[name="email"]').should("have.value", email);
});
});


it("BTE/S 14: Footer: Social media icons appear in footer and link to correct places", () => {
it(`${testName} 14: Footer: Social media icons appear in footer and link to correct places`, () => {
cy.get(".usa-footer__contact-links")
.within(() => {
// Verify correct text in social media heading
Expand Down Expand Up @@ -102,7 +105,7 @@ paths.forEach((path, idx) => {
});


it("BTE/S 15: Footer: Contact Center information appears in footer and phone number links are correct", () => {
it(`${testName} 15: Footer: Contact Center information appears in footer and phone number links are correct`, () => {
cy.get("#footer-phone").within(() => {
cy.get("h4")
.should("have.text", fixtures.contact_heading[idx])
Expand All @@ -118,7 +121,7 @@ paths.forEach((path, idx) => {
});


it("BTE/S 16: Footer: Subfooter indicating USAGov is official site appears at very bottom", () => {
it(`${testName} 16: Footer: Subfooter indicating USAGov is official site appears at very bottom`, () => {
cy.get(".usa-identifier__section--usagov")
.should("have.attr", "aria-label", fixtures.official_guide[idx])
.find(".usa-identifier__identity")
Expand Down
Loading

0 comments on commit b276c7c

Please sign in to comment.