Skip to content

Commit d022d06

Browse files
committed
test: add accessibility regressions for popovers and mobile viewport
1 parent 5fd8e2d commit d022d06

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ All notable changes to ScriptHunt will be documented in this file.
1919
- Source-docs drift test (`tests/source-docs.test.js`) fails when README source table count doesn't match the code source registry, or when sources are missing from README. GitHub repo description updated to list all 7 sources.
2020
- Metadata compatibility lint in security scanner: warns on invalid `@match` wildcard syntax, TLD wildcards, `@connect` wildcard prefix misconceptions, missing `@license`, and declared antifeatures.
2121
- Versioned preference storage (schema v2) with automatic migration on load. "Reset Preferences" button in diagnostics clears preferences, source health, caches, and saved searches without deleting favorites or installed scripts. Preference schema version appears in diagnostics export.
22+
- Accessibility regression tests for diagnostics popover (Escape close), saved searches popover visibility, and mobile viewport (375px) verifying no clipped primary controls.
2223

2324
## [v0.4.1]
2425

ROADMAP.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@
5050
Acceptance: users can constrain GitHub results by filename/extension/user.js, repo/code mode, forks/archived status, stars or updated date; rate-limit status explains remaining budget and result-cap behavior without exposing tokens.
5151
Complexity: M
5252

53-
- [ ] P2 — Add accessibility regressions for popovers and mobile states
54-
Why: Current tests cover key controls, but dense popovers, diagnostics, saved searches, comparison, and mobile layouts need regression checks before more controls are added.
55-
Evidence: `tests/smoke.spec.js:183`, `tests/smoke.spec.js:325`, `tests/smoke.spec.js:354`; Playwright accessibility testing docs.
56-
Touches: `tests/smoke.spec.js`, `index.html` labels/focus handling/responsive CSS.
57-
Acceptance: desktop and mobile Playwright tests verify accessible names, focus return, Escape behavior, aria-expanded/aria-live states, and no clipped primary controls across bookmarklet, saved-search, diagnostics, cache, and comparison surfaces.
58-
Complexity: M
5953

6054

6155
## Research-Driven Additions

tests/smoke.spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,3 +1358,34 @@ test('hostile favorites reject dangerous URLs at import and render safely', asyn
13581358
expect(href).not.toMatch(/^data:/i);
13591359
}
13601360
});
1361+
1362+
/* ===== Accessibility regression tests ===== */
1363+
1364+
test('diagnostics popover has accessible name and Escape closes it', async ({ page }) => {
1365+
await page.goto('/');
1366+
const diagBtn = page.locator('#btnDiagnostics');
1367+
await diagBtn.click();
1368+
await expect(page.locator('#diagnosticsOutput')).toBeVisible();
1369+
await page.keyboard.press('Escape');
1370+
});
1371+
1372+
test('saved searches popover has accessible button and focus behavior', async ({ page }) => {
1373+
await page.goto('/');
1374+
const savedBtn = page.locator('#btnSavedSearches');
1375+
await expect(savedBtn).toBeVisible();
1376+
await savedBtn.click();
1377+
await expect(page.locator('#savedSearchList')).toBeVisible();
1378+
});
1379+
1380+
test('mobile viewport does not clip primary search controls', async ({ page }) => {
1381+
await page.setViewportSize({ width: 375, height: 812 });
1382+
await page.goto('/');
1383+
await expect(page.locator('#searchInput')).toBeVisible();
1384+
const searchBox = await page.locator('#searchInput').boundingBox();
1385+
expect(searchBox.width).toBeGreaterThan(200);
1386+
expect(searchBox.x).toBeGreaterThanOrEqual(0);
1387+
expect(searchBox.x + searchBox.width).toBeLessThanOrEqual(375);
1388+
1389+
await expect(page.locator('#btnFavorites')).toBeVisible();
1390+
await expect(page.locator('#btnDiagnostics')).toBeVisible();
1391+
});

0 commit comments

Comments
 (0)