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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user