test: add some tests

This commit is contained in:
rusconn
2023-10-14 10:45:58 +09:00
parent 99bc0b6a17
commit 6c7f03d3fe
13 changed files with 348 additions and 65 deletions

View File

@@ -0,0 +1,35 @@
import { expect, Page, test } from "@playwright/test";
function navExpandedButton(page: Page) {
const nav = page.getByRole("navigation");
return nav.getByRole("button", { expanded: true });
}
test.describe("initial open/close states of accordion", () => {
test("closed when go to /", async ({ page }) => {
const button = navExpandedButton(page);
await page.goto("/");
await expect(button).not.toBeVisible();
});
test("closed when go to group pages", async ({ page }) => {
const button = navExpandedButton(page);
await page.goto("/converters");
await expect(button).not.toBeVisible();
await page.goto("/formatters");
await expect(button).not.toBeVisible();
});
test("opened when go to tool pages", async ({ page }) => {
const button = navExpandedButton(page);
await page.goto("/converters/number-base");
await expect(button).toBeVisible();
await page.goto("/formatters/json");
await expect(button).toBeVisible();
});
});