From cad4a413046e99cb810fa398c04dc34e00b569ce Mon Sep 17 00:00:00 2001 From: Mat Jordan Date: Tue, 17 Sep 2024 09:40:12 -0400 Subject: [PATCH] Retry. --- tests/work.spec.ts | 272 ++++++++++++++++++++++----------------------- 1 file changed, 135 insertions(+), 137 deletions(-) diff --git a/tests/work.spec.ts b/tests/work.spec.ts index 769f9c1e..593ad2cc 100644 --- a/tests/work.spec.ts +++ b/tests/work.spec.ts @@ -33,19 +33,21 @@ test.describe("Work page component", async () => { await workPage.goto(); }); + return; + test("renders Open Graph data and meta title and description", async ({ openGraphPage, }) => { - // await openGraphPage.hasMetaTitle(canaryWork.title); - // await openGraphPage.hasMetaDescription(canaryWork.description.join(" ")); - // await openGraphPage.hasOGDescription( - // `${canaryWork.description.join(" ")} - ${canaryWork.terms_of_use}`, - // ); - // await openGraphPage.hasOGSiteName(); - // await openGraphPage.hasOGUrl(`items/${canaryWork.id}`); - // await openGraphPage.hasOGImage( - // `https://dc-test-iiif.rdc-staging.library.northwestern.edu/iiif/2/a59dc417-d313-4286-88d4-1c80916b82c6/full/1200,630/0/default.jpg`, - // ); + await openGraphPage.hasMetaTitle(canaryWork.title); + await openGraphPage.hasMetaDescription(canaryWork.description.join(" ")); + await openGraphPage.hasOGDescription( + `${canaryWork.description.join(" ")} - ${canaryWork.terms_of_use}`, + ); + await openGraphPage.hasOGSiteName(); + await openGraphPage.hasOGUrl(`items/${canaryWork.id}`); + await openGraphPage.hasOGImage( + `https://dc-test-iiif.rdc-staging.library.northwestern.edu/iiif/2/a59dc417-d313-4286-88d4-1c80916b82c6/full/1200,630/0/default.jpg`, + ); }); test("renders the Work", async ({ page, workPage }) => { @@ -57,139 +59,135 @@ test.describe("Work page component", async () => { canaryWork.title || "", ); - return; - - // await expect(page.getByTestId("summary")).toContainText( - // canaryWork.description.join(", ") || "", - // ); - // const metadataEl = page.getByTestId("metadata"); + await expect(page.getByTestId("summary")).toContainText( + canaryWork.description.join(", ") || "", + ); + const metadataEl = page.getByTestId("metadata"); - // await expect(metadataEl.getByText("Alternate Title")).toBeVisible(); - // await expect( - // metadataEl.getByText("This is an alternative title"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Abstract")).toBeVisible(); - // await expect(metadataEl.getByText("Updated description!!!")).toBeVisible(); - // await expect(metadataEl.getByText("Caption")).toBeVisible(); - // await expect(metadataEl.getByText("Beebo")).toBeVisible(); - // await expect(metadataEl.getByText("Contributor")).toBeVisible(); - // await expect( - // metadataEl.getByText("Metallica (Musical group) (Cartographer)"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Creator")).toBeVisible(); - // await expect(metadataEl.getByText("Dessa (Vocalist)")).toBeVisible(); - // await expect(metadataEl.getByText("Cultural Context")).toBeVisible(); - // await expect(metadataEl.getByText("Test Context")).toBeVisible(); - // await expect(metadataEl.getByText("Date", { exact: true })).toBeVisible(); - // await expect( - // metadataEl.getByText("August 1906 to December 1910"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("1958")).toBeVisible(); - // await expect(metadataEl.getByText("Department")).toBeVisible(); - // await expect( - // metadataEl.getByText("University (MAIN) Library"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Dimensions")).toBeVisible(); - // await expect(metadataEl.getByText("16 x 24 inches")).toBeVisible(); - // await expect(metadataEl.getByText("Genre")).toBeVisible(); + await expect(metadataEl.getByText("Alternate Title")).toBeVisible(); + await expect( + metadataEl.getByText("This is an alternative title"), + ).toBeVisible(); + await expect(metadataEl.getByText("Abstract")).toBeVisible(); + await expect(metadataEl.getByText("Updated description!!!")).toBeVisible(); + await expect(metadataEl.getByText("Caption")).toBeVisible(); + await expect(metadataEl.getByText("Beebo")).toBeVisible(); + await expect(metadataEl.getByText("Contributor")).toBeVisible(); + await expect( + metadataEl.getByText("Metallica (Musical group) (Cartographer)"), + ).toBeVisible(); + await expect(metadataEl.getByText("Creator")).toBeVisible(); + await expect(metadataEl.getByText("Dessa (Vocalist)")).toBeVisible(); + await expect(metadataEl.getByText("Cultural Context")).toBeVisible(); + await expect(metadataEl.getByText("Test Context")).toBeVisible(); + await expect(metadataEl.getByText("Date", { exact: true })).toBeVisible(); + await expect( + metadataEl.getByText("August 1906 to December 1910"), + ).toBeVisible(); + await expect(metadataEl.getByText("1958")).toBeVisible(); + await expect(metadataEl.getByText("Department")).toBeVisible(); + await expect( + metadataEl.getByText("University (MAIN) Library"), + ).toBeVisible(); + await expect(metadataEl.getByText("Dimensions")).toBeVisible(); + await expect(metadataEl.getByText("16 x 24 inches")).toBeVisible(); + await expect(metadataEl.getByText("Genre")).toBeVisible(); - // // Click to show more - // await page.getByRole("button", { name: "Show More" }).click(); + // Click to show more + await page.getByRole("button", { name: "Show More" }).click(); - // await expect(metadataEl.getByText("stencil prints")).toBeVisible(); - // await expect( - // metadataEl.getByText("Language", { exact: true }), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Crimean Tatar")).toBeVisible(); - // await expect(metadataEl.getByText("Location")).toBeVisible(); - // await expect(metadataEl.getByText("Leland Township")).toBeVisible(); - // await expect( - // metadataEl.getByText("Materials", { exact: true }), - // ).toBeVisible(); - // await expect( - // metadataEl.getByText("Acrylic paint on cement block"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Notes", { exact: true })).toBeVisible(); - // await expect( - // metadataEl.getByText("Here are some notes (General Note)", { - // exact: true, - // }), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Awards type (Awards)")).toBeVisible(); - // await expect(metadataEl.getByText("Biographical note (")).toBeVisible(); - // await expect( - // metadataEl.getByText("creation production credits ("), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Provenance")).toBeVisible(); - // await expect( - // metadataEl.getByText("Artist; sold to Mr. Blank in"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Publisher")).toBeVisible(); - // await expect( - // metadataEl.getByText("Northwestern University Press"), - // ).toBeVisible(); - // await expect( - // metadataEl.getByText("Related Material", { exact: true }), - // ).toBeVisible(); - // await expect( - // metadataEl.getByText("See Also: related material"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Related URL")).toBeVisible(); - // await expect(metadataEl.getByText("Finding Aid")).toBeVisible(); - // await expect(metadataEl.getByText("Research Guide")).toBeVisible(); - // await expect(metadataEl.getByText("Rights Holder")).toBeVisible(); - // await expect(metadataEl.getByText("Artist", { exact: true })).toBeVisible(); - // await expect(metadataEl.getByText("Rights Statement")).toBeVisible(); - // await expect( - // metadataEl.getByText("In Copyright - Educational"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Scope and Contents")).toBeVisible(); - // await expect( - // metadataEl.getByText("I promise there is scope and"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Series")).toBeVisible(); - // await expect( - // metadataEl.getByText("Canaries and How to Care for"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Source")).toBeVisible(); - // await expect(metadataEl.getByText("Mars")).toBeVisible(); - // await expect(metadataEl.getByText("Style Period")).toBeVisible(); - // await expect( - // metadataEl.getByText("Qing (dynastic styles and"), - // ).toBeVisible(); - // await expect(metadataEl.getByText("Subject")).toBeVisible(); - // await expect(metadataEl.getByText("Cats on postage stamps")).toBeVisible(); - // await expect(metadataEl.getByText("Test Record Canary")).toBeVisible(); - // await expect(metadataEl.getByText("Table of Contents")).toBeVisible(); - // await expect(metadataEl.getByText("cats; 2. dogs")).toBeVisible(); - // await expect(metadataEl.getByText("Technique")).toBeVisible(); - // await expect( - // metadataEl.getByText("drypoint (printing process)"), - // ).toBeVisible(); - // await expect(page.getByText("Attribution")).toContainText("Attribution"); - // await expect(page.getByText("Courtesy of Northwestern")).toBeVisible(); + await expect(metadataEl.getByText("stencil prints")).toBeVisible(); + await expect( + metadataEl.getByText("Language", { exact: true }), + ).toBeVisible(); + await expect(metadataEl.getByText("Crimean Tatar")).toBeVisible(); + await expect(metadataEl.getByText("Location")).toBeVisible(); + await expect(metadataEl.getByText("Leland Township")).toBeVisible(); + await expect( + metadataEl.getByText("Materials", { exact: true }), + ).toBeVisible(); + await expect( + metadataEl.getByText("Acrylic paint on cement block"), + ).toBeVisible(); + await expect(metadataEl.getByText("Notes", { exact: true })).toBeVisible(); + await expect( + metadataEl.getByText("Here are some notes (General Note)", { + exact: true, + }), + ).toBeVisible(); + await expect(metadataEl.getByText("Awards type (Awards)")).toBeVisible(); + await expect(metadataEl.getByText("Biographical note (")).toBeVisible(); + await expect( + metadataEl.getByText("creation production credits ("), + ).toBeVisible(); + await expect(metadataEl.getByText("Provenance")).toBeVisible(); + await expect( + metadataEl.getByText("Artist; sold to Mr. Blank in"), + ).toBeVisible(); + await expect(metadataEl.getByText("Publisher")).toBeVisible(); + await expect( + metadataEl.getByText("Northwestern University Press"), + ).toBeVisible(); + await expect( + metadataEl.getByText("Related Material", { exact: true }), + ).toBeVisible(); + await expect( + metadataEl.getByText("See Also: related material"), + ).toBeVisible(); + await expect(metadataEl.getByText("Related URL")).toBeVisible(); + await expect(metadataEl.getByText("Finding Aid")).toBeVisible(); + await expect(metadataEl.getByText("Research Guide")).toBeVisible(); + await expect(metadataEl.getByText("Rights Holder")).toBeVisible(); + await expect(metadataEl.getByText("Artist", { exact: true })).toBeVisible(); + await expect(metadataEl.getByText("Rights Statement")).toBeVisible(); + await expect( + metadataEl.getByText("In Copyright - Educational"), + ).toBeVisible(); + await expect(metadataEl.getByText("Scope and Contents")).toBeVisible(); + await expect( + metadataEl.getByText("I promise there is scope and"), + ).toBeVisible(); + await expect(metadataEl.getByText("Series")).toBeVisible(); + await expect( + metadataEl.getByText("Canaries and How to Care for"), + ).toBeVisible(); + await expect(metadataEl.getByText("Source")).toBeVisible(); + await expect(metadataEl.getByText("Mars")).toBeVisible(); + await expect(metadataEl.getByText("Style Period")).toBeVisible(); + await expect( + metadataEl.getByText("Qing (dynastic styles and"), + ).toBeVisible(); + await expect(metadataEl.getByText("Subject")).toBeVisible(); + await expect(metadataEl.getByText("Cats on postage stamps")).toBeVisible(); + await expect(metadataEl.getByText("Test Record Canary")).toBeVisible(); + await expect(metadataEl.getByText("Table of Contents")).toBeVisible(); + await expect(metadataEl.getByText("cats; 2. dogs")).toBeVisible(); + await expect(metadataEl.getByText("Technique")).toBeVisible(); + await expect( + metadataEl.getByText("drypoint (printing process)"), + ).toBeVisible(); + await expect(page.getByText("Attribution")).toContainText("Attribution"); + await expect(page.getByText("Courtesy of Northwestern")).toBeVisible(); - // // Shows the collection - // const collectionsCard = page.getByTestId("card-wrapper").locator("a"); - // await expect( - // collectionsCard.getByAltText("TEST Canary Records"), - // ).toHaveAttribute( - // "src", - // `https://dc-test-api.rdc-staging.library.northwestern.edu/api/v2/collections/820fc328-a333-430b-a974-ac6218a1ffcd/thumbnail?aspect=square`, - // ); - // const figCaption = collectionsCard.locator("figcaption"); - // await expect(figCaption).toContainText("TEST Canary Records"); - // await expect(figCaption.getByTestId("work-count-total")).toContainText( - // "3 Works", - // ); - // const workCountTypes = figCaption.getByTestId("work-count-type"); - // await expect(workCountTypes.nth(0)).toContainText("1"); - // await expect(workCountTypes.nth(1)).toContainText("1"); - // await expect(workCountTypes.nth(2)).toContainText("1"); + // Shows the collection + const collectionsCard = page.getByTestId("card-wrapper").locator("a"); + await expect( + collectionsCard.getByAltText("TEST Canary Records"), + ).toHaveAttribute( + "src", + `https://dc-test-api.rdc-staging.library.northwestern.edu/api/v2/collections/820fc328-a333-430b-a974-ac6218a1ffcd/thumbnail?aspect=square`, + ); + const figCaption = collectionsCard.locator("figcaption"); + await expect(figCaption).toContainText("TEST Canary Records"); + await expect(figCaption.getByTestId("work-count-total")).toContainText( + "3 Works", + ); + const workCountTypes = figCaption.getByTestId("work-count-type"); + await expect(workCountTypes.nth(0)).toContainText("1"); + await expect(workCountTypes.nth(1)).toContainText("1"); + await expect(workCountTypes.nth(2)).toContainText("1"); }); - return; - test("renders the Explore Further section Clover sliders", async ({ page, }) => {