Skip to content

feat: add 9 comprehensive E2E specs - #239

Open
JemimahEkong wants to merge 12 commits into
JointSave-org:mainfrom
JemimahEkong:feat/comprehensive-e2e-coverage
Open

feat: add 9 comprehensive E2E specs #239
JemimahEkong wants to merge 12 commits into
JointSave-org:mainfrom
JemimahEkong:feat/comprehensive-e2e-coverage

Conversation

@JemimahEkong

Copy link
Copy Markdown
Contributor

Summary

Adds 9 new Playwright E2E spec files covering all remaining user-facing flows
that were not previously tested. This brings total E2E coverage from 5 specs
to 14 specs across the full application lifecycle.

closes #206

What's covered

Spec Tests Flow
payout-flow.spec.ts 1 Rotational payout preview dialog + confirm with fee breakdown
withdraw-flow.spec.ts 3 Flexible withdraw with fee preview, target direct withdraw, paused pool disabled
member-management.spec.ts 3 Admin add member, admin remove member, non-admin leave pool
pause-unpause.spec.ts 3 Admin pause, admin unpause, non-admin sees disabled buttons
pool-join.spec.ts 3 Join preview + request, invalid contract shows 404, already-a-member state
notifications.spec.ts 3 Empty state, notification list with unread badge, back navigation
explore-filters.spec.ts 5 Search by name, filter by type, filter by status, empty results, pool card buttons
pool-comparison.spec.ts 4 Select via compare bar, comparison page via URL, clear selection, disabled state
dashboard-tabs.spec.ts 7 All 7 dashboard tabs render correct content

Total: 32 new test cases across 9 spec files.

How it works

All specs reuse the existing E2E seam (NEXT_PUBLIC_E2E=true), which stubs
web3 provider calls through web3-provider.tsx and useJointSaveContracts.ts.
No production application code was modified. Mocks use:

  • connectWallet / seedChainState for wallet and on-chain state
  • mockPoolsApi / makePool for pool listing and detail APIs
  • page.route for notifications, join-requests, and other API endpoints

Fixes included

  • Non-admin tests now explicitly set admin: E2E_MEMBER_2 so the connected
    wallet (E2E_ADDRESS) is correctly identified as a non-member. Previously
    the admin field defaulted to the connected wallet, making non-admin assertions
    unreliable.

Verification

  • All 9 new spec files parse successfully via TypeScript AST
  • Code follows existing spec patterns exactly (imports, selectors, assertions)
  • pnpm exec playwright test cannot be run in this environment due to OOM
    (machine has 8GB RAM total, Chromium download fails). CI will validate.

JemimahEkong and others added 9 commits August 19, 2026 15:18
Add payout-flow, withdraw-flow, member-management, pause-unpause,
pool-join, notifications, explore-filters, pool-comparison, and
dashboard-tabs spec files covering remaining user flows. Update
README coverage table to reflect 14 total specs.
…waitForLoadState

- explore-filters.spec.ts: mock /api/recommendations, add waitForLoadState
- pool-comparison.spec.ts: mock /api/recommendations, add waitForLoadState
- pool-join.spec.ts: move /api/join-requests mock to beforeEach, add waitForLoadState
- dashboard-tabs.spec.ts: mock /api/portfolio/summary, /api/analytics, Supabase REST calls, add waitForLoadState
… /api/pools

All four failing spec files (explore-filters, pool-comparison, pool-join,
dashboard-tabs) used waitForLoadState('networkidle') which is unreliable in
CI because Supabase placeholder URLs can hang and polling timers prevent idle.

Replace with page.waitForResponse() matching /api/pools responses. This waits
for the specific API call that populates the page content, making tests both
faster and deterministic.
Fix Prettier formatting violations in explore-filters, pool-comparison,
pool-join, and dashboard-tabs spec files to satisfy format:check in CI.
…ocks

- Remove all waitForResponse/waitForPools calls for /api/pools from
  explore-filters, pool-comparison, pool-join, and dashboard-tabs specs.
  The first /api/pools response comes from PoolDataProvider in the root
  layout, not from page-level components. waitForResponse resolves on
  that first response before page content renders. Playwright's
  expect().toBeVisible() auto-retry (10s timeout) handles timing correctly.

