fix(ui): reconcile shared accessibility and read recovery

This commit is contained in:
cesnimda
2026-10-20 20:26:48 +02:00
parent bba52af4b8
commit d8c0187305
25 changed files with 802 additions and 25 deletions
@@ -220,6 +220,34 @@ async function capture(page: Page, info: TestInfo, sample: Sample, state: string
expect(geometry.rootOverflow).toBe(0); expect(axe.violations).toEqual([]);
}
test('[P7-11 E08] Strategy failed reads remain distinct from exact not-generated state and retry only GET in both locales', async ({ page, session }, info) => {
const job = await createJob(page.request, session.owner, 'Recorded Strategy read recovery');
let unavailable = true;
await page.route(`**/api/jobapplications/${job.id}/focus-plan`, route => {
expect(route.request().method()).toBe('GET');
return route.fulfill(unavailable ? { status: 503, json: { title: 'Controlled unavailable Strategy read' } } : { status: 404, json: { code: 'strategy_not_generated' } });
});
for (const sample of [desktop, { language: 'nb', theme: 'dark', width: 320, height: 844 }] as Sample[]) {
unavailable = true;
await enter(page, session.owner, job, 'answers', sample);
await keyboard(page, page.getByRole('tablist', { name: translations[sample.language].workspaceSections, exact: true }).getByRole('tab', { name: translations[sample.language].workspaceMatch, exact: true }));
const t = translations[sample.language];
const error = page.getByRole('alert').filter({ hasText: t.workspaceStrategyLoadFailed });
await expect(error).toBeVisible();
await expect(page.getByText(t.workspaceStrategyEmpty, { exact: true })).toHaveCount(0);
await expect(page.getByRole('button', { name: t.workspaceStrategyProRequired, exact: true })).toBeDisabled();
await capture(page, info, sample, 'strategy-read-unavailable');
const before = count(session, 'GET', `/api/jobapplications/${job.id}/focus-plan`).length;
unavailable = false;
await keyboard(page, error.getByRole('button', { name: t.retry, exact: true }));
await expect(page.getByRole('heading', { name: t.workspaceStrategyTitle, level: 2, exact: true })).toBeFocused();
await expect(page.getByText(t.workspaceStrategyEmpty, { exact: true })).toBeVisible();
expect(count(session, 'GET', `/api/jobapplications/${job.id}/focus-plan`).length).toBe(before + 1);
await capture(page, info, sample, 'strategy-exact-not-generated');
}
expect(mutations(session)).toEqual([]);
});
test('[P7-06 forms] held CV read Retry preserves its request and actual attach/replace/detach remain owner scoped', async ({ page, session, playwright }, info) => {
test.setTimeout(120_000); await source(page.request, session.owner);
const job = await createJob(page.request, session.owner); const first = await variant(page.request, session.owner, 'First reusable CV'); const second = await variant(page.request, session.owner, 'Second reusable CV');