test: playwright end-to-end qa (17 tests, real models)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ahmed mohammed
2026-09-22 09:02:53 +03:00
co-authored by Claude Opus 4.7
parent 0db7b8140b
commit 07dd3d6bf8
12 changed files with 233 additions and 4 deletions
+31
View File
@@ -0,0 +1,31 @@
import { test, expect } from "@playwright/test";
test.use({ storageState: ".auth/user.json" });
test("rename sticks, delete asks first then removes", async ({ page }) => {
await page.goto("/app");
const row = page.locator(".rail li").first();
await row.locator('input[name="title"]').fill("Renamed by QA");
await row.getByRole("button", { name: "Save" }).click();
await expect(page.locator(".rail", { hasText: "Renamed by QA" })).toBeVisible({ timeout: 15_000 });
const before = await page.locator(".rail li").count();
let asked = false;
page.once("dialog", async (d) => { asked = true; await d.dismiss(); }); // refuse: nothing may vanish
await page.locator(".rail li").first().getByRole("button", { name: "Delete" }).click();
await page.waitForTimeout(1000);
expect(asked).toBe(true);
expect(await page.locator(".rail li").count()).toBe(before);
page.once("dialog", async (d) => { await d.accept(); });
await page.locator(".rail li").first().getByRole("button", { name: "Delete" }).click();
await expect.poll(async () => page.locator(".rail li").count(), { timeout: 20_000 }).toBe(before - 1);
});
test("reopening a stored run renders the report with no new model call", async ({ page }) => {
await page.goto("/app");
await page.locator('.rail a[href^="/app/"]').first().click();
await expect(page.locator("#report")).toBeVisible({ timeout: 30_000 });
await expect(page.getByRole("button", { name: "Analyse" })).toHaveCount(0);
// The stored Jev verdict is server-rendered, so it is readable even if the report body had failed.
await expect(page.getByText(/Jev verdict ·/)).toBeVisible();
});