Skip to content

fix: E2E test timeout optimizations and Windows compatibility#3

Closed
thefiredev-cloud wants to merge 2 commits intomainfrom
fix/e2e-timeout-optimizations
Closed

fix: E2E test timeout optimizations and Windows compatibility#3
thefiredev-cloud wants to merge 2 commits intomainfrom
fix/e2e-timeout-optimizations

Conversation

@thefiredev-cloud
Copy link
Copy Markdown
Owner

@thefiredev-cloud thefiredev-cloud commented Jan 29, 2026

Summary

Fixes E2E test timeout issues and improves test reliability.

Changes

  • Move county-filter.test.ts to e2e/ directory - Was using Playwright API in Vitest directory, causing API conflicts
  • Fix playwright.config.ts for Windows compatibility - Proper port handling with parseInt and cross-env
  • Reduce waitForTimeout from 2000ms to 500ms across all E2E tests
  • Add shared waitForAppReady() helper for consistent React Native Web hydration
  • Reduce visual test wait times from 1000ms to 500ms
  • Reduce global test timeout from 30s to 20s for faster CI feedback
  • Add action/navigation timeouts to catch slow pages early

Impact

  • Estimated time savings: ~60 seconds per full E2E test run
  • Fixed: Vitest no longer crashes with 'test.describe() called unexpectedly' error
  • Fixed: Windows users can now run E2E tests locally

Test Results

  • ✅ 36 test files passed (Vitest)
  • ✅ 810 tests passed
  • ⏭️ 251 tests skipped (pre-existing)

Related Issue

Addresses E2E/Visual test timeout (exceeded 30m limit) mentioned in HEARTBEAT.md


Note

Medium Risk
Medium risk because it changes protocol-search behavior (new TRPC calls and agency-name matching/fallback) and tightens Playwright timeouts, which could cause missed edge cases or flakier runs if assumptions about load/hydration timing are wrong.

Overview
Improves Playwright E2E stability/performance and Windows support, including faster hydration waits, reduced screenshot/app waits, and tighter global/action/navigation timeouts.

Updates ImageTrend app/protocol-search to honor an agency query param by resolving it to an agency ID and using an agency-scoped search for county-filtered results, with a fallback to the existing California state search when no match is found.

Adds a new Playwright spec for the county-filter flow, a small local validation script (test-county-filter.js), documents the timeout fixes, and updates .env.example with EXPO_ROUTER_APP_ROOT for Expo Router web bundling.

Written by Cursor Bugbot for commit a238fe7. This will update automatically on new commits. Configure here.

Tanner added 2 commits January 29, 2026 01:04
- Expo Router web bundling fails without EXPO_ROUTER_APP_ROOT defined
- Fixes: Error: node_modules\expo-router\_ctx.web.js:Invalid call at line 2
- Required for E2E tests and local development
- Move county-filter.test.ts to e2e/ directory (was using Playwright API in Vitest dir)
- Fix playwright.config.ts for Windows compatibility (proper port handling)
- Reduce waitForTimeout from 2000ms to 500ms across all E2E tests
- Add shared waitForAppReady() helper for consistent React Native Web hydration
- Reduce visual test wait times from 1000ms to 500ms
- Reduce global test timeout from 30s to 20s for faster CI feedback
- Add action/navigation timeouts to catch slow pages early

Estimated time savings: ~60 seconds per full E2E test run
@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 29, 2026

Deploy Preview for protocol-guide ready!

Name Link
🔨 Latest commit a238fe7
🔍 Latest deploy log https://app.netlify.com/projects/protocol-guide/deploys/697b2313980fc50008b9c57b
😎 Deploy Preview https://deploy-preview-3--protocol-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on February 1

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

