diff --git a/.changeset/lazy-mice-roll.md b/.changeset/lazy-mice-roll.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/lazy-mice-roll.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/integration/testUtils/emailService.ts b/integration/testUtils/emailService.ts index d10ffc2691..1a076c869b 100644 --- a/integration/testUtils/emailService.ts +++ b/integration/testUtils/emailService.ts @@ -5,6 +5,13 @@ type Message = { subject: string; }; +interface ErrorResponse { + message: string; + error: string; +} + +type InboxFilterResponse = { messages: Message[] } | ErrorResponse; + export const createEmailService = () => { const cleanEmail = (email: string) => { return email.replace(/\+.*@/, '@'); @@ -27,7 +34,12 @@ export const createEmailService = () => { return runWithExponentialBackOff( async () => { const res = await fetcher(url); - const json = (await res.json()) as unknown as { messages: Message[] }; + const json = (await res.json()) as InboxFilterResponse; + if ('message' in json) { + throw new Error(`Mailsac API Error: ${json.error} - ${json.message}`); + } + throw new Error(Object.keys(json).join(', ')); + const message = json.messages[0]; if (!message) { throw new Error('message not found'); diff --git a/integration/tests/email-link.test.ts b/integration/tests/email-link.test.ts index 67d029aca0..d330d07102 100644 --- a/integration/tests/email-link.test.ts +++ b/integration/tests/email-link.test.ts @@ -5,8 +5,8 @@ import type { Application } from '../models/application'; import { appConfigs } from '../presets'; import { createTestUtils } from '../testUtils'; -test.describe('sign up and sign in using email link', () => { - const configs = []; +test.describe('sign up and sign in using email link @generic', () => { + const configs = [appConfigs.next.appRouter, appConfigs.react.vite]; configs.forEach(config => { test.describe(`${config.name}`, () => { @@ -81,7 +81,7 @@ const performSignUpVerificationLinkSameDevice = async ( searchParams?: URLSearchParams, ) => { const u = createTestUtils({ app, page, context }); - const fakeUser = u.services.users.createFakeUser(); + const fakeUser = u.services.users.createFakeUser({ fictionalEmail: false, withPassword: true }); await u.po.signUp.goTo({ searchParams }); await u.po.signUp.signUpWithEmailAndPassword({ email: fakeUser.email, password: fakeUser.password }); await u.po.signUp.waitForEmailVerificationScreen(); @@ -103,7 +103,7 @@ const performSignUpVerificationLinkDifferentDevice = async ( searchParams?: URLSearchParams, ) => { const u = createTestUtils({ app, page, context, browser }); - const fakeUser = u.services.users.createFakeUser(); + const fakeUser = u.services.users.createFakeUser({ fictionalEmail: false, withPassword: true }); await u.po.signUp.goTo({ searchParams }); await u.po.signUp.signUpWithEmailAndPassword({ email: fakeUser.email, password: fakeUser.password }); await u.po.signUp.waitForEmailVerificationScreen(); diff --git a/package.json b/package.json index ab7707924c..463922eba3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test:integration:elements": "E2E_APP_ID=elements.* pnpm test:integration:base --grep @elements", "test:integration:expo-web": "E2E_APP_ID=expo.expo-web pnpm test:integration:base --grep @expo-web", "test:integration:express": "E2E_APP_ID=express.* pnpm test:integration:base --grep @express", - "test:integration:generic": "E2E_APP_ID=react.vite.*,next.appRouter.withEmailCodes* pnpm test:integration:base --grep @generic", + "test:integration:generic": "E2E_APP_ID=react.vite.*,next.appRouter.* pnpm test:integration:base --grep @generic", "test:integration:nextjs": "E2E_APP_ID=next.appRouter.* pnpm test:integration:base --grep @nextjs", "test:integration:nuxt": "E2E_APP_ID=nuxt.node npm run test:integration:base -- --grep @nuxt", "test:integration:quickstart": "E2E_APP_ID=quickstart.* pnpm test:integration:base --grep @quickstart",