forked from EddieHubCommunity/BioDrop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepos.spec.js
41 lines (35 loc) · 1.31 KB
/
repos.spec.js
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
33
34
35
36
37
38
39
40
41
// @ts-check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("Click on repos in navbar navigates to repo page", async ({ page }) => {
await page.goto("/");
await page
.getByRole("navigation")
.getByRole("link", { name: "Repos" })
.click();
await expect(page).toHaveURL("/repos");
});
test("Repos has title", async ({ page }) => {
await page.goto("/repos");
await expect(page.locator("h1")).toHaveText("Community Repos");
});
test.describe("accessibility tests (light)", () => {
test.use({ colorScheme: "light" });
test("should pass axe wcag accessibility tests", async ({ page }) => {
await page.goto("/repos");
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
});
});
test.describe("accessibility tests (dark)", () => {
test.use({ colorScheme: "dark" });
test("should pass axe wcag accessibility tests (dark)", async ({ page }) => {
await page.goto("/repos");
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
});
});