test(acceptance): cover status targets and native photo inclusion

This commit is contained in:
cesnimda
2026-10-10 22:07:46 +02:00
parent 5d9997f601
commit a3ecca9599
2 changed files with 54 additions and 0 deletions
@@ -0,0 +1,5 @@
# P5-15-04-A11Y-04 — Recorded-status targets
The ordinary native regression reproduces a standalone Analytics custom-status link with an actual 18 px target height, below the existing 24 px criterion. This is a separate list, not an inline prose exception. The new test also requires keyboard navigation to preserve the exact non-ASCII custom status query and load its owned job. It exercises EN/light phone and NB/dark tablet; no report calculation or status value is changed.
Two initial test attempts incorrectly toggled an already-open reporting disclosure closed. After correcting that fixture action, the meaningful assertion fails at measured height 18 (required at least 24). This is the RED application evidence; those setup failures are not additional product defects. PRES-S01 remains PARTIAL for unverified whole-area acceptance, with this confirmed target defect separately open.
@@ -291,7 +291,56 @@ test('[P5-15-02 C06 C07] CV source action reaches the existing Career Profile wo
await expect(page.getByRole('main')).toBeVisible();
await info.attach('cv-source-action-destination', { body: JSON.stringify({ href, destination: page.url(), expected: '/career or /career?section=profile; established canonical source workflow', observedText: await page.getByRole('main').innerText() }), contentType: 'application/json' });
await expect(page).toHaveURL(url => url.pathname === '/career');
await expect(page).toHaveURL(url => url.searchParams.get('section') === 'profile');
await expect(page.getByLabel(t.profileCvContactFullName, { exact: true })).toHaveValue('Åse Revisjonseksempel');
await page.goBack();
await expect(page.getByLabel(t.cvEditorName, { exact: true })).toHaveValue('Audit CV — dokumenterte ferdigheter og erfaring æøå');
});
test('[P5-15-04 S01] recorded-status drilldowns have usable targets and retain custom status queries', async ({ page, owner }, info) => {
for (const sample of [
{ area: 'analytics', path: '/analytics?months=6', width: 390, language: 'en', theme: 'light' },
{ area: 'analytics', path: '/analytics?months=6', width: 1024, language: 'nb', theme: 'dark' },
] as const) {
await enter(page, owner, sample);
const details = page.getByRole('region', { name: translations[sample.language].dashboardCurrentPipeline, exact: true }).locator('details');
await expect(details).toHaveAttribute('open', '');
const link = page.getByRole('link', { name: 'Faglig vurdering', exact: true });
await expect(link).toBeVisible();
const bounds = await link.boundingBox();
expect(bounds!.height, 'standalone status target height').toBeGreaterThanOrEqual(24);
expect(bounds!.width, 'standalone status target width').toBeGreaterThanOrEqual(24);
await link.focus(); await link.press('Enter');
await expect(page).toHaveURL(url => url.pathname === '/jobs' && url.searchParams.get('status') === 'Faglig vurdering');
await expect(page.getByText('Audit platform engineer 6 — langsiktig utvikling og inkluderende tjenester', { exact: true }).first()).toBeVisible();
await info.attach(`status-target-${sample.language}`, { body: JSON.stringify({ bounds, destination: page.url() }), contentType: 'application/json' });
}
});
test('[P5-15-03 C08 C12 E03] account photo reaches preview and native PDF only when included', async ({ page, owner }, info) => {
test.setTimeout(120_000);
const photo = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=', 'base64');
const upload = await page.request.post(`${apiUrl}/auth/avatar`, { headers: owner.headers,
multipart: { file: { name: 'synthetic-photo.png', mimeType: 'image/png', buffer: photo } } });
expect(upload.status()).toBe(200);
const dataUrl = (await upload.json()).avatarImageDataUrl;
expect(dataUrl).toMatch(/^data:image\/png;base64,/);
for (const themeId of ['modern', 'technical']) {
for (const showPhoto of [true, false]) {
const current = await (await page.request.get(`${apiUrl}/cv/variants/${owner.cvId}`)).json();
expect((await page.request.put(`${apiUrl}/cv/variants/${owner.cvId}`, { headers: owner.headers,
data: { expectedVersion: current.version, settings: { ...current.settings, themeId, showPhoto } } })).status()).toBe(200);
await enter(page, owner, { area: 'cv', path: `/career/builder/${owner.cvId}`, width: 1440, language: 'en', theme: 'dark' });
const frame = page.getByTitle('CV preview', { exact: true });
const images = await frame.evaluate(element => Array.from((element as HTMLIFrameElement).contentDocument!.images).map(image => ({ src: image.src, complete: image.complete, width: image.naturalWidth })));
expect(images.filter(image => image.src === dataUrl)).toHaveLength(showPhoto ? 1 : 0);
if (showPhoto) expect(images.find(image => image.src === dataUrl)).toEqual({ src: dataUrl, complete: true, width: 1 });
const pdf = await page.request.post(`${apiUrl}/cv/variants/${owner.cvId}/export-pdf`, { headers: owner.headers });
expect(pdf.status()).toBe(200);
await info.attach(`photo-${themeId}-${showPhoto ? 'included' : 'hidden'}.pdf`, { body: await pdf.body(), contentType: 'application/pdf' });
await info.attach(`photo-${themeId}-${showPhoto ? 'included' : 'hidden'}.json`, { body: JSON.stringify({ themeId, showPhoto, previewPages: await page.locator('[data-cv-page]').count(), decodedPhotoCount: images.filter(image => image.src === dataUrl).length }), contentType: 'application/json' });
}
}
});
test('[P5-15-02 W08 J10] keyboard upload and import controls open the native file chooser', async ({ page, owner }, info) => {