test(webui): cover contextual help in the browser
This commit is contained in:
@@ -110,6 +110,44 @@ test("Quick Access preserves focus and adapts to a narrow viewport", async ({ pa
|
||||
await expect(filesTrigger).toBeFocused();
|
||||
});
|
||||
|
||||
test("F1 resolves focused high-risk help and restores focus accessibly", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto("/?theme=light&help=1");
|
||||
|
||||
const retentionAction = page.getByTestId("f1-retention-action");
|
||||
await retentionAction.focus();
|
||||
await page.keyboard.press("F1");
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Kontexthilfe" });
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(dialog.locator("[data-help-context]"))
|
||||
.toHaveAttribute("data-help-context", "policy.retention.action.apply");
|
||||
await expect(dialog.getByRole("heading", { level: 3 }))
|
||||
.toHaveText("Aufbewahrungsregeln anwenden");
|
||||
await expect(dialog).toContainText("topic=policy.admin.retention-and-disposition");
|
||||
await expect(dialog.getByRole("button", { name: "Administrator-Dokumentation öffnen" }))
|
||||
.toBeVisible();
|
||||
await expectNoAccessibilityViolations(page);
|
||||
|
||||
const bounds = await dialog.boundingBox();
|
||||
expect(bounds?.x).toBeGreaterThanOrEqual(0);
|
||||
expect((bounds?.x ?? 0) + (bounds?.width ?? 0)).toBeLessThanOrEqual(390);
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect(retentionAction).toBeFocused();
|
||||
|
||||
const fallbackAction = page.getByTestId("f1-fallback-action");
|
||||
await fallbackAction.focus();
|
||||
await page.keyboard.press("F1");
|
||||
const fallbackDialog = page.getByRole("dialog", { name: "Kontexthilfe" });
|
||||
await expect(fallbackDialog.locator("[data-help-context]"))
|
||||
.toHaveAttribute("data-help-context", "core.conformance.action.review");
|
||||
await expect(fallbackDialog).toContainText("fallback_context=campaigns.list");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(fallbackAction).toBeFocused();
|
||||
});
|
||||
|
||||
test("View focus has a deliberate permission-derived all-tools escape", async ({ page }) => {
|
||||
await page.route("**/api/v1/quick-access/effective*", async (route) => {
|
||||
await route.fulfill({
|
||||
|
||||
Reference in New Issue
Block a user