Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(sidebar-icon-collapse): add canvas token assertion and fix focus test

Steven Enamakel906bae97c1cc
diff --git a/app/test/playwright/specs/sidebar-icon-collapse.spec.ts b/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
index a45de0d44d..f074a157d8 100644
--- a/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
+++ b/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
@@ -72,6 +72,14 @@ const THEME_COMBOS: ThemeCombo[] = [
{ name: 'hal9000-dark', familyId: 'hal9000', variant: 'dark' },
];
+const EXPECTED_CANVAS_BY_THEME: Record<string, string> = {
+ 'classic-light': '245 245 245',
+ 'classic-dark': '0 0 0',
+ 'ocean-dark': '7 12 24',
+ 'matrix-light': '234 245 237',
+ 'hal9000-dark': '8 4 4',
+};
+
function tripleToRgb(triple: string): string {
const [r, g, b] = triple.trim().split(/\s+/).map(Number);
return `rgb(${r}, ${g}, ${b})`;
@@ -220,6 +228,12 @@ test.describe('Sidebar icon-collapse verification (#5676)', () => {
expect(isDark).toBe(combo.variant === 'dark');
await expect(page.locator(SIDEBAR)).toHaveAttribute('data-state', 'expanded');
+ // Verify the persisted family, not only its light/dark variant. Each
+ // selected family has a distinct canvas token in this coverage set.
+ expect(await tokenTriple(page, '--surface-canvas')).toBe(
+ EXPECTED_CANVAS_BY_THEME[combo.name]
+ );
+
const chromeRgb = tripleToRgb(await tokenTriple(page, '--line-chrome'));
const plainLineRgb = tripleToRgb(await tokenTriple(page, '--line'));
// The two tokens must actually differ, or this assertion proves nothing.
@@ -240,7 +254,12 @@ test.describe('Sidebar icon-collapse verification (#5676)', () => {
.toBe(chromeRgb);
// Focus: same verdict through the group-focus variant.
+ await page.mouse.move(1, 1);
+ await expect
+ .poll(async () => indicator.evaluate(el => getComputedStyle(el).backgroundColor))
+ .toBe('rgba(0, 0, 0, 0)');
await rail.focus();
+ await expect(rail).toBeFocused();
await expect
.poll(async () => indicator.evaluate(el => getComputedStyle(el).backgroundColor))
.toBe(chromeRgb);
diff --git a/docs/QA-SIDEBAR-ICON-COLLAPSE.md b/docs/QA-SIDEBAR-ICON-COLLAPSE.md
index 56ae90d871..471f26a4d4 100644
--- a/docs/QA-SIDEBAR-ICON-COLLAPSE.md
+++ b/docs/QA-SIDEBAR-ICON-COLLAPSE.md
@@ -34,7 +34,7 @@ need to re-derive them (it should still notice anything odd):
Run the automated layer with:
```bash
-pnpm test:e2e:web -- test/playwright/specs/sidebar-icon-collapse.spec.ts
+pnpm --filter openhuman-app test:e2e:web -- test/playwright/specs/sidebar-icon-collapse.spec.ts
# or against an existing build:
bash app/scripts/e2e-web-session.sh test/playwright/specs/sidebar-icon-collapse.spec.ts
```
@@ -66,7 +66,7 @@ Set `PW_SIDEBAR_SHOTS=1` to also drop evidence screenshots into
- [ ] **Traffic lights stay clear while collapsed** — With the sidebar
collapsed, the macOS window controls must sit on bare draggable chrome,
fully visible and clickable, not overlapping the first rail icon. Click
- each traffic light (close last). Expected: every click lands on the
+ the minimise and maximise traffic lights. Expected: every click lands on the
control, none gets swallowed by a rail button; dragging the window by the
strip above the icons moves the window.
- [ ] **Traffic lights stay clear while expanded** — Same check with the
@@ -84,6 +84,8 @@ Set `PW_SIDEBAR_SHOTS=1` to also drop evidence screenshots into
press Left/Right; expected: 16px steps. Quit the app entirely (mod+Q) and
relaunch. Expected: the sidebar reopens at the dragged width. Also
collapse, quit, relaunch: expected: still collapsed.
+ After all other macOS checks are complete, click the close traffic light
+ to confirm it exits cleanly.
### Windows (recommended)