with some tests
This commit is contained in:
parent
a764c92a0b
commit
0995e1cc77
18 changed files with 3020 additions and 16 deletions
29
frontend/e2e/counter.spec.ts
Normal file
29
frontend/e2e/counter.spec.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test("displays counter value", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.locator("h1")).not.toHaveText("...");
|
||||
});
|
||||
|
||||
test("clicking +1 increments the counter", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.locator("h1")).not.toHaveText("...");
|
||||
|
||||
const before = await page.locator("h1").textContent();
|
||||
await page.click("button");
|
||||
await expect(page.locator("h1")).toHaveText(String(Number(before) + 1));
|
||||
});
|
||||
|
||||
test("counter persists after reload", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.locator("h1")).not.toHaveText("...");
|
||||
|
||||
const before = await page.locator("h1").textContent();
|
||||
await page.click("button");
|
||||
const expected = String(Number(before) + 1);
|
||||
await expect(page.locator("h1")).toHaveText(expected);
|
||||
|
||||
await page.reload();
|
||||
await expect(page.locator("h1")).toHaveText(expected);
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue