Skip to content

Fix flaky communities visual test (was failing every PR) - #13

Merged
Ashwask merged 3 commits into
mainfrom
fix-communities-search-flake
Jul 31, 2026
Merged

Fix flaky communities visual test (was failing every PR)#13
Ashwask merged 3 commits into
mainfrom
fix-communities-search-flake

Conversation

@Ashwask

@Ashwask Ashwask commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

communities search filters cards was the only visual check failing on every PR (and it fails on unchanged main too — I reproduced it by re-running main's last green run in today's environment).

Two root causes:

  1. It never stubbed Supabase. Every other visual spec goes through auditPage → stubSupabase and renders a fixed fixture. This one navigated directly, so it rendered live prod data — as communities changed in production, the full-page screenshot drifted and the baseline went stale.
  2. Fixed 500 ms sleep after typing, racing the 200 ms-debounced re-render.

While fixing it I also found the fuzzy search box (Fuse) returns all 3 fixture communities for the query "bengaluru", so a search-box count assertion can't be both meaningful and stable.

Fix

  • Stub Supabase with the fixed fixture (2 Bengaluru + 1 Mumbai) before navigating — deterministic data, matching every other spec.
  • Wait on the filtered count, not a sleep: toHaveCount(3)selectOption('#cityFilter', 'Bengaluru')toHaveCount(2). The city dropdown filters by exact match (c.city === selected), so it's fully deterministic (no fuzzy nondeterminism).
  • Hide dynamic regions before the shot (matching auditPage).
  • Renamed the screenshot to communities-filter-bengaluru.png; removed the old communities-search-bengaluru-*.png baselines and added the regenerated Linux baselines (pinned Playwright image, per CONTRIBUTING §6).

Verification

The branch's update_snapshots run passed the 3 → 2 assertions cleanly. The PR's normal CI run should now be fully green — restoring the visual check as a trustworthy gate instead of a permanent red.

🤖 Generated with Claude Code

AshwaSC and others added 3 commits July 31, 2026 13:59
The `communities search filters cards` test was the only visual check
failing on every PR. Two root causes:

1. It never stubbed Supabase (unlike every other spec, which goes through
   auditPage → stubSupabase), so it rendered LIVE prod data. As live
   communities changed, the full-page screenshot drifted and the baseline
   went stale — the failure reproduces on unchanged main.
2. It waited a fixed 500 ms after typing, racing the 200 ms-debounced
   re-render.

Fix: stub Supabase with the fixed fixture (2 Bengaluru + 1 Mumbai
community) before navigating, and replace the sleep with
`expect('.community-card').toHaveCount(2)`, which auto-retries until the
filtered re-render settles. Also hide dynamic regions before the shot,
matching auditPage.

Baseline regenerated in the pinned Playwright image (fixture render).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to the previous commit. The fuzzy search box (Fuse) returns
all 3 fixture communities for the query "bengaluru", so a search-box
count assertion can't be both meaningful and stable. Switch the test to
the city dropdown, which filters by exact match (c.city === selected),
giving a deterministic narrow from 3 → 2 cards.

- Assert toHaveCount(3) then toHaveCount(2) around selectOption — a real
  wait-for-filtered-count with no fixed sleep.
- Rename screenshot to communities-filter-bengaluru.png; remove the old
  communities-search-bengaluru-*.png baselines.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Linux baselines for the deterministic city-filter screenshot, generated
in the pinned Playwright Docker image via the Visual Regression workflow
(update_snapshots).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notf Ready Ready Preview Jul 31, 2026 9:58am

@Ashwask
Ashwask merged commit 448eeee into main Jul 31, 2026
3 checks passed
@Ashwask
Ashwask deleted the fix-communities-search-flake branch July 31, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants