NativeAutomator class

Provides functionality to interact with the OS that the app under test is running on.

Communicates over http with the native automation server running on the target device.

Constructors

NativeAutomator({required NativeAutomatorConfig config})
Creates a new NativeAutomator.

Properties

hashCode int
The hash code for this object.
no setterinherited
resolvedAppId String
Returns the platform-dependent unique identifier of the app under test.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

closeHeadsUpNotification() Future<void>
Closes the currently visible heads up notification (iOS only).
closeNotifications() Future<void>
Closes the notification shade.
configure() Future<void>
Configures the native automator.
denyPermission() Future<void>
Denies the permission that the currently visible native permission request dialog is asking for.
disableAirplaneMode() Future<void>
Enables airplane mode.
disableBluetooth() Future<void>
Disables bluetooth.
disableCellular() Future<void>
Disables cellular (aka mobile data connection).
disableDarkMode({String? appId}) Future<void>
Disables dark mode.
disableWifi() Future<void>
Disables Wi-Fi.
doubleTap(Selector selector, {String? appId, Duration? timeout}) Future<void>
Double taps on the native view specified by selector.
enableAirplaneMode() Future<void>
Enables airplane mode.
enableBluetooth() Future<void>
Enables bluetooth.
enableCellular() Future<void>
Enables cellular (aka mobile data connection).
enableDarkMode({String? appId}) Future<void>
Enables dark mode.
enableWifi() Future<void>
Enables Wi-Fi.
enterText(Selector selector, {required String text, String? appId, KeyboardBehavior? keyboardBehavior, Duration? timeout}) Future<void>
Enters text to the native view specified by selector.
enterTextByIndex(String text, {required int index, String? appId, KeyboardBehavior? keyboardBehavior, Duration? timeout}) Future<void>
Enters text to the index-th visible text field.
getFirstNotification() Future<Notification>
Returns the first, topmost visible notification.
getNativeViews(Selector selector, {String? appId}) Future<List<NativeView>>
Returns a list of currently visible native UI controls, specified by selector, which are currently visible on screen.
getNotifications() Future<List<Notification>>
Returns notifications that are visible in the notification shade.
grantPermissionOnlyThisTime() Future<void>
Grants the permission that the currently visible native permission request dialog is asking for.
grantPermissionWhenInUse() Future<void>
Grants the permission that the currently visible native permission request dialog is asking for.
initialize() Future<void>
Initializes the native automator.
isPermissionDialogVisible({Duration timeout = const Duration(seconds: 1)}) Future<bool>
Waits until a native permission request dialog becomes visible within timeout.
markPatrolAppServiceReady() Future<void>
Tells the AndroidJUnitRunner that PatrolAppService is ready to answer requests about the structure of Dart tests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openApp({String? appId}) Future<void>
Opens the app specified by appId. If appId is null, then the app under test is started (using resolvedAppId).
openNotifications() Future<void>
Opens the notification shade.
openQuickSettings() Future<void>
Opens the quick settings shade on Android and Control Center on iOS.
pressBack() Future<void>
Presses the back button.
pressDoubleRecentApps() Future<void>
Double presses the recent apps button.
pressHome() Future<void>
Presses the home button.
pressRecentApps() Future<void>
Presses the recent apps button.
selectCoarseLocation() Future<void>
Select the "coarse location" (aka "approximate") setting on the currently visible native permission request dialog.
selectFineLocation() Future<void>
Select the "fine location" (aka "precise") setting on the currently visible native permission request dialog.
swipe({required Offset from, required Offset to, int steps = 12, String? appId}) Future<void>
Swipes from from to to.
tap(Selector selector, {String? appId, Duration? timeout}) Future<void>
Taps on the native view specified by selector.
tapAt(Offset location, {String? appId}) Future<void>
Taps at a given location.
tapOnNotificationByIndex(int index, {Duration? timeout}) Future<void>
Searches for the index-th visible notification and taps on it.
tapOnNotificationBySelector(Selector selector, {Duration? timeout}) Future<void>
Taps on the visible notification using selector.
toString() String
A string representation of this object.
inherited
waitUntilVisible(Selector selector, {String? appId, Duration? timeout}) Future<void>
Waits until the native view specified by selector becomes visible. It waits for the view to become visible for timeout duration. If timeout is not specified, it utilizes the NativeAutomatorConfig.findTimeout.

Operators

operator ==(Object other) bool
The equality operator.
inherited