mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR improves email testing in the end-to-end test suite by adding a new `waitForMessagesWithSubject` helper method to the `Mailbox` class. This method replaces the previous pattern of using arbitrary wait times (e.g., `wait(2000)`) followed by fetching and finding messages, which could lead to flaky tests. The new approach implements a polling mechanism that waits until messages with the specified subject appear, with a reasonable timeout. The PR updates all email-related tests to use this new helper method, making the tests more reliable and less dependent on timing assumptions. ⏱️ Estimated Review Time: 0h 15m <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `apps/e2e/tests/helpers.ts` | | 2 | `apps/e2e/tests/backend/endpoints/api/v1/send-email.test.ts` | | 3 | `apps/e2e/tests/backend/endpoints/api/v1/unsubscribe-link.test.ts` | </details> <!-- RECURSEML_SUMMARY:END --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Improves email test reliability by adding `waitForMessagesWithSubject` in `Mailbox` and updating tests to use it. > > - **Behavior**: > - Introduces `waitForMessagesWithSubject` in `Mailbox` class in `helpers.ts` to replace arbitrary wait times with a polling mechanism. > - Updates email-related tests in `send-email.test.ts` and `unsubscribe-link.test.ts` to use `waitForMessagesWithSubject` for more reliable email verification. > - **Tests**: > - Replaces `wait()` calls with `waitForMessagesWithSubject()` in `send-email.test.ts` and `unsubscribe-link.test.ts`. > - Ensures emails are verified by subject, reducing flakiness in tests. > - **Misc**: > - Minor refactoring in `helpers.ts` to support new functionality. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for |
||
|---|---|---|
| .. | ||
| tests | ||
| .env | ||
| .env.development | ||
| .eslintrc.cjs | ||
| CHANGELOG.md | ||
| LICENSE | ||
| package.json | ||
| tsconfig.json | ||
| vitest.config.ts | ||