Skip to content

Commit

Permalink
Add tests for home page
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjarling committed Jul 8, 2024
1 parent 04ed043 commit 846640b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
20 changes: 20 additions & 0 deletions tests/home.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});
14 changes: 9 additions & 5 deletions tests/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down

0 comments on commit 846640b

Please sign in to comment.