Files
Reactive-Resume/tests/e2e/specs/section-editing.spec.ts
T
Amruth Pillai e2e5c15580 test(e2e): cover inline editing and click-to-select
Specs follow the outline rows, the eye on each row, the photo row, the
structured dates and the Full name field, and a new spec checks that a
click on the page opens its entry and focusing a field outlines its block.
The download-preference spec waits for the share address after a reload.
2026-09-28 18:20:27 +02:00

38 lines
1.8 KiB
TypeScript

import { createSampleResumeFromDashboard, openSidebarSection } from "../fixtures/resume";
import { expect, test } from "../fixtures/test";
test("adds an experience item and persists it across reloads", async ({ authPage: page }, testInfo) => {
await createSampleResumeFromDashboard(page, testInfo);
const company = `E2E Corp ${Date.now()}`;
const position = "Principal Tester";
await openSidebarSection(page, "Experience");
await page.getByRole("button", { name: "Add experience", exact: true }).click();
// The new draft opens in place with its first field focused; it saves as you type.
const entry = page.locator("#sidebar-experience [data-entry-id]").last();
await expect(entry.getByText("Draft · not printed")).toBeVisible();
await expect(entry.getByRole("textbox", { name: "Position" })).toBeFocused();
const savePromise = page.waitForResponse((response) => {
if (!response.url().includes("/api/rpc")) return false;
if (response.request().method() !== "POST") return false;
if (!response.ok()) return false;
return (response.request().postData() ?? "").includes(company);
});
await entry.getByRole("textbox", { name: "Position" }).fill(position);
await entry.getByRole("textbox", { name: "Company" }).fill(company);
await savePromise;
// With a company it's no longer a draft, and its card reads "company · …"
await expect(entry.getByText("Draft · not printed")).toHaveCount(0);
await expect(page.getByText(company).filter({ visible: true }).first()).toBeVisible();
// And it survives a full reload
await page.reload();
await openSidebarSection(page, "Experience");
await expect(page.getByText(company).filter({ visible: true }).first()).toBeVisible();
await expect(page.getByText(position).filter({ visible: true }).first()).toBeVisible();
});