Detect Maestro
Detect when your app is running under Maestro automation for test-specific behavior.
Why detect Maestro?
Mobile (iOS and Android)
2
Detect the argument in your code
val isMaestro = intent.getStringExtra("isMaestro") == "true"
if (isMaestro) {
// Disable analytics or use mock data
}if ProcessInfo.processInfo.arguments.contains("isMaestro") {
// Apply test-only configurations
}import { LaunchArguments } from 'react-native-launch-arguments';
if (LaunchArguments.value().isMaestro === "true") {
// Apply test-only configurations
}import 'package:flutter_launch_arguments/flutter_launch_arguments.dart';
Future<void> getArguments() async {
final fla = FlutterLaunchArguments();
final foo = await fla.getString('foo');
final isFooEnabled = await fla.getBool('isFooEnabled');
final fooValue = await fla.getDouble('fooValue');
final fooInt = await fla.getInt('fooInt');
}Web
if (window.maestro) {
console.log("Maestro test is running!");
}Related content
Last updated