{params.agency && (
<Text style={{ fontSize: 14, color: colors.primary, marginTop: 4 }}>
Agency: {params.agency}
Agency: {decodeURIComponent(params.agency.replace(/\+/g, ' '))} • County-filtered search
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled exception from decodeURIComponent in JSX render

Medium Severity

The decodeURIComponent call in the JSX render (line 269) is not wrapped in error handling. This function throws a URIError when given malformed URI sequences like %, %G, or %1. If a user navigates to a URL with a malformed agency parameter (e.g., /app/protocol-search?agency=%invalid), the component will crash during render. The same call on line 76 is safely inside a try-catch, but the render path is unprotected.

Fix in Cursor Fix in Web

Comment thread e2e/auth.spec.ts
async function waitForAppReady(page: Page) {
await page.waitForSelector('[data-reactroot], #root', { timeout: 10000 });
await page.waitForTimeout(500);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate waitForAppReady helper in multiple test files

Low Severity

The waitForAppReady helper function is duplicated with identical implementations in both e2e/auth.spec.ts and e2e/search.spec.ts. The PR description states "Created shared helper waitForAppReady() with optimized 500ms wait" but the helper is not actually shared—it's copy-pasted into each file. This should be extracted to a shared helper file (e.g., e2e/helpers/) and imported where needed.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment thread e2e/search.spec.ts
.or(page.locator('[testID="search-input"]'))
.or(page.locator('input[placeholder*="protocol"]'))
.first();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate getSearchInput helper in test files

Low Severity

The getSearchInput helper function is duplicated in e2e/search.spec.ts and e2e/visual/search.visual.spec.ts with nearly identical implementations. The PR description mentions "Added shared getSearchInput() helper" but it's not shared—it's duplicated. The version in search.spec.ts includes an additional [testID="search-input"] selector that the visual test version lacks, which could cause inconsistent behavior.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment thread test-county-filter.js
}

// Run the test
testCountyFilter(); No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orphaned debug script committed to repository

Low Severity

The test-county-filter.js file is a standalone manual test script that is not integrated into any test pipeline. It's not referenced in package.json scripts, not imported anywhere, and duplicates functionality already covered by the proper E2E tests in e2e/county-filter.spec.ts. This appears to be a debugging/development script that was accidentally committed.

Fix in Cursor Fix in Web

@thefiredev-cloud
Copy link
Copy Markdown
Owner Author

Closing - E2E timeout improvements were already merged via PR #21 (ambient light sensor) which included these changes. The wait-utils.ts and other optimizations are now in main.

thefiredev-cloud pushed a commit that referenced this pull request Feb 24, 2026
- Split 505-line stripe.ts into 5 focused handler modules:
  - checkout-handlers.ts (80 lines) - Checkout session completed handlers
  - subscription-handlers.ts (167 lines) - Subscription CRUD handlers
  - payment-handlers.ts (38 lines) - Payment success/failure handlers
  - dispute-handlers.ts (109 lines) - Dispute and customer deletion handlers
  - stripe/index.ts (8 lines) - Barrel export
- Main stripe.ts (157 lines) now handles event routing and idempotency
- All files under 500-line limit
- All 95 Stripe webhook tests passing

Test fixes:
- Updated createMockDb() helper to support select().from().where().limit() pattern
- Fixed 6 edge case tests to include select method in custom mocks
- Updated subscription-deleted test to handle dual select queries (idempotency + agency lookup)
- Updated concurrent test to use select instead of findFirst assertion

TypeScript compilation passes (pnpm check)

Sprint 20 refactoring - Split #3 of 5
thefiredev-cloud pushed a commit that referenced this pull request Apr 24, 2026
…8 CA counties

Fires 3 canonical queries (adult cardiac arrest, chest pain STEMI, pediatric
airway) against the live search.semantic tRPC procedure for each CA county,
flags counties where any query returns 0 hits.

Baseline run 2026-04-24T19:47 PT: 51/58 pass (88%). 7 failures all on
query 1 with identical 0/8/5 pattern — data-quality issue (UNK-* titles,
PAGE BREAK chunks) not coverage. Details in the design spec.

Results written to scripts/ca-county-audit-<timestamp>.json (gitignored).

Follow-up: GitHub issue for Blocker #3 (blocked by MCP + gh CLI auth
failures this session; captured in docs/superpowers/specs/).
thefiredev-cloud pushed a commit that referenced this pull request Apr 24, 2026
2026-04-24 CA county audit found 7 agencies (Marin, Fresno, Santa Clara,
Imperial, Inyo, Alpine, Del Norte) returned 0 hits for "adult cardiac
arrest" via search.semantic, despite each having 800-2478 chunks. Root
cause: their HNSW top-5 surfaced chunks with UNK-* protocol numbers +
"--- PAGE BREAK ---" titles, pushing real cardiac-arrest content below
top-N. Surface of #39 (data-quality cleanup deferred).

Short-term code fix:

server/_core/rag/scoring.ts
  advancedRerank — apply × 0.3 multiplier penalty to chunks where
    - protocol_number matches /^UNK[-_]?/
    - protocol_title contains "--- PAGE BREAK ---"
    - protocol_title matches /^[digits]+ - (?:---|policy #?N|treatment)/
  Demote (not drop) — chunks stay as fallback if nothing else ranks.
  When #39 resolves, this becomes a no-op.

server/_core/medical-synonyms.ts
  'cardiac arrest' synonyms: add 'resuscitation', 'cpr protocol', 'acls',
  'aed', 'rosc'. Widens surface so affected agencies' chunk content can
  match even when titles are junk.

tests/rag-scoring-ranking.test.ts — 4 new unit tests:
  1. UNK-prefixed chunk sinks below a real chunk even with higher similarity
  2. PAGE BREAK title sinks below a real chunk even with higher similarity
  3. UNK chunks still RETURN when nothing else matches (fallback intact)
  4. Real numeric protocol refs (e.g., "1210") are NOT demoted (no false positive)

Gates: pnpm check 0 errors, pnpm lint 0 errors, 4942/4994 tests pass
(baseline was 4938 + 4 new).

Follow-up: run scripts/ca-county-audit.mjs against prod after Railway
auto-redeploy. Baseline 51/58 (88%). Target ≥ 55/58 (95%).

Related: #39 (UNK protocol titles upstream cause), docs/superpowers/specs/
2026-04-24-build43-ux-blockers-design.md § Blocker #3.
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.

1 participant