Skip to content

fix: de-flake e2e DevTools poll and remove new-code duplication - #238

Merged
setchy merged 2 commits into
mainfrom
fix/e2e-flake-and-sonar-duplication
Oct 7, 2026
Merged

setchy merged 2 commits into
mainfrom
fix/e2e-flake-and-sonar-duplication

Conversation

@setchy

@setchy setchy commented Oct 7, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the two main failures from the latest push.

1. GitHub Actions — E2E flake

Run 37625359729 (cad45c6) failed only on E2E [Ubuntu 24.04]: the "keep-open changes survive DevTools and restore click-away dismissal" test timed out waiting for isDevToolsOpened() (default 5s poll, failed original + retry). The same test passed on Ubuntu 24.04 in the two prior runs, so it is a flake — a detached DevTools window opening under Xvfb can exceed 5s on a busier runner (the matrix just gained a ninth platform).

Fix: give both DevTools polls a 15s budget.

2. SonarCloud — quality gate ERROR

Only failing condition was new-code duplication 9.3% (limit 3%). No open issues or hotspots.

Fix (dedupe the flagged blocks):

  • Extract the shared read/parse/sort/rewrite logic of the e2e and visual platform-table scripts into tests/shared/update-platforms.mts; each entry point now declares only its markers, results dir, and block builder.
  • Hoist the copy-pasted ready / findHandler helpers in Menubar.spec.ts to module scope.
  • Extract the repeated focus/blur + visibility-poll sequences in the e2e test into helpers (also used by the Windows test).

Verification

  • pnpm run lint:check ✅
  • pnpm run typecheck ✅
  • pnpm run test ✅ (129 passed)
  • pnpm run test:e2e ✅ (7 passed, 1 skipped, on macOS)
  • Old vs. new update-platforms scripts produce byte-for-byte identical PLATFORMS.md (checked changed / unchanged / empty-results paths).

setchy added 2 commits October 7, 2026 09:40
The keep-open test's `isDevToolsOpened()` poll used Playwright's default
5s timeout, which is too tight when a detached DevTools window has to
open on a busy runner (observed flaking on Ubuntu 24.04 under Xvfb once
the matrix gained its ninth platform). Give both DevTools polls a 15s
budget.

While here, extract the focus/blur and visibility-poll sequences that
the Windows and keep-open tests repeated into helpers, removing the
copy-paste duplication Sonar flagged on new code.
SonarCloud's quality gate failed on new-code duplication (9.3% vs 3%).
The largest contributor was the near-identical tail of the e2e and
visual platform-table scripts. Move the shared read/parse/sort/rewrite
logic into tests/shared/update-platforms.mts, leaving each entry point
to declare only its markers, results dir, and block builder. Output is
byte-for-byte unchanged (verified against the previous scripts).

Also hoist the `ready`/`findHandler` helpers that were copy-pasted
across several Menubar.spec.ts describe blocks to module scope.
@setchy
setchy requested a review from afonsojramos as a code owner October 7, 2026 13:41
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@setchy
setchy merged commit c34ea83 into main Oct 7, 2026
29 checks passed
@setchy
setchy deleted the fix/e2e-flake-and-sonar-duplication branch October 7, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant