Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./playwright",
timeout: 30000, // default timeout for each test
expect: { timeout: 10000 }, // default timeout for each expect assertion
expect: { timeout: 20000 }, // default timeout for each expect assertion
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand Down
26 changes: 23 additions & 3 deletions playwright/tests/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@ import { test, expect } from "@playwright/test";
import { DCHomepage } from "../pages/homepage.page";

test.beforeEach(async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
// Block analytics, tracking, and third-party domains
await page.route(/.*googletagmanager\.com.*/, (route) => route.abort());
await page.route(/.*demdex\.net.*/, (route) => route.abort());
await page.route(/.*adobedtm\.com.*/, (route) => route.abort());
await page.route(/.*everesttech\.net.*/, (route) => route.abort());
await page.route(/.*ipify\.org.*/, (route) => route.abort());
await page.route(/.*google\.com.*/, (route) => route.abort());
await page.route(/.*omappapi\.com.*/, (route) => route.abort());
await page.route(/.*google-analytics\.com.*/, (route) => route.abort());
Comment on lines +6 to +13

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! if we find this helpful on the homepage, we could make a change to abort these calls for all tests on all pages using a global setup file. definitely doesn't need to happen on this PR.


// If necessary, block the main-image overlay from iiif
// When running the whole suite, feedback on the homepage will often
// timeout when default img overlays are slow
await page.route("**/default.jpg", (route) => route.abort());

// Navigate to the page after setting up the routing rules.
await page.goto("/", { waitUntil: "load" });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default behavior for Playwright's .goto() method is waitUntil: "load", so this option can be removed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the explicit "load"

});

test("verify navigation menu is displayed (items, collections, divisions, about)", async ({
Expand Down Expand Up @@ -66,14 +82,18 @@ test("verify explore further section is visible", async ({ page }) => {
});

test("verify footer links are visible", async ({ page }) => {
page.setDefaultTimeout(30000); // 30 seconds
const dchomepage = new DCHomepage(page);
// the full footer content should be tested in the footer repo, not here in DC

await expect(dchomepage.footerAccessibilityLink).toBeVisible();
});

test("verify feedback button is visible", async ({ page }) => {
// this test is flaky; increasing timeout
test.setTimeout(120000);
// With route-filtering on, extending timeouts might not be necessary
// for feedback button tests.
test.setTimeout(60000);

const dchomepage = new DCHomepage(page);
await expect(dchomepage.feedbackButton).toBeVisible();
await dchomepage.feedbackButton.click();
Expand Down