### Start PatrolAppService gRPC Server Source: https://pub.dev/documentation/patrol/latest/patrol/runAppService.html Starts the gRPC server that runs the PatrolAppService. Ensure PatrolAppService is properly initialized before calling this function. ```dart Future runAppService(PatrolAppService service) async { final pipeline = const shelf.Pipeline() .addMiddleware(shelf.logRequests()) .addHandler(service.handle); final server = await shelf_io.serve( pipeline, InternetAddress.anyIPv4, service.port, poweredByHeader: null, ); server.idleTimeout = _idleTimeout; final address = server.address; print( 'PatrolAppService started, address: ${address.address}, host: ${address.host}, port: ${server.port}', ); } ``` -------------------------------- ### Open App Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator2/openApp.html Opens the app specified by `appId`. If `appId` is null, then the app under test is started. ```APIDOC ## POST /app/open ### Description Opens the app specified by `appId`. If `appId` is null, then the app under test is started (using resolvedAppId). On Android `appId` is the package name. On iOS `appId` is the bundle name. ### Method POST ### Endpoint /app/open ### Parameters #### Request Body - **appId** (String) - Optional - The ID of the application to open. On Android, this is the package name. On iOS, this is the bundle name. If null, the app under test is launched. ``` -------------------------------- ### Implement initServiceExtensions Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding/initServiceExtensions.html This is an example implementation of the `initServiceExtensions` method. It calls the superclass method and then registers a specific service extension named 'patrol.getNativeUITree'. ```dart @override void initServiceExtensions() { super.initServiceExtensions(); logger('Register Patrol service extensions'); registerServiceExtension( name: 'patrol.getNativeUITree', callback: _serviceExtensions.getNativeUITree, ); } ``` -------------------------------- ### Singleton Service Provision with initInstances Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding/initInstances.html Example of how to provide a service as a singleton by exposing it as a static getter and field. Ensure to use BindingBase.checkInstance for robust instance checking. ```dart mixin BazBinding on BindingBase { @override void initInstances() { super.initInstances(); _instance = this; // ...binding initialization... } static BazBinding get instance => BindingBase.checkInstance(_instance); static BazBinding? _instance; // ...binding features... } ``` -------------------------------- ### runAppService Function Source: https://pub.dev/documentation/patrol/latest/patrol/runAppService.html Starts the gRPC server that runs the PatrolAppService. ```APIDOC ## runAppService Function ### Description Starts the gRPC server that runs the PatrolAppService. ### Method N/A (This is a function implementation, not an HTTP endpoint) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Implementation Details This function takes a `PatrolAppService` instance and starts a shelf server on any IPv4 address and the specified service port. It includes request logging and sets an idle timeout for the server. ``` -------------------------------- ### patrolSetUp Function Source: https://pub.dev/documentation/patrol/latest/patrol/patrolSetUp.html The patrolSetUp function is designed to integrate with Patrol's native automation capabilities, providing a modified setUp mechanism for tests. ```APIDOC ## patrolSetUp Function ### Description A modification of `setUp` that works with Patrol's native automation. ### Method N/A (This is a function definition, not an API endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## Implementation ```dart void patrolSetUp(dynamic Function() body) { setUp(() async { if (constants.hotRestartEnabled) { await body(); return; } final currentTest = global_state.currentTestFullName; final requestedToExecute = await PatrolBinding.instance.patrolAppService .waitForExecutionRequest(currentTest); if (requestedToExecute) { await body(); } }); } ``` ``` -------------------------------- ### Implement openApp Method Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/openApp.html Opens the app specified by `appId`. If `appId` is null, then the app under test is started. On Android `appId` is the package name. On iOS `appId` is the bundle name. ```dart Future openApp({String? appId}) { return platform.action.mobile( android: () => platform.android.openApp(appId: appId), ios: () => platform.ios.openApp(appId: appId), ); } ``` -------------------------------- ### Get All Candidates from Finder Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolFinder/allCandidates.html Returns all elements that will be considered by this finder. This implementation delegates to an internal finder. ```dart @override Iterable get allCandidates => finder.allCandidates; ``` -------------------------------- ### Implement patrolSetUp Function Source: https://pub.dev/documentation/patrol/latest/patrol/patrolSetUp.html Use this function to conditionally execute setup logic within Patrol tests. It checks if hot restart is enabled or if the test explicitly requests execution. ```dart void patrolSetUp(dynamic Function() body) { setUp(() async { if (constants.hotRestartEnabled) { await body(); return; } final currentTest = global_state.currentTestFullName; final requestedToExecute = await PatrolBinding.instance.patrolAppService .waitForExecutionRequest(currentTest); if (requestedToExecute) { await body(); } }); } ``` -------------------------------- ### Example Usage of swipeBack Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/swipeBack.html Demonstrates how to use the swipeBack method with and without specifying the vertical offset. The default offset is the center of the screen. ```dart await tester.swipeBack(dy: 0.8); // Swipe back at 1/5 height of the screen ``` ```dart await tester.swipeBack(); // Swipe back at the center of the screen ``` -------------------------------- ### Patrol Test Example: Custom Finders Source: https://pub.dev/documentation/patrol/latest/index.html Illustrates the use of Patrol's custom finders for entering text, locating widgets by key and text, and chaining finders for complex selections. Also shows how to find scrollable widgets with specific descendants. ```dart import 'package:example/main.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:patrol/patrol.dart'; void main() { patrolTest( 'logs in successfully', ($) async { await $.pumpWidgetAndSettle(const MyApp()); await $(#emailInput).enterText('user@leancode.co'); await $(#passwordInput).enterText('ny4ncat'); // Finds all widgets with text 'Log in' which are descendants of widgets with key // box1, which are descendants of a Scaffold widget and tap on the first one. await $(Scaffold).$(#box1).$('Log in').tap(); // Finds all Scrollables which have Text descendant $(Scrollable).containing(Text); // Finds all Scrollables which have a Button descendant which has a Text descendant $(Scrollable).containing($(Button).containing(Text)); // Finds all Scrollables which have a Button descendant and a Text descendant $(Scrollable).containing(Button).containing(Text); }, ); } ``` -------------------------------- ### Create Default PlatformAutomatorConfig Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformAutomatorConfig/PlatformAutomatorConfig.defaultConfig.html Use this factory constructor to create a PlatformAutomatorConfig instance suitable for test setup. It initializes with default configurations for Android, iOS, and Web. ```dart factory PlatformAutomatorConfig.defaultConfig() { return PlatformAutomatorConfig( androidConfig: const AndroidAutomatorConfig(), iosConfig: const IOSAutomatorConfig(), webConfig: const WebAutomatorConfig(), ); } ``` -------------------------------- ### Implement openQuickSettings Method Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/openQuickSettings.html This method opens the quick settings shade on Android and Control Center on iOS. It does not work on iOS Simulator. Uses platform-specific actions for Android and iOS. ```dart Future openQuickSettings() { return platform.action.mobile( android: platform.android.openQuickSettings, ios: platform.ios.openQuickSettings, ); } ``` -------------------------------- ### Get PlatformAutomator Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolIntegrationTester/platform.html Shorthand for accessing the platformAutomator instance. ```dart PlatformAutomator get platform => platformAutomator; ``` -------------------------------- ### Implement openQuickSettings Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator/openQuickSettings.html This method opens the quick settings shade on Android and Control Center on iOS. It relies on the _platform.mobile.openQuickSettings() implementation. Note that it does not work on the iOS Simulator. ```dart Future openQuickSettings() => _platform.mobile.openQuickSettings(); ``` -------------------------------- ### Usage Example of createFinder with PatrolTester.call Source: https://pub.dev/documentation/patrol/latest/patrol/createFinder.html Demonstrates how createFinder is used internally by PatrolTester.call and PatrolFinder.$ to interact with UI elements. This is the typical way you'll use finder functionality in your tests. ```dart patrolTest( 'increase counter text', ($) async { // calls createFinder method under the hood await $(Scaffold).$(#passwordTextField).enterText('my password'); }, ); ``` -------------------------------- ### openQuickSettings Method Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/openQuickSettings.html Opens the quick settings shade on Android and Control Center on iOS. This method does not work on the iOS Simulator. ```APIDOC ## openQuickSettings ### Description Opens the quick settings shade on Android and Control Center on iOS. This method is not functional on the iOS Simulator as Control Center is unavailable. ### Method `Future` ### Endpoint N/A (This is a method call, not an HTTP endpoint) ### Parameters None ### Request Example N/A ### Response N/A (This method returns void) ### See Also * developer.android.com/reference/androidx/test/uiautomator/UiDevice#openquicksettings (for Android implementation reference) ``` -------------------------------- ### PlatformAutomatorConfig.defaultConfig Factory Constructor Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformAutomatorConfig/PlatformAutomatorConfig.defaultConfig.html This factory constructor creates a new PlatformAutomatorConfig instance with default configurations suitable for test setups. It initializes Android, iOS, and Web configurations with their respective default settings. ```APIDOC ## PlatformAutomatorConfig.defaultConfig() ### Description Creates a new PlatformAutomatorConfig suitable for test setup. ### Method Factory Constructor ### Endpoint N/A (Class Constructor) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **PlatformAutomatorConfig** (object) - An instance of PlatformAutomatorConfig with default settings. #### Response Example ```json { "androidConfig": { "someAndroidField": "defaultValue" }, "iosConfig": { "someIosField": "defaultValue" }, "webConfig": { "someWebField": "defaultValue" } } ``` ### Implementation Details ```dart factory PlatformAutomatorConfig.defaultConfig() { return PlatformAutomatorConfig( androidConfig: const AndroidAutomatorConfig(), iosConfig: const IOSAutomatorConfig(), webConfig: const WebAutomatorConfig(), ); } ``` ``` -------------------------------- ### Get iOS Selector Source: https://pub.dev/documentation/patrol/latest/patrol/CompoundSelector/ios.html Retrieves the iOS-specific selector for a property. ```APIDOC ## GET /websites/pub_dev/ios_property ### Description Returns the iOS-specific selector for a property. ### Method GET ### Endpoint /websites/pub_dev/ios_property ### Parameters #### Query Parameters - **ios** (IOSSelector) - Required - The iOS selector to retrieve. ### Response #### Success Response (200) - **ios** (IOSSelector) - The iOS-specific selector. ``` -------------------------------- ### Get Android Selector Source: https://pub.dev/documentation/patrol/latest/patrol/AndroidSelector/android.html Returns the Android-specific selector. This is an override implementation. ```dart @override contracts.AndroidSelector get android => this; ``` -------------------------------- ### Stop Mock Location Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/stopMockLocation.html Stops the mock location updates that were started by setMockLocation. ```APIDOC ## POST /stopMockLocation ### Description Stops the mock location updates that were started by setMockLocation. ### Method POST ### Endpoint /stopMockLocation ### Parameters None ### Request Body None ### Request Example None ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example { "status": "success" } ``` -------------------------------- ### Initialization and Service Extensions Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding-class.html APIs for initializing the binding and registering service extensions. ```APIDOC ## POST /api/binding/initialization-complete ### Description Alert the engine that the binding is registered. This instructs the engine to register its top level window handler on Windows. This signals that the app is able to process "System.requestAppExit" signals from the engine. ### Method POST ### Endpoint /api/binding/initialization-complete ### Parameters None ### Request Example {} ### Response #### Success Response (200) - **status** (string) - Indicates initialization is complete. #### Response Example { "status": "initialization_complete" } ``` ```APIDOC ## POST /api/binding/init-instances ### Description The initialization method. Subclasses override this method to hook into the platform and otherwise configure their services. Subclasses must call "super.initInstances()". ### Method POST ### Endpoint /api/binding/init-instances ### Parameters None ### Request Example {} ### Response #### Success Response (200) - **status** (string) - Indicates instances were initialized. #### Response Example { "status": "instances_initialized" } ``` ```APIDOC ## POST /api/binding/init-service-extensions ### Description Called when the binding is initialized, to register service extensions. ### Method POST ### Endpoint /api/binding/init-service-extensions ### Parameters None ### Request Example {} ### Response #### Success Response (200) - **status** (string) - Indicates service extensions were initialized. #### Response Example { "status": "service_extensions_initialized" } ``` -------------------------------- ### initAppService Function Source: https://pub.dev/documentation/patrol/latest/patrol/initAppService.html Initializes the app service. This is a no-operation for IO environments. ```APIDOC ## initAppService Function ### Description Initializes the app service. This function is a no-operation for IO environments. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ### Implementation Example ```dart Future initAppService() async { // No-op for IO. } ``` ``` -------------------------------- ### Get iOS Selector Source: https://pub.dev/documentation/patrol/latest/patrol/IOSSelector/ios.html Returns the iOS-specific selector. This is an override of a base property. ```dart @override contracts.IOSSelector get ios => this; ``` -------------------------------- ### Get Web Selector Source: https://pub.dev/documentation/patrol/latest/patrol/CompoundSelector/web.html Retrieves the Web-specific selector for the current web property. ```APIDOC ## Get Web Selector ### Description Returns the Web-specific selector. ### Method GET ### Endpoint /websites/pub_dev/web_property ### Parameters #### Query Parameters - **web** (WebSelector) - Required - The WebSelector object to retrieve. ### Response #### Success Response (200) - **web_selector** (WebSelector) - The Web-specific selector. ``` -------------------------------- ### Quick Settings API Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator2-class.html APIs for interacting with quick settings. ```APIDOC ## POST /settings/quickSettings/open ### Description Opens the quick settings shade on Android and Control Center on iOS. ### Method POST ### Endpoint /settings/quickSettings/open ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Get iOS Selector Source: https://pub.dev/documentation/patrol/latest/patrol/CompoundSelector/ios.html Retrieves the iOS-specific selector. This is part of the contracts API. ```java contracts.IOSSelector get ios; ``` -------------------------------- ### PlatformAction Constructor Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformAction/PlatformAction.html Details on how to instantiate the PlatformAction class. ```APIDOC ## PlatformAction Constructor ### Description Initializes a new instance of the PlatformAction class. ### Method constructor ### Endpoint N/A (Class constructor) ### Parameters This constructor does not accept any parameters. ### Request Example ```javascript const action = new PlatformAction(); ``` ### Response N/A (Constructors do not return values in the traditional sense; they initialize an object.) ``` -------------------------------- ### Reassemble Application Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding-class.html Causes the entire application to redraw, for example, after a hot reload. ```APIDOC ## reassembleApplication ### Description Cause the entire application to redraw, e.g. after a hot reload. ### Method (Inherited) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Future** - A future that completes when the application has been redrawn. #### Response Example None ``` -------------------------------- ### Image Codec Instantiation Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding-class.html API for instantiating an image codec from a buffer. ```APIDOC ## POST /api/image/instantiate-codec ### Description Calls through to dart:ui.instantiateImageCodecFromBuffer from ImageCache. ### Method POST ### Endpoint /api/image/instantiate-codec ### Parameters #### Request Body - **buffer** (ImmutableBuffer) - Required - The buffer containing image data. - **cacheWidth** (integer) - Optional - The desired width for caching. - **cacheHeight** (integer) - Optional - The desired height for caching. - **allowUpscaling** (boolean) - Optional - Whether to allow upscaling, defaults to false. ### Request Example { "buffer": "some_immutable_buffer_data", "cacheWidth": 100, "cacheHeight": 100, "allowUpscaling": true } ### Response #### Success Response (200) - **codec** (Codec) - The instantiated image codec. #### Response Example { "codec": "some_codec_object" } ``` -------------------------------- ### Implement enableWifi Method Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator/enableWifi.html This method enables Wi-Fi. It requires a platform implementation to be available. ```dart Future enableWifi() => _platform.mobile.enableWifi(); ``` -------------------------------- ### Get Web Selector Implementation Source: https://pub.dev/documentation/patrol/latest/patrol/WebSelector/web.html Returns the Web-specific selector. This is an override of a base method. ```dart @override web_selector.WebSelector get web => this; ``` -------------------------------- ### Get Resolved App ID Source: https://pub.dev/documentation/patrol/latest/patrol/MobileAutomator/resolvedAppId.html Retrieves the platform-dependent unique identifier of the app under test. ```APIDOC ## GET /resolvedAppId ### Description Returns the platform-dependent unique identifier of the app under test. ### Method GET ### Endpoint /resolvedAppId ### Parameters None ### Request Body None ### Response #### Success Response (200) - **resolvedAppId** (String) - The unique identifier of the app under test. #### Response Example ```json { "resolvedAppId": "com.example.app" } ``` ``` -------------------------------- ### Get Web Selector Source: https://pub.dev/documentation/patrol/latest/patrol/CompoundSelector/web.html Returns the Web-specific selector. This is part of the implementation for web properties. ```Java web_selector.WebSelector get web; ``` -------------------------------- ### PlatformAutomatorConfig.fromOptions Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformAutomatorConfig/PlatformAutomatorConfig.fromOptions.html Creates a new PlatformAutomatorConfig from individual options, allowing for detailed configuration of Android, iOS, and Web automator settings. ```APIDOC ## PlatformAutomatorConfig.fromOptions constructor ### Description Creates a new PlatformAutomatorConfig from individual options. ### Method factory ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A ### Implementation Details #### Parameters - **iosInstalledApps** (String?) - Optional - Apps installed on the iOS simulator. This is needed for purpose of native view inspection in the Patrol DevTools extension. - **connectionTimeout** (Duration?) - Optional - Time after which the connection with the native automator will fail. It must be longer than `findTimeout`. - **findTimeout** (Duration?) - Optional - Time to wait for native views to appear. - **keyboardBehavior** (KeyboardBehavior?) - Optional - How the keyboard should behave when entering text. See [KeyboardBehavior] to learn more. - **packageName** (String?) - Optional - Package name of the application under test. Android only. - **bundleId** (String?) - Optional - Bundle identifier name of the application under test. iOS only. - **androidAppName** (String?) - Optional - Name of the application under test on Android. - **iosAppName** (String?) - Optional - Name of the application under test on iOS. - **logger** (void Function(String)?) - Optional - Called when a native action is performed. ### Example Usage ```dart final config = PlatformAutomatorConfig.fromOptions( packageName: 'com.example.app', iosAppName: 'ExampleApp', connectionTimeout: Duration(seconds: 30), ); ``` ``` -------------------------------- ### Get Android Selector Source: https://pub.dev/documentation/patrol/latest/patrol/CompoundSelector/android.html Retrieves the Android-specific selector. This is used to access Android-related properties. ```java contracts.AndroidSelector get android; ``` -------------------------------- ### Add Patrol to Project Source: https://pub.dev/documentation/patrol/latest/index.html Installs the Patrol package as a development dependency in your Flutter project. ```bash $ dart pub add patrol --dev ``` -------------------------------- ### Basic initInstances Implementation Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding/initInstances.html A minimal implementation of the initInstances method, ensuring to call the superclass method and assign the instance. ```dart @override void initInstances() { super.initInstances(); _instance = this; } ``` -------------------------------- ### Implement pressHome Method Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator/pressHome.html This method calls the platform-specific implementation for pressing the home button. Ensure the mobile platform is correctly initialized. ```dart Future pressHome() => _platform.mobile.pressHome(); ``` -------------------------------- ### Get resolvedAppId Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator/resolvedAppId.html Returns the platform-dependent unique identifier of the app under test. This is part of the implementation details. ```dart String get resolvedAppId => _platform.mobile.resolvedAppId; ``` -------------------------------- ### Implement openUrl Method Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator/openUrl.html This snippet shows the implementation of the openUrl method, which delegates the URL opening task to the platform's mobile interface. Ensure the `_platform` object is correctly initialized. ```dart Future openUrl(String url) => _platform.mobile.openUrl(url); ``` -------------------------------- ### Get Android Selector Source: https://pub.dev/documentation/patrol/latest/patrol/MobileSelector/android.html Returns the Android-specific selector. Throws an UnsupportedError if the Android selector is not provided. ```dart @override AndroidSelector get android => _android ?? (throw UnsupportedError('Android selector not provided')); ``` -------------------------------- ### PlatformAutomatorConfig Constructors Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformAutomatorConfig-class.html Details on how to create instances of PlatformAutomatorConfig. ```APIDOC ## PlatformAutomatorConfig Constructors ### PlatformAutomatorConfig Creates a new PlatformAutomatorConfig. #### Parameters - **androidConfig** (AndroidAutomatorConfig?) - Optional - Configuration for Android platform. - **iosConfig** (IOSAutomatorConfig?) - Optional - Configuration for iOS platform. - **webConfig** (WebAutomatorConfig?) - Optional - Configuration for Web platform. ### PlatformAutomatorConfig.defaultConfig Creates a new PlatformAutomatorConfig suitable for test setup. ### PlatformAutomatorConfig.fromOptions Creates a new PlatformAutomatorConfig from individual options. #### Parameters - **iosInstalledApps** (String?) - Optional - - **connectionTimeout** (Duration?) - Optional - - **findTimeout** (Duration?) - Optional - - **keyboardBehavior** (KeyboardBehavior?) - Optional - - **packageName** (String?) - Optional - - **bundleId** (String?) - Optional - - **androidAppName** (String?) - Optional - - **iosAppName** (String?) - Optional - - **logger** (void Function(String)?) - Optional - ``` -------------------------------- ### Get iOS Selector Source: https://pub.dev/documentation/patrol/latest/patrol/MobileSelector/ios.html Returns the iOS-specific selector. Throws an UnsupportedError if the iOS selector is not provided. ```dart @override IOSSelector get ios => _ios ?? (throw UnsupportedError('iOS selector not provided')); ``` -------------------------------- ### pressVolumeUp Method Source: https://pub.dev/documentation/patrol/latest/patrol/NativeAutomator2/pressVolumeUp.html Simulates pressing the volume up button. Note that this method does not work on the iOS Simulator as volume buttons are not available. ```APIDOC ## pressVolumeUp ### Description Presses the volume up button. ### Method Future ### Endpoint N/A (Method call) ### Parameters None ### Request Example ```dart await pressVolumeUp(); ``` ### Response None ### Notes - Does not work on iOS Simulator. - See also: developer.android.com/reference/androidx/test/uiautomator/UiDevice#pressKeyCodes(int[]), which is used on Android. ``` -------------------------------- ### Get Android Selector Source: https://pub.dev/documentation/patrol/latest/patrol/Selector/android.html Returns the Android-specific selector. Use this to construct selectors for Android UI elements. ```dart @override contracts.AndroidSelector get android => contracts.AndroidSelector( text: text, textStartsWith: textStartsWith, textContains: textContains, className: className, contentDescription: contentDescription, contentDescriptionStartsWith: contentDescriptionStartsWith, contentDescriptionContains: contentDescriptionContains, resourceName: resourceId, instance: instance, isEnabled: enabled, isFocused: focused, applicationPackage: pkg, ); ``` -------------------------------- ### Get Web Selector Implementation Source: https://pub.dev/documentation/patrol/latest/patrol/PlatformSelector/web.html Returns the Web-specific selector. Throws an UnsupportedError if the web selector is not provided. ```dart @override WebSelector get web => _web ?? (throw UnsupportedError('Web selector not provided')); ``` -------------------------------- ### PatrolBinding Constructors Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding-class.html Details on how to create and initialize a PatrolBinding instance. ```APIDOC ## Constructors ### PatrolBinding(PlatformAutomator platform) Creates a new PatrolBinding. ### PatrolBinding.ensureInitialized(PlatformAutomator platform) Returns an instance of the PatrolBinding, creating and initializing it if necessary. * Type: factory ``` -------------------------------- ### Platform Property Implementation Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolIntegrationTester/platform.html Provides the implementation details for accessing the platform property. ```APIDOC ## Platform Property PlatformAutomator get platform Shorthand for platformAutomator. ### Implementation ```dart PlatformAutomator get platform => platformAutomator; ``` ``` -------------------------------- ### Get skipOffstage Property Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolFinder/skipOffstage.html Retrieves the skipOffstage property from a finder. If true, the finder will skip nodes that are offstage. ```dart @override bool get skipOffstage => finder.skipOffstage; ``` -------------------------------- ### WidgetsBindingObserver Methods Source: https://pub.dev/documentation/patrol/latest/patrol/PatrolBinding-class.html This section covers methods for registering observers, managing frame callbacks, and handling platform-specific events. ```APIDOC ## addObserver / void ### Description Registers the given object as a binding observer. Binding observers are notified when various application events occur, for example when the system locale changes. Generally, one widget in the widget tree registers itself as a binding observer, and converts the system state into inherited widgets. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **observer** (WidgetsBindingObserver) - Required - The observer to register. ### Request Example ```dart widgetsBinding.addObserver(myObserver); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addPersistentFrameCallback / void ### Description Adds a persistent frame callback. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **callback** (FrameCallback) - Required - The callback function to add. ### Request Example ```dart widgetsBinding.addPersistentFrameCallback(myFrameCallback); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addPostFrameCallback / void ### Description Schedule a callback for the end of this frame. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters - **debugLabel** (String) - Optional - A debug label for the callback. #### Request Body - **callback** (FrameCallback) - Required - The callback function to schedule. ### Request Example ```dart widgetsBinding.addPostFrameCallback(myCallback, debugLabel: 'MyCallback'); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addRenderView / void ### Description Adds a RenderView to this binding. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **view** (RenderView) - Required - The RenderView to add. ### Request Example ```dart widgetsBinding.addRenderView(myRenderView); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addSemanticsActionListener / void ### Description Adds a listener that is called for every ui.SemanticsActionEvent received. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **listener** (ValueSetter) - Required - The listener to add. ### Request Example ```dart widgetsBinding.addSemanticsActionListener(myListener); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addSemanticsEnabledListener / void ### Description Adds a `listener` to be called when semanticsEnabled changes. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **listener** (VoidCallback) - Required - The listener to add. ### Request Example ```dart widgetsBinding.addSemanticsEnabledListener(myListener); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## addTimingsCallback / void ### Description Add a TimingsCallback that receives FrameTiming sent from the engine. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **callback** (TimingsCallback) - Required - The callback to add. ### Request Example ```dart widgetsBinding.addTimingsCallback(myCallback); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## allowFirstFrame / void ### Description Called after deferFirstFrame to tell the framework that it is ok to send the first frame to the engine now. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart widgetsBinding.allowFirstFrame(); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## asyncBarrier / void ### Description This is called during test execution before and after the body has been executed. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart widgetsBinding.asyncBarrier(); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## attachRootWidget / void ### Description Takes a widget and attaches it to the rootElement, creating it if necessary. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **rootWidget** (Widget) - Required - The root widget to attach. ### Request Example ```dart widgetsBinding.attachRootWidget(myRootWidget); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## attachToBuildOwner / void ### Description Called by attachRootWidget to attach the provided RootWidget to the buildOwner. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **widget** (RootWidget) - Required - The RootWidget to attach. ### Request Example ```dart widgetsBinding.attachToBuildOwner(myRootWidget); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## cancelFrameCallbackWithId / void ### Description Cancels the transient frame callback with the given `id`. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (int) - Required - The ID of the frame callback to cancel. ### Request Example ```dart widgetsBinding.cancelFrameCallbackWithId(callbackId); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## cancelPointer / void ### Description Dispatch a PointerCancelEvent for the given pointer soon. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **pointer** (int) - Required - The pointer ID for which to cancel events. ### Request Example ```dart widgetsBinding.cancelPointer(pointerId); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## computePlatformResolvedLocale / Locale? ### Description Computes the locale the current platform would resolve to. ### Method `Locale?` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **supportedLocales** (List) - Required - A list of supported locales. ### Request Example ```dart Locale? resolvedLocale = widgetsBinding.computePlatformResolvedLocale(supportedLocales); ``` ### Response #### Success Response (200) - **resolvedLocale** (Locale?) - The resolved locale or null. #### Response Example ```json { "resolvedLocale": "en_US" } ``` ``` ```APIDOC ## createBinaryMessenger / TestDefaultBinaryMessenger ### Description Creates a default BinaryMessenger instance that can be used for sending platform messages. ### Method `TestDefaultBinaryMessenger` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart TestDefaultBinaryMessenger messenger = widgetsBinding.createBinaryMessenger(); ``` ### Response #### Success Response (200) - **messenger** (TestDefaultBinaryMessenger) - The created BinaryMessenger instance. #### Response Example ```json { "messenger": "Instance of 'TestDefaultBinaryMessenger'" } ``` ``` ```APIDOC ## createCanvas / Canvas ### Description Create a Canvas from a PictureRecorder. ### Method `Canvas` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **recorder** (PictureRecorder) - Required - The PictureRecorder to use. ### Request Example ```dart Canvas canvas = widgetsBinding.createCanvas(recorder); ``` ### Response #### Success Response (200) - **canvas** (Canvas) - The created Canvas object. #### Response Example ```json { "canvas": "Instance of 'Canvas'" } ``` ``` ```APIDOC ## createImageCache / ImageCache ### Description Creates the ImageCache singleton (accessible via imageCache). ### Method `ImageCache` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart ImageCache imageCache = widgetsBinding.createImageCache(); ``` ### Response #### Success Response (200) - **imageCache** (ImageCache) - The ImageCache singleton instance. #### Response Example ```json { "imageCache": "Instance of 'ImageCache'" } ``` ``` ```APIDOC ## createPictureRecorder / PictureRecorder ### Description Create a PictureRecorder. ### Method `PictureRecorder` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart PictureRecorder recorder = widgetsBinding.createPictureRecorder(); ``` ### Response #### Success Response (200) - **recorder** (PictureRecorder) - The created PictureRecorder object. #### Response Example ```json { "recorder": "Instance of 'PictureRecorder'" } ``` ``` ```APIDOC ## createRestorationManager / TestRestorationManager ### Description Creates the RestorationManager instance available via restorationManager. ### Method `TestRestorationManager` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart TestRestorationManager manager = widgetsBinding.createRestorationManager(); ``` ### Response #### Success Response (200) - **manager** (TestRestorationManager) - The created RestorationManager instance. #### Response Example ```json { "manager": "Instance of 'TestRestorationManager'" } ``` ``` ```APIDOC ## createRootPipelineOwner / PipelineOwner ### Description Creates the PipelineOwner that serves as the root of the pipeline owner tree (rootPipelineOwner). ### Method `PipelineOwner` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart PipelineOwner pipelineOwner = widgetsBinding.createRootPipelineOwner(); ``` ### Response #### Success Response (200) - **pipelineOwner** (PipelineOwner) - The created root PipelineOwner. #### Response Example ```json { "pipelineOwner": "Instance of 'PipelineOwner'" } ``` ``` ```APIDOC ## createSceneBuilder / SceneBuilder ### Description Create a SceneBuilder. ### Method `SceneBuilder` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart SceneBuilder sceneBuilder = widgetsBinding.createSceneBuilder(); ``` ### Response #### Success Response (200) - **sceneBuilder** (SceneBuilder) - The created SceneBuilder object. #### Response Example ```json { "sceneBuilder": "Instance of 'SceneBuilder'" } ``` ``` ```APIDOC ## createSemanticsUpdateBuilder / SemanticsUpdateBuilder ### Description Creates an empty semantics update builder. ### Method `SemanticsUpdateBuilder` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart SemanticsUpdateBuilder updateBuilder = widgetsBinding.createSemanticsUpdateBuilder(); ``` ### Response #### Success Response (200) - **updateBuilder** (SemanticsUpdateBuilder) - The created SemanticsUpdateBuilder object. #### Response Example ```json { "updateBuilder": "Instance of 'SemanticsUpdateBuilder'" } ``` ``` ```APIDOC ## createViewConfigurationFor / ViewConfiguration ### Description Returns a ViewConfiguration configured for the provided RenderView based on the current environment. ### Method `ViewConfiguration` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **renderView** (RenderView) - Required - The RenderView for which to create the configuration. ### Request Example ```dart ViewConfiguration config = widgetsBinding.createViewConfigurationFor(renderView); ``` ### Response #### Success Response (200) - **config** (ViewConfiguration) - The created ViewConfiguration. #### Response Example ```json { "config": { "size": {"width": 800, "height": 600}, "devicePixelRatio": 1.0 } } ``` ``` ```APIDOC ## debugAssertNoPendingPerformanceModeRequests / bool ### Description Asserts that there are no pending performance mode requests in debug mode. ### Method `bool` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **reason** (String) - Required - The reason for the assertion. ### Request Example ```dart bool result = widgetsBinding.debugAssertNoPendingPerformanceModeRequests('Testing performance mode'); ``` ### Response #### Success Response (200) - **result** (bool) - True if no pending requests, otherwise an assertion error is thrown. #### Response Example ```json { "result": true } ``` ``` ```APIDOC ## debugAssertNoTimeDilation / bool ### Description Asserts that there is no artificial time dilation in debug mode. ### Method `bool` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **reason** (String) - Required - The reason for the assertion. ### Request Example ```dart bool result = widgetsBinding.debugAssertNoTimeDilation('Testing time dilation'); ``` ### Response #### Success Response (200) - **result** (bool) - True if no time dilation, otherwise an assertion error is thrown. #### Response Example ```json { "result": true } ``` ``` ```APIDOC ## debugAssertNoTransientCallbacks / bool ### Description Asserts that there are no registered transient callbacks; if there are, prints their locations and throws an exception. ### Method `bool` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **reason** (String) - Required - The reason for the assertion. ### Request Example ```dart bool result = widgetsBinding.debugAssertNoTransientCallbacks('Testing callbacks'); ``` ### Response #### Success Response (200) - **result** (bool) - True if no transient callbacks, otherwise an assertion error is thrown. #### Response Example ```json { "result": true } ``` ``` ```APIDOC ## debugCheckZone / bool ### Description Checks that the current Zone is the same as that which was used to initialize the binding. ### Method `bool` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **entryPoint** (String) - Required - The entry point string for context. ### Request Example ```dart bool result = widgetsBinding.debugCheckZone('MyApp'); ``` ### Response #### Success Response (200) - **result** (bool) - True if the zone is correct, otherwise an assertion error is thrown. #### Response Example ```json { "result": true } ``` ``` ```APIDOC ## debugGetRequestedPerformanceMode / DartPerformanceMode? ### Description Returns the current DartPerformanceMode requested or `null` if no requests have been made. ### Method `DartPerformanceMode?` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart DartPerformanceMode? mode = widgetsBinding.debugGetRequestedPerformanceMode(); ``` ### Response #### Success Response (200) - **mode** (DartPerformanceMode?) - The requested performance mode or null. #### Response Example ```json { "mode": "low_variance" } ``` ``` ```APIDOC ## deferFirstFrame / void ### Description Tell the framework to not send the first frames to the engine until there is a corresponding call to allowFirstFrame. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart widgetsBinding.deferFirstFrame(); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## delayed / Future ### Description Delay for `duration` of time. ### Method `Future` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **duration** (Duration) - Required - The duration to delay. ### Request Example ```dart await widgetsBinding.delayed(Duration(seconds: 1)); ``` ### Response #### Success Response (200) N/A (Completes after the delay) #### Response Example N/A ``` ```APIDOC ## dispatchAccessibilityFeaturesChanged / void ### Description Notify all the observers that the active set of AccessibilityFeatures has changed (using WidgetsBindingObserver.didChangeAccessibilityFeatures), giving them the `features` argument. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **features** (AccessibilityFeatures) - Required - The changed accessibility features. ### Request Example ```dart widgetsBinding.dispatchAccessibilityFeaturesChanged(accessibilityFeatures); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## dispatchEvent / void ### Description Dispatch an event to pointerRouter and the path of a hit test result. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **event** (PointerEvent) - Required - The pointer event to dispatch. - **hitTestResult** (HitTestResult?) - Optional - The hit test result. ### Request Example ```dart widgetsBinding.dispatchEvent(pointerEvent, hitTestResult); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## dispatchLocalesChanged / void ### Description Notify all the observers that the locale has changed (using WidgetsBindingObserver.didChangeLocales), giving them the `locales` argument. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **locales** (List?) - Optional - The list of locales. ### Request Example ```dart widgetsBinding.dispatchLocalesChanged(currentLocales); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ``` ```APIDOC ## drawFrame / void ### Description Triggers a frame to be drawn. This method is typically called by the framework internally. ### Method `void` ### Endpoint N/A (Method within a class) ### Parameters None ### Request Example ```dart widgetsBinding.drawFrame(); ``` ### Response #### Success Response (200) N/A (void method) #### Response Example N/A ```