You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add new E2E test command and update tests README
- Introduced a new command in package.json for running end-to-end tests: `test:e2e`.
- Updated the tests README to provide a comprehensive overview of included tests and their execution instructions.
- Consolidated authentication test details and added notes on the new E2E flow for better clarity and usability.
1.**Check the dev server is running** at `http://localhost:3000`
84
-
2.**Check environment variables** - ensure `.env` is properly configured
85
-
3.**Check the console output** - the tests log captured emails
86
-
4.**Run individual tests** by using `.only`:
87
-
```typescript
88
-
it.only("should verify email with valid token", async () => {
89
-
// test code
90
-
})
91
-
```
32
+
### Notes on the E2E flow
92
33
93
-
## Adding New Tests
34
+
***Email verification**: The E2E test marks the user as verified **directly in the database**for determinism and to avoid email parsing.
35
+
***Polar sandbox**: The test**does not** hit Polar's network. Instead, it **simulates** Polar webhook events by invoking `polarWebhookHandlers` directly, and **mocks** `~/server/polar` to avoid SDK calls (e.g., invoice generation).
36
+
* **Checkout URL test (optional)**: If `PLANS.pro.polarProductId` (derived from your Polar product env vars) is set, the test attempts to start checkout and asserts that a URL is returned. If not configured, it is skipped gracefully.
94
37
95
-
When adding new auth features, add corresponding tests:
38
+
If you prefer real end‑to‑end payment interactions with Polar sandbox:
1. Set your `POLAR_*` env vars (access token, org, product IDs).
41
+
2. Disable the `vi.mock('~/server/polar', ...)` in the E2E test and point webhooks to your local app (e.g., via `ngrok` or the included Cloudflare tunnel profile).
42
+
3. Ensure webhook signatures are properly configured.
0 commit comments