Skip to content

fix: mock email/password login in E2E tests#413

Merged
maxachis merged 2 commits intodevfrom
fix/e2e-test-timeouts
Apr 13, 2026
Merged

fix: mock email/password login in E2E tests#413
maxachis merged 2 commits intodevfrom
fix/e2e-test-timeouts

Conversation

@maxachis
Copy link
Copy Markdown
Contributor

Summary

  • Adds an MSW handler for POST /auth/login that returns mock JWT tokens for valid credentials and 401 for invalid ones
  • Exports AUTH_BASE_URL from e2e/fixtures/constants.js for the new handler
  • Fixes E2E Test Timeouts #411

This eliminates the dependency on real API credentials and external API availability for auth-dependent E2E tests, addressing two failure modes:

  1. Fork PRs: GitHub Actions doesn't expose secrets to fork PRs, causing all 22+ auth-dependent tests to fail
  2. Flaky timeouts: Real signInWithPassword API calls sometimes exceed the 30s timeout

Test plan

  • npx playwright test e2e/auth/sign-in.spec.js — all 5 tests pass
  • npx playwright test e2e/data-request/create.spec.js e2e/data-source/create.spec.js — 8/9 pass (1 pre-existing flaky failure from real POST /data-requests API, not auth-related)
  • Full suite shows no regressions from these changes

🤖 Generated with Claude Code

Add MSW handler for POST /auth/login so auth-dependent E2E tests no
longer hit the real API. This fixes two issues: fork PRs failing because
GitHub Actions doesn't expose secrets, and flaky timeouts from slow
external API responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maxachis
Copy link
Copy Markdown
Contributor Author

@joshuagraber Two things!

  1. Do you think adding mocks to bypass this is a fine idea?
  2. The E2E tests were previously failing. I think we need a separate issue for that.

@joshuagraber
Copy link
Copy Markdown
Collaborator

@maxachis Yes, I think this strategy should be okay, as long as it doesn't result in any downstream effects in other e2e.

Yeah, the tests have been pretty flaky, and some of them are downright unreliable. I think a general issue to look into that would be a good idea.

Copy link
Copy Markdown
Collaborator

@joshuagraber joshuagraber left a comment

Choose a reason for hiding this comment

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

LGTM 🧪

@maxachis maxachis merged commit 58e6c42 into dev Apr 13, 2026
5 of 6 checks passed
@maxachis maxachis deleted the fix/e2e-test-timeouts branch April 13, 2026 17:52
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