diff --git a/tests/home.spec.ts b/tests/home.spec.ts new file mode 100644 index 0000000..e853267 --- /dev/null +++ b/tests/home.spec.ts @@ -0,0 +1,20 @@ +import { expect, test } from "@playwright/test"; + +test("homepage elements", async ({ page }) => { + await page.goto("/"); + await expect(page.getByRole("heading")).toContainText( + "The Next Generation Repository Solution", + ); + await expect(page.getByRole("main")).toContainText( + "Hyku is a digital repository that provides a robust and flexible platform for institutions to manage, preserve, and provide access to digital content.", + ); + + await page.getByRole("link", { name: "Get started" }).click(); + + await expect(page.locator("h1")).toContainText("Getting Started"); + + await page.goto("/"); + + await expect(page.getByRole("main")).toContainText("Documentation →"); + await expect(page.getByRole("img", { name: "App screenshot" })).toBeVisible(); +}); diff --git a/tests/layout.spec.ts b/tests/layout.spec.ts index 13e717d..346012b 100644 --- a/tests/layout.spec.ts +++ b/tests/layout.spec.ts @@ -72,14 +72,18 @@ test("has footer with links to social media", async ({ page }) => { "href", "http://twitter.com/HykuRepo", ); - await expect(page.getByRole("link", { name: "GitHub" })).toHaveAttribute( - "href", - "https://github.com/samvera/hyku", - ); - await expect(page.getByRole("link", { name: "YouTube" })).toHaveAttribute( + await expect( + footerLayout.getByRole("link", { name: "GitHub" }), + ).toHaveAttribute("href", "https://github.com/samvera/hyku"); + await expect( + footerLayout.getByRole("link", { name: "YouTube" }), + ).toHaveAttribute( "href", "https://www.youtube.com/channel/UC_m1Ovaaasa2ksyGaqz5i0Q", ); + await expect( + footerLayout.getByText("© 2024 Hyku. All rights"), + ).toBeVisible(); }); test("color theme switcher", async ({ page }) => {