Skip to content

Commit

Permalink
14794 - Added Managing Your Connection e2e. (#15259)
Browse files Browse the repository at this point in the history
* 14794 - Added Managing Your Connection e2e.
Updates to other e2e spec files.

* 14794 - fixed bug and irrelevant eslint disable comment
  • Loading branch information
penny-lischer authored Jul 20, 2024
1 parent f12c302 commit 3a590ad
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 181 deletions.
2 changes: 1 addition & 1 deletion frontend-react/e2e/pages/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class AboutPage extends BasePage {
super(
{
url: "/about",
title: "About",
title: "About ReportStream",
heading: testArgs.page.getByRole("heading", {
name: "About",
}),
Expand Down
16 changes: 16 additions & 0 deletions frontend-react/e2e/pages/managing-your-connection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { expect, Page } from "@playwright/test";
import { BasePage, BasePageTestArgs } from "./BasePage";

export async function onLoad(page: Page) {
await expect(page).toHaveURL(/managing-your-connection/);
await expect(page).toHaveTitle(/Managing your connection/);
}

export class ManagingYourConnectionPage extends BasePage {
constructor(testArgs: BasePageTestArgs) {
super(
{
url: "/managing-your-connection",
title: "Managing your connection with ReportStream",
heading: testArgs.page.getByRole("heading", {
name: "Managing Your Connection",
}),
},
testArgs,
);
}
}
1 change: 1 addition & 0 deletions frontend-react/e2e/pages/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class SupportPage extends BasePage {
title: "ReportStream support",
heading: testArgs.page.getByRole("heading", {
name: "Support",
exact: true,
}),
},
testArgs,
Expand Down
281 changes: 136 additions & 145 deletions frontend-react/e2e/spec/all/about-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,175 +37,166 @@ const test = baseTest.extend<AboutPageFixtures>({
},
});

test.describe(
"About page",
{
tag: "@smoke",
},
() => {
test("nav contains the 'About' dropdown with 'About Reportstream' option", async ({
aboutPage,
}) => {
const navItems = aboutPage.page.locator(".usa-nav li");
await expect(navItems).toContainText(["About"]);

test.describe("About page", () => {
test("nav contains the 'About' dropdown with 'About Reportstream' option", async ({
aboutPage,
}) => {
const navItems = aboutPage.page.locator(".usa-nav li");
await expect(navItems).toContainText(["About"]);

await aboutPage.page
.getByTestId("header")
.getByTestId("navDropDownButton")
.getByText("About")
.click();

await aboutPage.page
.getByTestId("header")
.getByRole("link", { name: "About ReportStream" })
.click();
await expect(aboutPage.page).toHaveURL(URL_ABOUT);
});

test("has correct title", async ({ aboutPage }) => {
await expect(aboutPage.page).toHaveTitle(aboutPage.title);
await expect(aboutPage.heading).toBeVisible();
});

test.describe("In this section", () => {
test("has 'Our network' link", async ({ aboutPage }) => {
await aboutPage.page
.getByTestId("header")
.getByTestId("navDropDownButton")
.getByText("About")
.getByRole("link", { name: /Our network/ })
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/our-network/);
});

test("has 'Product roadmap' link", async ({ aboutPage }) => {
await aboutPage.page
.getByTestId("header")
.getByRole("link", { name: "About ReportStream" })
.getByRole("link", { name: /Product roadmap/ })
.first()
.click();
await expect(aboutPage.page).toHaveURL(URL_ABOUT);
await expect(aboutPage.page).toHaveURL(/.*about\/roadmap/);
});

test("has correct title", async ({ aboutPage }) => {
await expect(aboutPage.page).toHaveTitle(/About/);
test("has 'News' link", async ({ aboutPage }) => {
await aboutPage.page.getByRole("link", { name: /News/ }).click();
await expect(aboutPage.page).toHaveURL(/.*about\/news/);
});

test.describe("In this section", () => {
test("has 'Our network' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /Our network/ })
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/our-network/);
});
test("has 'Case studies' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /Case studies/ })
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/case-studies/);
});

test("has 'Product roadmap' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /Product roadmap/ })
.first()
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/roadmap/);
});
test("has 'Security' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /Security/ })
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/security/);
});

test("has 'News' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /News/ })
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/news/);
});
test("has 'Release notes' link", async ({ aboutPage }) => {
await aboutPage.page
.locator("div")
.filter({ hasText: /^Release notes$/ })
.getByRole("link")
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/release-notes/);
});
});

test.describe("Values section", () => {
test("Accordion sections expand", async ({ aboutPage }) => {
const accordionCol = [
"We meet our partners where they are.",
"We are free to use.",
"We put better faster data into the hands of public health entities.",
"We reduce disparities in healthcare monitoring and surveillance.",
];

for (let i = 0; i < accordionCol.length; i++) {
const accordionItem = `accordionItem_${i + 1}--content`;
await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeHidden();

test("has 'Case studies' link", async ({ aboutPage }) => {
await aboutPage.page
.getByRole("link", { name: /Case studies/ })
.getByRole("button", {
name: accordionCol[i],
})
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/case-studies/);
});

test("has 'Security' link", async ({ aboutPage }) => {
await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeVisible();

await aboutPage.page
.getByRole("link", { name: /Security/ })
.getByRole("button", {
name: accordionCol[i],
})
.click();
await expect(aboutPage.page).toHaveURL(/.*about\/security/);
});

test("has 'Release notes' link", async ({ aboutPage }) => {
await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeHidden();
}
});
});

test.describe("Recommended Resources", () => {
test("Card navigation", async ({ aboutPage }) => {
const cardLinks = [
{
name: "ReportStream overview PDF",
url: "",
},
{
name: "Product roadmap",
url: "/about/roadmap",
},
{
name: "ReportStream API",
url: "/developer-resources/api",
},
];

for (const cardLink of cardLinks) {
await aboutPage.page
.locator("div")
.filter({ hasText: /^Release notes$/ })
.getByRole("link")
.getByTestId("CardGroup")
.getByRole("link", { name: cardLink.name })
.click();
await expect(aboutPage.page).toHaveURL(
/.*about\/release-notes/,
);
});
});

test.describe("Values section", () => {
test("Accordion sections expand", async ({ aboutPage }) => {
const accordionCol = [
"We meet our partners where they are.",
"We are free to use.",
"We put better faster data into the hands of public health entities.",
"We reduce disparities in healthcare monitoring and surveillance.",
];

for (let i = 0; i < accordionCol.length; i++) {
const accordionItem = `accordionItem_${i + 1}--content`;
await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeHidden();

await aboutPage.page
.getByRole("button", {
name: accordionCol[i],
})
.click();

await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeVisible();

await aboutPage.page
.getByRole("button", {
name: accordionCol[i],
})
.click();

await expect(
aboutPage.page.getByTestId(accordionItem),
).toBeHidden();
if (cardLink.url.length) {
await expect(aboutPage.page).toHaveURL(cardLink.url);
}
});

await aboutPage.page.goto(URL_ABOUT, {
waitUntil: "domcontentloaded",
});
}
});
});

test.describe("Recommended Resources", () => {
test("Card navigation", async ({ aboutPage }) => {
const cardLinks = [
{
name: "ReportStream overview PDF",
url: "",
},
{
name: "Product roadmap",
url: "/about/roadmap",
},
{
name: "ReportStream API",
url: "/developer-resources/api",
},
];

for (const cardLink of cardLinks) {
await aboutPage.page
.getByTestId("CardGroup")
.getByRole("link", { name: cardLink.name })
.click();

if (cardLink.url.length) {
await expect(aboutPage.page).toHaveURL(cardLink.url);
}

await aboutPage.page.goto(URL_ABOUT, {
waitUntil: "domcontentloaded",
});
}
});
test.describe("Footer", () => {
test("has footer", async ({ aboutPage }) => {
await expect(aboutPage.footer).toBeAttached();
});

test.describe("Footer", () => {
test("has footer", async ({ aboutPage }) => {
await expect(aboutPage.footer).toBeAttached();
});

test("explicit scroll to footer and then scroll to top", async ({
aboutPage,
}) => {
await expect(aboutPage.footer).not.toBeInViewport();
await scrollToFooter(aboutPage.page);
await expect(aboutPage.footer).toBeInViewport();
await expect(
aboutPage.page.getByTestId("govBanner"),
).not.toBeInViewport();
await scrollToTop(aboutPage.page);
await expect(
aboutPage.page.getByTestId("govBanner"),
).toBeInViewport();
});
test("explicit scroll to footer and then scroll to top", async ({
aboutPage,
}) => {
await expect(aboutPage.footer).not.toBeInViewport();
await scrollToFooter(aboutPage.page);
await expect(aboutPage.footer).toBeInViewport();
await expect(
aboutPage.page.getByTestId("govBanner"),
).not.toBeInViewport();
await scrollToTop(aboutPage.page);
await expect(
aboutPage.page.getByTestId("govBanner"),
).toBeInViewport();
});
},
);
});
});
Loading

0 comments on commit 3a590ad

Please sign in to comment.