-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Common issues and solutions when working with FlutterProbe.
Cause: The token used to connect doesn't match the agent's current token. This happens when:
- The app restarted and generated a new token
- A stale token file was read
- The agent process crashed and restarted
Fix:
- Restart the app:
adb shell am force-stop <package>orxcrun simctl terminate <UDID> <bundleID> - Relaunch and let the CLI read the fresh token
- Check that no other process is connecting to the same port
Cause: Another process is bound to port 48686. Common when switching between iOS and Android testing.
Fix:
- Check what holds the port:
lsof -i :48686 - If it's an iOS app:
xcrun simctl terminate <UDID> <bundleID> - If it's a stale adb forward:
adb forward --remove tcp:48686 - Use
--port <different-port>to avoid conflicts
Cause: The agent isn't running or isn't listening on the expected port.
Fix:
- Verify the app is running with ProbeAgent enabled (
--dart-define=PROBE_AGENT=true) - Check the agent log for errors:
adb logcat | grep PROBEorxcrun simctl spawn <UDID> log show --last 30s --predicate 'eventMessage CONTAINS "PROBE"' - Verify the port matches:
--portflag must matchagent.portin probe.yaml
Cause: xcrun simctl privacy grant does not support notification permissions. The app's UNUserNotificationCenter.requestAuthorization() triggers a native dialog that blocks Flutter rendering.
Fix: Guard notification permission requests in the app:
const probeEnabled = bool.fromEnvironment('PROBE_AGENT');
if (!probeEnabled) {
await requestNotificationPermission();
}Cause: The Flutter rendering pipeline isn't active. Usually because:
- A native system dialog is covering the Flutter view
- The app hasn't finished initializing
- The app crashed during startup
Fix:
- Dismiss any system dialogs (notification, tracking, etc.)
- Add longer
waitsteps after app launch - Check app logs for crash traces
Cause: The app stores credentials in the iOS Keychain, which persists outside the app's data container.
Fix: FlutterProbe now resets the simulator Keychain during clear app data on iOS. If you still see persisted state, check if the app uses other persistence mechanisms (e.g., shared app groups, iCloud).
Cause: The CLI can't find the agent's token file. The token is written to the app container's tmp/probe/token, not the device-level tmp.
Fix:
- Verify the app is running:
xcrun simctl list devices booted - Check the container path:
xcrun simctl get_app_container <UDID> <bundleID> data - Read the token:
cat <container>/tmp/probe/token - Ensure
PROBE_AGENT=truewas passed during build
Cause: The app requests runtime permissions that trigger native Android dialogs.
Fix:
- Use
-yflag to auto-grant permissions before app launch - Or grant specific permissions:
allow permission "camera"in ProbeScript - For CI, FlutterProbe pre-grants all known permissions via
adb shell pm grant
Cause: After pm clear, the app is force-stopped. Relaunching via monkey command and reconnecting takes time.
Fix:
- Increase
--reconnect-delay(default 2s) - Increase
--token-timeoutif the app has slow initialization - Check if the app has heavy startup work (Firebase, large databases)
Cause: The text doesn't exist in the widget tree at the time of the check.
Fix:
- Add
wait until "text" appearsbeforesee "text"for dynamic content - Use
wait N secondsif the content needs time to load - Check the exact text — it's case-sensitive and must match the widget's text exactly
- Use
dump the widget treeto see what's actually rendered
Cause: Tags must be on the same line as test "name" or on the next indented line.
Fix: Correct syntax:
test "my test"
@smoke @critical
open the app
or:
test "my test" @smoke @critical
open the app
Cause: When using --format json without -o, status messages mix with JSON on stdout.
Fix: Always use -o for machine-readable output:
probe test tests/ --format json -o results.jsonCause: Video encoding happens after the session is stopped. Fetching artifacts immediately returns no video.
Fix: FlutterProbe waits 3 seconds after stopping cloud sessions before fetching artifacts. If video is still missing, increase the wait or retry artifact collection.