Proxy Mail QA

Testing sign-up emails in a Flutter app

One Flutter codebase, two platforms, two ways for a link to open the app. Test the code and the link on both: by hand in the simulator and emulator, or in an integration test that reads the email itself.

Updated

Why sign-up emails are awkward to test in Flutter

  • Two platforms, two link systems. A verify link opens the app through Universal Links on iOS and App Links on Android, and each has its own setup that can be wrong on its own.
  • Tests can’t read email. There’s no inbox in the simulator or emulator worth using, and widget tests block the network anyway.
  • Two things may be listening for links. Flutter’s own deep linking and a plugin such as app_links can both claim the same link.
  • Single-use links break if anything opens them first. Proxy Mail QA never opens or prefetches a link.

Test it by hand

  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 on 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: xcrun simctl openurl booted '<link>' on iOS, or adb shell "am start -W -a android.intent.action.VIEW -d '<link>'" on Android. For a myapp:// link the inbox shows both commands next to it.

Automate it with integration_test

Add the Dart helper from the Flutter guide to integration_test/. It only uses dart:io and dart:convert, so the one dev dependency is Flutter’s own integration_test:

Dart
final qa = ProxyMailQA();
final account = await qa.createAddress();
app.main();
await tester.pumpAndSettle();

final submitted = DateTime.now();
await tester.enterText(find.byKey(const Key('email')), account.address);
await tester.enterText(find.byKey(const Key('password')), account.password!);
await tester.tap(find.text('Sign up'));
await tester.pumpAndSettle();

final code = await qa.waitForCode(account.address, submitted);
await tester.enterText(find.byKey(const Key('code')), code);

Run it with flutter test integration_test --dart-define=PROXYMAIL_QA_API_KEY=$PROXYMAIL_QA_API_KEY. For links, qa.waitForLink(account.address, submitted) returns the link; add app: true for the myapp:// one when the email has both.

The same helper checks the email itself (checkEmail with your app’s link domain, and countEmails for duplicates), signs in as a saved test account, and adds each test to the pull request’s report: see the Flutter guide.

What to check in your Flutter code

  • The email field leaves the address alone. keyboardType: TextInputType.emailAddress, autocorrect: false and autofillHints: [AutofillHints.email].
  • The code field offers AutoFill. autofillHints: [AutofillHints.oneTimeCode].
  • Only one thing handles links. Use Flutter’s built-in deep linking with go_router, or a plugin such as app_links, not both. If you use a plugin, turn Flutter’s off: FlutterDeepLinkingEnabled set to NO in Info.plist, and flutter_deeplinking_enabled set to false in AndroidManifest.xml.
  • Cold-start links work on both platforms. Close the app, open the link, and check it lands on the right screen on iOS and on Android.
  • Supabase redirects open the app. Pass emailRedirectTo: 'com.example.myapp://login-callback/' (your own scheme), add it to Redirect URLs in Supabase, and register the scheme on both platforms.
  • Links don’t point at your computer. The Android emulator reaches your computer at 10.0.2.2, not localhost. See links that point at localhost.

Using Firebase email-link sign-in with firebase_auth? It needs Associated Domains and App Links for your Hosting domain: see Firebase email-link sign-in on mobile.

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 test get a 400 when it calls the API?

Plain widget tests (flutter test test/) block real network requests and answer every one with a 400. Run the sign-up test as an integration test, from the integration_test folder, on a simulator, emulator or device, where requests go out normally.

Can a Flutter test open the link from the email?

A widget or integration test can't open a link the way the phone would. Open it from your computer (xcrun simctl openurl booted or adb shell am start), use Maestro's openLink, or use Patrol, which can drive the phone from a Flutter test.

My Supabase magic link opens the app but nothing happens. Why?

supabase_flutter handles the link when the app opens, as long as the scheme in emailRedirectTo is set up as a deep link on both platforms and listed under Redirect URLs in Supabase. If another plugin also handles links, make sure it doesn't swallow the link first.

Where does the API key go?

Pass it to the test run with --dart-define=PROXYMAIL_QA_API_KEY=… from your shell or CI secrets. Never add it to the app's own configuration.

See every email testing problem we solve