-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
078c508
commit fbd129f
Showing
8 changed files
with
126 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,57 @@ | ||
import { test } from '@playwright/test'; | ||
import AxeBuilder from "@axe-core/playwright"; | ||
import { test } from "@playwright/test"; | ||
|
||
test.describe("index page", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
}); | ||
|
||
test('it should have at least one page', async ({ page }) => { | ||
await page.goto("/") | ||
test.expect(await page.getByRole("main").getByRole("link").count()).toBeGreaterThan(1) | ||
}); | ||
test("it should have at least one page", async ({ page }) => { | ||
test | ||
.expect(await page.getByRole("main").getByRole("link").count()) | ||
.toBeGreaterThan(1); | ||
}); | ||
|
||
test("it should link to the details page", async ({ page }) => { | ||
const locator = page.getByRole("main").getByRole("link").first(); | ||
const headingText = await locator | ||
.getByRole("heading", { level: 3 }) | ||
.textContent(); | ||
|
||
test.expect(headingText).not.toBe(null); | ||
|
||
await locator.click(); | ||
await page.getByRole("heading", { level: 1 }).first().waitFor(); | ||
await test | ||
.expect(page.getByRole("heading", { level: 1 }).first()) | ||
.toHaveText(headingText ?? ""); | ||
}); | ||
|
||
test.describe("a11y", () => { | ||
test.describe("light mode", () => { | ||
test.use({ colorScheme: "light" }); | ||
test("should not have any automatically detectable accessibility issues", async ({ | ||
page, | ||
}) => { | ||
const accessibilityScanResults = await new AxeBuilder({ | ||
page, | ||
}).analyze(); | ||
|
||
test('it should link to the details page', async ({ page }) => { | ||
await page.goto("/") | ||
const locator = page.getByRole("main").getByRole("link").first(); | ||
const headingText = await locator.getByRole("heading", {level: 3}).textContent(); | ||
test.expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
|
||
test.expect(headingText).not.toBe(null) | ||
test.describe("dark mode", () => { | ||
test.use({ colorScheme: "dark" }); | ||
test("should not have any automatically detectable accessibility issues", async ({ | ||
page, | ||
}) => { | ||
const accessibilityScanResults = await new AxeBuilder({ | ||
page, | ||
}).analyze(); | ||
|
||
await locator.click() | ||
await page.getByRole("heading", {level: 1}).first().waitFor() | ||
await test.expect(page.getByRole("heading", {level: 1}).first()).toHaveText(headingText ?? "") | ||
test.expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
import { test } from '@playwright/test'; | ||
import { expect } from "vitest"; | ||
import AxeBuilder from "@axe-core/playwright"; | ||
import { test } from "@playwright/test"; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/") | ||
const locator = page.getByRole("main").getByRole("link").first(); | ||
const headingText = await locator.getByRole("heading", {level: 3}).textContent(); | ||
test.describe("post page", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
const locator = page.getByRole("main").getByRole("link").first(); | ||
const headingText = await locator | ||
.getByRole("heading", { level: 3 }) | ||
.textContent(); | ||
|
||
test.expect(headingText).not.toBe(null) | ||
test.expect(headingText).not.toBe(null); | ||
|
||
await locator.click() | ||
await page.getByRole("heading", {level: 1}).first().waitFor() | ||
}) | ||
await locator.click(); | ||
await page.getByRole("heading", { level: 1 }).first().waitFor(); | ||
}); | ||
|
||
test('it should have a header', async ({ page }) => { | ||
await test.expect(page.getByRole("heading", {level: 1})).toBeVisible() | ||
test("it should have a header", async ({ page }) => { | ||
await test.expect(page.getByRole("heading", { level: 1 })).toBeVisible(); | ||
}); | ||
|
||
test.describe("a11y", () => { | ||
test.describe("light mode", () => { | ||
test.use({ colorScheme: "light" }); | ||
test("should not have any automatically detectable accessibility issues", async ({ | ||
page, | ||
}) => { | ||
const accessibilityScanResults = await new AxeBuilder({ | ||
page, | ||
}).analyze(); | ||
|
||
test.expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
test.describe("dark mode", () => { | ||
test.use({ colorScheme: "dark" }); | ||
test("should not have any automatically detectable accessibility issues", async ({ | ||
page, | ||
}) => { | ||
const accessibilityScanResults = await new AxeBuilder({ | ||
page, | ||
}).analyze(); | ||
|
||
test.expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
}); | ||
}); |