Conversation
WalkthroughAdds a new Playwright E2E test file for the Community pages, covering Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
frontend/__tests__/e2e/pages/Community.spec.ts (2)
25-26: Replace fixed sleeps with deterministic load synchronization.
waitForTimeout(1000)introduces avoidable flakiness. Prefer a deterministic wait (e.g., load state or specific UI/network condition) before asserting console error count.♻️ Proposed change
- await page.waitForTimeout(1000) + await page.waitForLoadState('networkidle') expect(errors).toHaveLength(0) ... - await page.waitForTimeout(1000) + await page.waitForLoadState('networkidle') expect(errors).toHaveLength(0)Also applies to: 51-52
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/e2e/pages/Community.spec.ts` around lines 25 - 26, Replace the fixed sleep (await page.waitForTimeout(1000)) with a deterministic wait to avoid flakiness: wait for a reliable condition such as page.waitForLoadState('networkidle') or a specific UI element via page.waitForSelector(...) that indicates the page finished loading, or use page.waitForFunction(...) to poll until the errors array/variable stabilizes (e.g., errors.length === 0). Update both occurrences around the checks that use expect(errors).toHaveLength(0) so the assertion runs only after the deterministic readiness condition instead of a fixed timeout.
88-98: Avoid stacking duplicate GraphQL route handlers; make override explicit.The same
**/graphql/mock is duplicated, and Line 109-Line 119 adds another handler on top of thebeforeEachone. This makes handler precedence implicit and harder to reason about. Extract a helper and callpage.unroutebefore redefining in the empty-state test.♻️ Proposed refactor
+const mockSnapshotsQuery = async (page, snapshots = mockSnapshots) => { + await page.unroute('**/graphql/') + await page.route('**/graphql/', async (route) => { + await route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ data: { snapshots } }), + }) + }) +} ... - await page.route('**/graphql/', async (route) => { - await route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ - data: { - snapshots: mockSnapshots, - }, - }), - }) - }) + await mockSnapshotsQuery(page, mockSnapshots) ... - await page.route('**/graphql/', async (route) => { - await route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ - data: { - snapshots: [], - }, - }), - }) - }) + await mockSnapshotsQuery(page, [])Also applies to: 109-119, 38-48
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/__tests__/e2e/pages/Community.spec.ts` around lines 88 - 98, The test suite registers duplicate GraphQL route handlers via page.route('**/graphql/') in beforeEach and again in the empty-state test, making precedence implicit; update tests to explicitly unroute before redefining and extract a helper to register the mock: call page.unroute('**/graphql/') at start of the empty-state test (or any test that needs a different handler), then use a shared helper function (e.g., registerGraphQLMock(page, responsePayload) or setupGraphQLMock) to call page.route with the JSON response; also refactor the beforeEach to use that helper so all handlers are created consistently and overrides are explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/__tests__/e2e/pages/Community.spec.ts`:
- Around line 25-26: Replace the fixed sleep (await page.waitForTimeout(1000))
with a deterministic wait to avoid flakiness: wait for a reliable condition such
as page.waitForLoadState('networkidle') or a specific UI element via
page.waitForSelector(...) that indicates the page finished loading, or use
page.waitForFunction(...) to poll until the errors array/variable stabilizes
(e.g., errors.length === 0). Update both occurrences around the checks that use
expect(errors).toHaveLength(0) so the assertion runs only after the
deterministic readiness condition instead of a fixed timeout.
- Around line 88-98: The test suite registers duplicate GraphQL route handlers
via page.route('**/graphql/') in beforeEach and again in the empty-state test,
making precedence implicit; update tests to explicitly unroute before redefining
and extract a helper to register the mock: call page.unroute('**/graphql/') at
start of the empty-state test (or any test that needs a different handler), then
use a shared helper function (e.g., registerGraphQLMock(page, responsePayload)
or setupGraphQLMock) to call page.route with the JSON response; also refactor
the beforeEach to use that helper so all handlers are created consistently and
overrides are explicit.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eabcaa56-9020-416c-b26e-2c82a8f0974e
📒 Files selected for processing (1)
frontend/__tests__/e2e/pages/Community.spec.ts



Resolves #4403
Add Playwright smoke tests for the /community and /community/snapshots pages.
Verifies both routes load successfully
Confirms main heading/title is present
Checks that no console errors are emitted during page load
This is a minimal smoke test update for route coverage only.
Checklist
make check-testlocally: all warnings addressed, tests passed