- Fix Portfolio tab test to check aria-selected attribute (same pattern
  as Transactions, Analytics, and Profile tabs) instead of fragile
  getByText matching.

- Add missing /api/admin/audit-log, /api/admin/actions, and Supabase
  REST mocks to member-management, pause-unpause, and payout-flow specs.
  Group detail page child components (AdminAuditLog, AdminActionsLog)
  make these API calls which previously went unmocked.
Add waitForPoolsResponse helper and call it after every page.goto() across
all E2E specs to eliminate timing failures where assertions run before the
mocked /api/pools data is rendered. Also:

- Convert exact-string selectors to regex for robustness (e.g. "My Groups" → /My Groups/)
- Bump Playwright expect timeout from 10s to 20s in CI to reduce flakiness
- Apply the fix to all 13 spec files (not just the 4 that were actively failing)

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…ition

The previous fix called waitForPoolsResponse AFTER page.goto() resolved,
but the /api/pools response may have already been received during navigation
so the listener never caught it. Now:

- waitForPoolsResponse returns the promise (not awaited) so callers can
  register the listener before navigation starts
- All specs: const poolsResponse = waitForPoolsResponse(page) BEFORE goto
- All goto calls: add { waitUntil: "networkidle" } for defense-in-depth
- All regex selectors: add /i flag for case-insensitive matching
- navigation.spec.ts: set up listener before each client-side link click

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…s in CI

The previous fixes (waitForPoolsResponse + networkidle) were still failing
because unmocked server-side routes like /api/notifications, /api/analytics,
/api/portfolio/summary, /api/user-profile, and /rest/v1/** were hitting
the real Next.js handlers, which try to connect to Supabase. This caused
either slow failures or hanging requests that prevented Playwright's
networkidle from ever resolving.

Add a centralized mockCommonApis() helper that catches all non-pools
API endpoints and returns safe defaults. Every spec now calls this in
beforeEach before page.goto(), eliminating the root cause of the CI
timeouts. Also removes duplicated per-spec route mocks (admin audit-log,
admin actions, rest/v1, recommendations, analytics, portfolio) that are
now handled centrally.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Sendi0011

Copy link
Copy Markdown
Contributor

Hey @JemimahEkong, the Playwright E2E tests are failing — 17 out of 27 tests fail. The root cause is that mock pool data ("Alpha Rotational" etc.) isn't rendering on the /explore page during E2E runs. The tests expect pool cards to be visible but the explore page returns empty. Can you check the test fixtures/mock data setup and make sure the explore page has pool data available during Playwright runs? Run pnpm test:e2e locally to verify before pushing.

@Sendi0011 Sendi0011 mentioned this pull request Aug 20, 2026
10 tasks
JemimahEkong and others added 3 commits August 21, 2026 13:31
- Add ReactQueryProvider to app layout for Portfolio/Analytics tabs
- Fix SelectItem empty value crash in explore page
- Seed onboarding wizard completion in connectWallet to unblock dashboard
- Add sub-path guard to mockPoolsApi to prevent intercepting /api/pools/messages
- Tighten waitForPoolsResponse to exact pathname check
- Add E2E early return to useAddPoolMember for consistent tx hash flow
- Fix strict mode violations with .first() for toast and heading selectors
- Fix CardTitle selectors to use getByText instead of getByRole(heading)
- Fix pause-unpause button selectors for strict mode
- Fix payout-flow fee breakdown text selector for strict mode
- Use channel: chrome in playwright config for system browser
… directives

The explore page was refactored to use dynamic import from explore-view.tsx
but the old ExploreContent/ExploreFallback definitions were left behind.
Also removed eslint-disable comments for rules already set to off
(no-console, react-hooks/exhaustive-deps).

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

[Feature] Add comprehensive end-to-end test coverage for wallet connection, pool creation, deposits, and payout flows using Playwright

2 participants