Fix Stripe CDN mock override and free-plan sync guards in E2E tests

- Block real Stripe CDN (js.stripe.com) in injectMockStripe() so the
  addInitScript mock is never overwritten by the async-loaded SDK
- Replace waitForFunction(signUpWithEmail) with waitForLoadState in
  all 8 free-plan auth tests; defer scripts run before DOMContentLoaded
  so the function is guaranteed present without polling for it
This commit is contained in:
2026-05-11 09:54:55 -05:00
parent 61f006f62d
commit c6fd06b3de
2 changed files with 10 additions and 8 deletions
+2
View File
@@ -36,6 +36,8 @@ async function injectMockStripe(page: Page, opts: {
confirmResult?: { error?: { message: string } };
declineMessage?: string;
} = {}) {
// Block the real Stripe CDN so it cannot override the addInitScript mock
await page.route('https://js.stripe.com/**', (route) => route.abort());
await page.addInitScript((o) => {
(window as any).Stripe = function (_key: string) {
const confirmResult = o.declineMessage