mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-27 18:34:51 +10:00
test: add core e2e fixtures and specs
Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { loginViaUi, logoutViaUi, registerViaUi } from "../fixtures/auth";
|
||||
import { expect, test } from "../fixtures/test";
|
||||
|
||||
test("registers and logs in with email credentials", async ({ page, account }) => {
|
||||
await registerViaUi(page, account);
|
||||
await expect(page.getByRole("heading", { name: "Resumes" })).toBeVisible();
|
||||
|
||||
await logoutViaUi(page, account);
|
||||
await expect(page.getByRole("heading", { name: "Sign in to your account" })).toBeVisible();
|
||||
|
||||
await loginViaUi(page, account);
|
||||
await expect(page.getByRole("heading", { name: "Resumes" })).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { createSampleResumeFromDashboard, openSidebarSection } from "../fixtures/resume";
|
||||
import { expect, test } from "../fixtures/test";
|
||||
|
||||
test("publishes a resume and renders it for an anonymous visitor", async ({ browser, authPage: page }, testInfo) => {
|
||||
await createSampleResumeFromDashboard(page, testInfo);
|
||||
await openSidebarSection(page, "Sharing");
|
||||
|
||||
await page.getByLabel("Allow Public Access").click();
|
||||
const publicUrl = await page.getByLabel("URL").inputValue();
|
||||
expect(publicUrl).toMatch(/\/e2e_/);
|
||||
|
||||
const anonymous = await browser.newPage();
|
||||
await anonymous.goto(publicUrl);
|
||||
await expect(anonymous.getByRole("button", { name: "Download PDF" })).toBeVisible();
|
||||
await anonymous.close();
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { createSampleResumeFromDashboard, openSidebarSection } from "../fixtures/resume";
|
||||
import { expect, test } from "../fixtures/test";
|
||||
|
||||
test("creates a sample resume and persists a basics edit", async ({ authPage: page }, testInfo) => {
|
||||
await createSampleResumeFromDashboard(page, testInfo);
|
||||
|
||||
const updatedName = `E2E Edited ${Date.now()}`;
|
||||
await openSidebarSection(page, "Basics");
|
||||
await page.getByLabel("Name").fill(updatedName);
|
||||
|
||||
await page.reload();
|
||||
await openSidebarSection(page, "Basics");
|
||||
await expect(page.getByLabel("Name")).toHaveValue(updatedName);
|
||||
});
|
||||
Reference in New Issue
Block a user