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

6
tests/app/page.spec.ts Normal file
View File

@@ -0,0 +1,6 @@
import { expect, test } from "@playwright/test";
test("VRT", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveScreenshot();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

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();
});
});