Verify CV history through responsive editor navigation
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { expect, test, type APIRequestContext } from "@playwright/test";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { translations } from "../src/i18n/translations";
|
||||
import { openCvStudioSection } from "./helpers/cvStudioNavigation";
|
||||
|
||||
const apiUrl = "http://localhost:5302/api";
|
||||
const evidence = path.resolve(process.env.CV_FIDELITY_OUTPUT || "../.artifacts/p5-09-readiness/rendering");
|
||||
@@ -176,7 +178,7 @@ test("[PRES-C06 C10 E08] stale editor retains and downloads its draft; reviewed
|
||||
const headers = await authenticate(page.request);
|
||||
const cv = await (await page.request.post(`${apiUrl}/cv/variants`, { headers, data: { name: "Recovery fixture", settings: { themeId: "minimal" } } })).json();
|
||||
await page.goto(`/career/builder/${cv.id}`);
|
||||
await page.getByRole("tab", { name: "Content", exact: true }).click();
|
||||
await openCvStudioSection(page, translations.en.cvEditorStudioNavigation, translations.en.cvEditorContent);
|
||||
const headline = page.getByLabel("Headline override", { exact: true });
|
||||
await expect(headline).toBeVisible();
|
||||
const remote = await page.request.put(`${apiUrl}/cv/variants/${cv.id}`, { headers, data: { expectedVersion: cv.version, settings: { ...cv.settings, headline: "Remote reviewed edit" } } });
|
||||
@@ -207,6 +209,6 @@ test("[PRES-C06 C10 E08] stale editor retains and downloads its draft; reviewed
|
||||
expect((await reviewedSave).status()).toBe(200);
|
||||
await expect(page.getByText("Saved", { exact: true })).toBeVisible();
|
||||
expect((await (await page.request.get(`${apiUrl}/cv/variants/${cv.id}`)).json()).version).toBe(3);
|
||||
await page.getByRole("tab", { name: "History", exact: true }).click();
|
||||
await openCvStudioSection(page, translations.en.cvEditorStudioNavigation, translations.en.cvEditorHistory);
|
||||
await expect(page.getByText("Version 1", { exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import { expect, test, type APIRequestContext, type Locator, type Page, type Tes
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import type { CvOutline, CvVariant } from '../src/cvBuilder';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { openCvStudioSection } from './helpers/cvStudioNavigation';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
@@ -244,14 +245,14 @@ for (const [mode, language] of [['light', 'en'], ['dark', 'nb'], ['light', 'nb']
|
||||
// Existing history stores CV settings; it does not snapshot Career Profile.
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
const final = await read();
|
||||
await page.getByRole('tab', { name: t.cvEditorHistory, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorHistory);
|
||||
const history = page.getByRole('tabpanel', { name: t.cvEditorHistory, exact: true });
|
||||
await expect(history.getByText(t.cvEditorVersion.replace('{version}', '1'), { exact: true })).toBeVisible();
|
||||
await history.getByRole('button', { name: t.cvEditorRestoreTitle.replace('{version}', '1'), exact: true }).click();
|
||||
await page.getByRole('dialog').getByRole('button', { name: t.cvEditorRestoreVersion, exact: true }).click();
|
||||
await expect.poll(async () => (await read()).version).toBe(final.version + 1);
|
||||
expect((await read()).settings).toEqual(cv.settings); await unchanged(changedSource);
|
||||
await page.getByRole('tab', { name: t.cvEditorContent, exact: true }).click();
|
||||
await openCvStudioSection(page, t.cvEditorStudioNavigation, t.cvEditorContent);
|
||||
const inherited = entry('Updated source title');
|
||||
await expect(inherited.getByLabel(t.cvEditorEntryTitle, { exact: true })).toHaveValue('Updated source title');
|
||||
await expect(inherited.getByLabel(t.cvEditorEntrySubtitle, { exact: true })).toHaveValue('Updated source employer');
|
||||
|
||||
Reference in New Issue
Block a user