flutter_driver library

Provides API to test Flutter applications that run on real devices and emulators.

The application runs in a separate process from the test itself.

This is Flutter's version of Selenium WebDriver (generic web), Protractor (Angular), Espresso (Android) or Earl Gray (iOS).

Classes

Ancestor
A Flutter Driver finder that finds an ancestor of of that matches matching.
BySemanticsLabel
A Flutter Driver finder that finds widgets by semantic label.
ByText
A Flutter Driver finder that finds widgets by text inside a Text or EditableText widget.
ByTooltipMessage
A Flutter Driver finder that finds widgets by tooltip text.
ByType
A Flutter Driver finder that finds widgets by their runtimeType.
ByValueKey
A Flutter Driver finder that finds widgets by ValueKey.
CombinedCondition
A combined condition that waits until all the given conditions are met.
Command
An object sent from the Flutter Driver to a Flutter application to instruct the application to perform a task.
CommandWithTarget
A Flutter Driver command aimed at an object to be located by finder.
CommonFinders
Provides convenient accessors to frequently used finders.
Descendant
A Flutter Driver finder that finds a descendant of of that matches matching.
DiagnosticsTreeResult
The result of a GetDiagnosticsTree command.
DriverOffset
An immutable 2D floating-point offset used by Flutter Driver.
EnterText
A Flutter Driver command that enters text into the currently focused widget.
EnumIndex<E>
Indexes a list of enum values by simple name.
FirstFrameRasterized
A condition that waits until the Flutter engine has rasterized the first frame.
FlutterDriver
Drives a Flutter Application running in another process.
FlutterWebConnection
Encapsulates connection information to an instance of a Flutter Web application.
FuchsiaCompat
Utility class for creating connections to the Fuchsia Device.
GetDiagnosticsTree
A Flutter Driver command to retrieve the JSON-serialized DiagnosticsNode tree of the object identified by finder.
GetHealth
A Flutter Driver command that requests an application health check.
GetOffset
A Flutter Driver command that returns the offsetType from the RenderObject identified by finder.
GetOffsetResult
The result of the GetOffset command.
GetRenderTree
A Flutter Driver command that requests a string representation of the render tree.
GetSemanticsId
A Flutter driver command that retrieves a semantics id using a specified finder.
GetSemanticsIdResult
The result of a GetSemanticsId command.
GetText
A Flutter Driver command that reads the text from a given element.
GetTextResult
The result of the GetText command.
Health
A description of the application state, as provided in response to a FlutterDriver.checkHealth test.
NoPendingFrame
A condition that waits until no pending frame is scheduled.
NoPendingPlatformMessages
A condition that waits until there are no pending platform messages.
NoTransientCallbacks
A condition that waits until no transient callbacks are scheduled.
PageBack
A Flutter Driver finder that finds the back button on the page's Material or Cupertino scaffold.
RenderTree
A string representation of the render tree, the result of a FlutterDriver.getRenderTree method.
RequestData
A Flutter Driver command that sends a string to the application and expects a string response.
RequestDataResult
The result of the RequestData command.
Result
An object sent from a Flutter application back to the Flutter Driver in response to a command.
Scroll
A Flutter Driver command that commands the driver to perform a scrolling action.
ScrollIntoView
A Flutter Driver command that commands the driver to ensure that the element represented by finder has been scrolled completely into view.
SendTextInputAction
A Flutter Driver command that send a text input action.
SerializableFinder
Base class for Flutter Driver finders, objects that describe how the driver should search for elements.
SerializableWaitCondition
Base class for Flutter Driver wait conditions, objects that describe conditions the driver can wait for.
SetFrameSync
A Flutter Driver command that enables or disables the FrameSync mechanism.
SetSemantics
A Flutter Driver command that enables or disables semantics.
SetSemanticsResult
The result of a SetSemantics command.
SetTextEntryEmulation
A Flutter Driver command that enables and disables text entry emulation.
Tap
A Flutter Driver command that taps on a target widget located by finder.
Timeline
Timeline data recorded by the Flutter runtime.
TimelineEvent
A single timeline event.
TimelineSummary
Extracts statistics from a Timeline.
VMServiceFlutterDriver
An implementation of the Flutter Driver over the vmservice protocol.
WaitFor
A Flutter Driver command that waits until finder can locate the target.
WaitForAbsent
A Flutter Driver command that waits until finder can no longer locate the target.
WaitForCondition
A Flutter Driver command that waits until a given condition is satisfied.
WaitForTappable
A Flutter Driver command that waits until finder can be tapped.
WebFlutterDriver
An implementation of the Flutter Driver using the WebDriver.

Enums

DiagnosticsType
DiagnosticsNode tree types that can be requested by GetDiagnosticsTree.
HealthStatus
A description of application state.
OffsetType
Offset types that can be requested by GetOffset.
TextInputAction
An action the user has requested the text input control to perform.
TimelineStream
Timeline stream identifier.

Mixins

DeserializeCommandFactory
A factory for deserializing Commands.
DeserializeFinderFactory
A factory for deserializing SerializableFinders.

Constants

find → const CommonFinders
A convenient accessor to frequently used finders.
kBuildBudget → const Duration
The maximum amount of time considered safe to spend for a frame's build phase. Anything past that is in the danger of missing the frame at 60FPS.
kBuildFrameEventName → const String
The name of the framework frame build events we need to filter or extract.
kRasterizeFrameEventName → const String
The name of the engine frame rasterization events we need to filter or extract.
kUnusuallyLongTimeout → const Duration
How long to wait before showing a message saying that things seem to be taking a long time.

Properties

driverLog DriverLogCallback
Print the given message to the console.
getter/setter pair
fs FileSystem
The file system implementation used by this library.
getter/setter pair
testOutputsDirectory String
Flutter Driver test output directory.
no setter
vmServiceConnectFunction VMServiceConnectFunction
The connection function used by FlutterDriver.connect.
getter/setter pair

Functions

restoreFileSystem() → void
Restores the file system to the default local file system implementation.
restoreVmServiceConnectFunction() → void
Restores vmServiceConnectFunction to its default value.
useMemoryFileSystemForTesting() → void
Overrides the file system so it can be tested without hitting the hard drive.
waitUntilExtensionInstalled(WebDriver driver, Duration? timeout) Future<void>
Waits until extension is installed.

Typedefs

DriverLogCallback = void Function(String source, String message)
Signature for driverLog.
EvaluatorFunction = dynamic Function()
Computes a value.
VMServiceConnectFunction = Future<VmService> Function(String url, Map<String, dynamic>? headers)
A function that connects to a Dart VM service given the url and headers.

Exceptions / Errors

DriverError
Standard error thrown by Flutter Driver API.
SerializationException
Thrown to indicate a serialization error.