Files
Reactive-Resume/tests/e2e/specs/json-export-import.spec.ts
T
Cursor Agent 3c222660c1 test: add core e2e fixtures and specs
Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
2026-06-20 04:08:57 +00:00

29 lines
1.2 KiB
TypeScript

import { createSampleResumeFromDashboard, openSidebarSection } from "../fixtures/resume";
import { expect, test } from "../fixtures/test";
test("exports and imports a resume JSON backup", async ({ authPage: page }, testInfo) => {
const resumeName = await createSampleResumeFromDashboard(page, testInfo);
await openSidebarSection(page, "Export");
const downloadPromise = page.waitForEvent("download");
await page.getByRole("button", { name: /^JSON/ }).click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toMatch(/\.json$/);
const downloadPath = await download.path();
if (!downloadPath) throw new Error("Expected Playwright to provide a downloaded JSON path.");
await page.goto("/dashboard/resumes");
await page.getByText("Import an existing resume").click();
await page.getByRole("combobox").click();
await page.getByRole("option", { name: "Reactive Resume (JSON)" }).click();
await page.locator('input[type="file"]').setInputFiles(downloadPath);
await page.getByRole("button", { name: "Import" }).click();
await page.waitForURL(/\/builder\/.+/);
await openSidebarSection(page, "Basics");
await expect(page.getByLabel("Name")).toHaveValue(/.+/);
await expect(page.getByText(resumeName)).toBeVisible();
});