Proxy Mail QA

Testing sign-up emails and magic links in React Native and Expo

In React Native the hard part isn't the email, it's the link: Expo Go, a development build and the store app each open a different kind of link, and the one in the email has to match how the app is running. Here's how to test it by hand and in Detox, Appium or Maestro.

Updated

Why sign-up emails are awkward to test in React Native

Test it by hand in the simulator or emulator

  1. Create an address in Proxy Mail QA, with a persona and a generated password if your form needs them.
  2. Sign up in the app in the iOS simulator or Android emulator. Both share your computer’s clipboard.
  3. Get the code from the address’s row with Copy.
  4. Or open the link in the app. Copy it and run npx uri-scheme open '<link>' --ios (or --android), or xcrun simctl openurl booted '<link>' and adb shell "am start -W -a android.intent.action.VIEW -d '<link>'". The inbox shows the simulator and emulator commands next to app links.

Automate it with Detox

The npm client works in Detox tests:

JavaScript
import { ProxyMailQA } from 'proxymail-qa';

const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEY

it('signs up with a working magic link', async () => {
  const { address } = await qa.createAddress();
  await element(by.id('email')).typeText(address);
  const submitted = new Date();
  await element(by.id('send-link')).tap();

  const { value: link } = await qa.waitForLink(address, { type: 'magic_signin', since: submitted, app: true });
  await device.openURL({ url: link });
  await expect(element(by.id('home'))).toBeVisible();
});

For a code, qa.waitForCode(address, { since: submitted }). To check the email too, qa.checkEmail(address, { since: submitted, expectHost: 'links.example.com' }) returns what failed, with your app’s link domain as expectHost. Appium and Maestro work the same way: see Detox and Appium and Maestro.

What to check in your React Native code

Using Firebase email-link sign-in through React Native Firebase? See Firebase email-link sign-in on mobile for the native setup it needs.

Try it on your next sign-up test

Free plan, no credit card. Create an address and watch the code or link arrive.

Create a free accountOpen the app

Questions

Why does my magic link start with exp://?

Expo's Linking.createURL builds the link for how the app is running right now: exp://<your computer's address>:8081/--/path in Expo Go, and yourscheme://path in a development or store build. If you pass it as the redirect when requesting the email, the email carries the same kind of link. That's fine while developing in Expo Go, but a staging or store build must send its own scheme or an https link.

Does Proxy Mail QA find exp:// and myapp:// links?

Yes. Links with the app's own scheme are picked out of the email and classified like web links, so waiting for a verify or magic link returns them. When an email has both a web link and an app link, ask for the app one with app=true. The inbox shows app links as copy-only, with the simulator and emulator commands next to them.

Can I use the npm package in Detox?

Yes. Detox tests run in Node, so npm install --save-dev proxymail-qa and import it in your test files. It needs Node 18 or later. Keep the API key in the test run's environment, never in the app's config.

My Supabase magic link opens the app but nobody is signed in. Why?

Opening the app isn't enough: your link handler has to read the tokens or the code from the URL and create the session (with PKCE, exchangeCodeForSession). Check the handler runs for a link that launches the app, not only one that arrives while it's open.

See every email testing problem we solve