test(web): make the favicon picker offscreen-preview test deterministic #22174
main fromrefs/pull/22174/head·merged by juliusmarminge View on GitHubProjectFaviconPickerDialog.browser.test.tsx > loads previews asynchronously and only acquires offscreen images after scrolling fails intermittently on main (e.g. run 39379627378) with expected SVGSVGElement to be null at expectPreview.
The shared expectPreview helper polled until the <img> had naturalWidth === 8, then immediately asserted the fallback file icon was gone. Chromium sets naturalWidth when the image decodes, but the load event that drives the thumbnail's onLoad (and removes the fallback) arrives in a later task. On a slow CI runner the assertion lands between the two. The product is correct here: it deliberately keeps the fallback until the load is acknowledged, which the "keeps the file icon until the image load is acknowledged" test covers. The fix polls for both conditions together, so the helper waits for the stable loaded state instead of checking the moment in between.
Before: 10/10 local runs passed, so the race is too narrow to hit locally. To reproduce it, a scratch copy of the test delayed every image load event by 50 ms. The old helper then failed with the exact CI error, and the new helper passed.
After: 10/10 local runs pass (7/7 tests each). Web typecheck, lint and fmt pass on the touched file.
Opus 5.5 via Claude Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
bb7f54cMacroscope's review found this PR approvable — This is a one-file test-harness maintenance change confined to an ignored path, with no production runtime or product-default impact. It does not add static-analysis suppressions or affect schema, security, billing, or authentication behavior.
Notes:
- No code objects were reviewed. Approvability was decided on eligibility alone.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
2dfddd14-db1a-483f-851c-27efdcf28dec
📥 Commits
-
Reviewing files that changed from the base of the PR and between ce2815d665acb0dedc028c12109d3b7aebbcc134 and bb7f54ceb3a0503fc3149bf36a1547f1d39d177c.
📒 Files selected for processing: 1
-
apps/web/src/components/settings/ProjectFaviconPickerDialog.browser.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
📝 Walkthrough
-
The browser test now waits until the preview image has the expected natural width and the fallback SVG is absent.
Changes: Favicon preview test
Layer / File(s) Summary Synchronize preview assertions
apps/web/src/components/settings/ProjectFaviconPickerDialog.browser.test.tsxexpectPreviewnow polls for both the image width and fallback SVG absence before succeeding.Priority: ⬇️ Low
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Suggested reviewers:
serrnovik
Merge Risk: ⚪ Minimal · up to
bb7f5-
The test synchronization change is ready to merge with no identified merge-blocking risk.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly identifies the web test change and its purpose: making the favicon picker offscreen-preview test deterministic. Description check The description explains the intermittent failure, root cause, implementation, reproduction method, verification results, and agent attribution. The focused bug fix also provides sufficient scope cont… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description explains the intermittent failure, root cause, implementation, reproduction method, verification results, and agent attribution. The focused bug fix also provides sufficient scope context.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged this4836fa7
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes