Skip to content

Commit

Permalink
Timeout :(
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewjordan committed Sep 16, 2024
1 parent 6c24457 commit d4506dc
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions tests/work.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test as base, expect } from "@playwright/test";

import { DC_URL } from "@/lib/constants/endpoints";
import { OpenGraphPage } from "@/tests/fixtures/open-graph";
import { WorkPage } from "@/tests/fixtures/work-page";
import { canaryWork } from "@/tests/fixtures/works/canary-work";
Expand All @@ -18,6 +19,7 @@ const test = base.extend<WorkPageFixtures>({
await openGraphPage.goto();
await use(openGraphPage);
},

// A fixture to help with the Search Page shared functionality
workPage: async ({ page }, use) => {
const workPage = new WorkPage(page);
Expand All @@ -26,8 +28,8 @@ const test = base.extend<WorkPageFixtures>({
});

test.describe("Work page component", async () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/items/${CANARY_WORK_ID}`);
test.beforeEach(async ({ page, workPage }) => {
await workPage.goto(CANARY_WORK_ID);
});

test("renders Open Graph data and meta title and description", async ({
Expand All @@ -46,10 +48,9 @@ test.describe("Work page component", async () => {
});

test("renders the Work top level metadata", async ({ page }) => {
console.log("renders the Work top level metadata");
const metadataEl = page.getByTestId("metadata");

await page.getByRole("button", { name: "Dismiss" }).click();

await expect(page.getByTestId("title")).toContainText(
canaryWork.title || "",
);
Expand Down Expand Up @@ -184,6 +185,8 @@ test.describe("Work page component", async () => {
test("renders the Explore Further section Clover sliders", async ({
page,
}) => {
console.log("renders the Explore Further section Clover sliders (go)");

await page.getByRole("button", { name: "Dismiss" }).click();
const relatedItems = page.getByTestId("related-items");

Expand All @@ -199,14 +202,23 @@ test.describe("Work page component", async () => {
.filter({ hasText: "TEST Canary Records" }),
).toHaveAttribute(
"href",
"https://dc.library.northwestern.edu/search?q=collection.id%3A%22820fc328-a333-430b-a974-ac6218a1ffcd%22",
`${DC_URL}/search?collection=TEST+Canary+Records`,
);

// View all button
await expect(page.getByLabel("TEST Canary Records").nth(1)).toHaveAttribute(
// View all buttons
const viewAllButtons = page
.getByTestId("related-items")
.getByRole("link", { name: "View All" });
const similarPattern = new RegExp(`${DC_URL}/search\\?similar=.*`);
const subjectPattern = new RegExp(`${DC_URL}/search\\?subject=.*`);

await expect(viewAllButtons.first()).toHaveAttribute(
"href",
"https://dc.library.northwestern.edu/search?q=collection.id%3A%22820fc328-a333-430b-a974-ac6218a1ffcd%22",
`${DC_URL}/search?collection=TEST+Canary+Records`,
);
await expect(viewAllButtons.nth(1)).toHaveAttribute("href", similarPattern);
await expect(viewAllButtons.nth(2)).toHaveAttribute("href", subjectPattern);
await expect(viewAllButtons.nth(3)).toHaveAttribute("href", subjectPattern);

// Test the Collection carousel
const collectionsSliderItems = relatedItems
Expand Down Expand Up @@ -239,7 +251,7 @@ test.describe("Work page component", async () => {
.filter({ hasText: "More Like This" }),
).toHaveAttribute(
"href",
"https://dc.library.northwestern.edu/search?similar=cb8a19a7-3dec-47f3-80c0-12872ae61f8f",
`${DC_URL}/search?similar=cb8a19a7-3dec-47f3-80c0-12872ae61f8f`,
);

// TODO: Something is wrong with the More Like This slider
Expand Down Expand Up @@ -275,6 +287,8 @@ test.describe("Work page component", async () => {

await expect(subject1SliderItems).toBeVisible();
await expect(subject2SliderItems).toBeVisible();

console.log("renders the Explore Further section Clover sliders (end)");
});

test("renders the Find this item and Cite this item modal windows", async ({
Expand Down

0 comments on commit d4506dc

Please sign in to comment.