From bfff15d2a303782378b8f16d834ec36282288dbc Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Wed, 8 Apr 2026 19:58:46 +0100 Subject: [PATCH 1/2] Fix flaky "terminal maintains functionality with drawer interactions" test The test failed ~40% of the time in CI because of two issues: 1. Race condition: after opening the drawer, the terminal resizes but the test immediately typed "help" before xterm finished its reflow, causing escape code fragments to appear as literal GGGGG...DDDDD... characters. Fix: add waitForTerminalStable() after the drawer opens. 2. Wrong assertion: "Subscribe to a channel" only appears in full-size help output, not in the compact drawer-sized output. Changed to "Display help for ably" which appears in both layouts. Also adds a temporary stress-test step (10x repeat) in CI to validate the fix. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/e2e-web-cli-parallel.yml | 10 ++++++++++ test/e2e/web-cli/web-cli.test.ts | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-web-cli-parallel.yml b/.github/workflows/e2e-web-cli-parallel.yml index d03c8ce0..6e6c2a52 100644 --- a/.github/workflows/e2e-web-cli-parallel.yml +++ b/.github/workflows/e2e-web-cli-parallel.yml @@ -274,6 +274,16 @@ jobs: test/e2e/web-cli/prompt-integrity.test.ts \ --reporter=json,html + - name: Stress-test drawer interaction fix (temporary) + run: | + echo "Repeating drawer test 10x to validate flakiness fix..." + pnpm exec playwright test \ + --config test/e2e/web-cli/playwright.config.ts \ + test/e2e/web-cli/web-cli.test.ts \ + -g "terminal maintains functionality with drawer interactions" \ + --repeat-each 10 \ + --reporter=json,html + # Group 4: Rate Limit Test (1 test - must run last) rate-limit-test: needs: [auth-tests, session-tests, ui-tests] diff --git a/test/e2e/web-cli/web-cli.test.ts b/test/e2e/web-cli/web-cli.test.ts index bf755137..cb9e1cd3 100644 --- a/test/e2e/web-cli/web-cli.test.ts +++ b/test/e2e/web-cli/web-cli.test.ts @@ -369,14 +369,19 @@ test.describe("Web CLI E2E Tests", () => { ); await expect(drawer).toBeVisible({ timeout: 5000 }); + // Wait for the terminal to stabilize after the drawer resize — + // without this, keystrokes race with xterm's resize/reflow and + // produce escape-code corruption (GGGGG…DDDDD… garbage). + await waitForTerminalStable(page, 1000); + // Terminal should still be functional with drawer open await page.locator(terminalSelector).focus(); await page.keyboard.type("help"); await page.keyboard.press("Enter"); - // Use a non-styled string from help output — bold headers like "COMMON COMMANDS" - // can be garbled by xterm escape codes when the terminal is resized in drawer mode + // The drawer terminal is smaller, so help output may be truncated. + // Match a string that appears in both full and compact help output. await expect(page.locator(terminalSelector)).toContainText( - "Subscribe to a channel", + "Display help for ably", { timeout: 10000, }, From 4672136e0ee8f1e45a77090b76c60ce476543739 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Wed, 8 Apr 2026 20:27:01 +0100 Subject: [PATCH 2/2] Remove temporary stress-test CI step Co-Authored-By: Claude Opus 4.6 --- .github/workflows/e2e-web-cli-parallel.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/e2e-web-cli-parallel.yml b/.github/workflows/e2e-web-cli-parallel.yml index 6e6c2a52..d03c8ce0 100644 --- a/.github/workflows/e2e-web-cli-parallel.yml +++ b/.github/workflows/e2e-web-cli-parallel.yml @@ -274,16 +274,6 @@ jobs: test/e2e/web-cli/prompt-integrity.test.ts \ --reporter=json,html - - name: Stress-test drawer interaction fix (temporary) - run: | - echo "Repeating drawer test 10x to validate flakiness fix..." - pnpm exec playwright test \ - --config test/e2e/web-cli/playwright.config.ts \ - test/e2e/web-cli/web-cli.test.ts \ - -g "terminal maintains functionality with drawer interactions" \ - --repeat-each 10 \ - --reporter=json,html - # Group 4: Rate Limit Test (1 test - must run last) rate-limit-test: needs: [auth-tests, session-tests, ui-tests]