forked from microwavenby/shoegaze-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.spec.ts
32 lines (28 loc) · 1.06 KB
/
index.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// index.spec.ts - tests for the index page
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("index has no automatically detectable accessibility errors", async ({
page,
}) => {
await page.goto("/");
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
expect(accessibilityScanResults.violations).toEqual([]);
});
test("has title", async ({ page }) => {
await page.goto("/");
// Expect a title "to contain" a correct app title.
await expect(page).toHaveTitle(/Shoegaze Stack/);
await expect(page).toHaveScreenshot();
});
test("Open the README link", async ({ page }) => {
await page.goto("/");
const readmeLink = page.getByRole("link", { name: "Open the README" });
await expect(readmeLink).toBeVisible();
await expect(readmeLink).toHaveAttribute("href", "../README.md");
});
// This page shouldn't set cookies
test("the index page sets no cookies", async ({ page }) => {
await page.goto("/");
const cookies = await page.context().cookies();
expect(cookies).toHaveLength(0);
});