mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-04 18:53:52 +10:00
template-switch now previews a template on hover, applies it from its card, checks it after a reload and undoes a switch from the toast. The section helper opens Design groups and the exact-value sections inside Advanced.
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
import { createSampleResumeFromDashboard, openSidebarSection } from "../fixtures/resume";
|
|
import { expect, test } from "../fixtures/test";
|
|
|
|
test("previews a template on hover, applies it on click and persists the choice", async ({
|
|
authPage: page,
|
|
}, testInfo) => {
|
|
await createSampleResumeFromDashboard(page, testInfo);
|
|
|
|
await openSidebarSection(page, "Template");
|
|
// Sample resumes start on Azurill.
|
|
await expect(page.getByRole("button", { name: /^Azurill\b/ })).toHaveAttribute("aria-pressed", "true");
|
|
|
|
const bronzor = page.getByRole("button", { name: /^Bronzor\b/ });
|
|
await bronzor.hover();
|
|
await expect(page.getByRole("status").filter({ hasText: "Previewing Bronzor · click to apply" })).toBeVisible();
|
|
|
|
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("bronzor");
|
|
});
|
|
await bronzor.click();
|
|
await expect(page.getByText("Template changed to Bronzor")).toBeVisible();
|
|
await expect(bronzor).toHaveAttribute("aria-pressed", "true");
|
|
await savePromise;
|
|
|
|
// After a reload the gallery still marks the newly selected template.
|
|
await page.reload();
|
|
await openSidebarSection(page, "Template");
|
|
await expect(page.getByRole("button", { name: /^Bronzor\b/ })).toHaveAttribute("aria-pressed", "true");
|
|
});
|
|
|
|
test("undoes a template switch from its toast", async ({ authPage: page }, testInfo) => {
|
|
await createSampleResumeFromDashboard(page, testInfo);
|
|
await openSidebarSection(page, "Template");
|
|
|
|
await page.getByRole("button", { name: /^Onyx\b/ }).click();
|
|
await page.getByRole("button", { name: "Undo", exact: true }).last().click();
|
|
await expect(page.getByRole("button", { name: /^Azurill\b/ })).toHaveAttribute("aria-pressed", "true");
|
|
});
|