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

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

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