ScenarioTester class

Drives one scenario. Wraps the real WidgetTester — every method here settles and then captures per the scenario's Shots policy; anything done through tester directly is plain flutter_test and captures nothing.

Waiting is the same Settle policy for every verb, bounded by default, so a screen that animates forever is captured rather than thrown on.

Properties

assets → ScenarioAssetBundle
The bundle this scenario reads assets through, installed over whatever pumpWidget pumps — so DefaultAssetBundle.of(context), and everything built on it, is already this one.
final
assignment → ScenarioAssignment?
The axes this scenario is running under, when anything assigned any — what keeps a matrix's captures out of each other's directories, and what a body reads to adapt an expectation to the screen it is on.
final
film → ScenarioFilmVoice
What this run is telling whatever is filming it.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
keyboard → ScenarioKeyboardVerbs
The software keyboard, for a scenario that wants to say it explicitly.
latefinal
network → ScenarioNetworkPolicy
What this scenario's http requests reach, and where it states the answers it wants.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shots → Shots
final
tester → WidgetTester
The real tester — the escape hatch to the full flutter_test surface.
final

Methods

act<T>(String description, FutureOr<T> body(), {List<String> tags = const [], Settle? settle, Duration timeout = const Duration(seconds: 10), bool shot = true}) → Future<T>
A step whose cause is not a finger: description says what happened, body makes it happen, and the screen it produces is captured under that name.
axis(String name) → String
The value of name, one of the axes this scenario's folder declares in its profile — what the app is to be built for on this pass.
back({Shot? shot, Settle? settle}) → Future<void>
The platform's back gesture — Android's button, iOS's edge swipe, the thing that pops a route without a widget to tap.
document(String name, List<int> bytes, {String? fileName, String? mimeType, List<String> tags = const []}) → Future<void>
A beat of the flow that is not a screen: the PDF it just generated, the email body it queued, the payload it posted.
doubleTap(dynamic target, {Duration? gap, Shot? shot, Settle? settle}) → Future<void>
Taps target twice in the same place, close enough together to read as one gesture — what onDoubleTap waits for.
drag(dynamic target, Offset by, {Duration? duration, Shot? shot, Settle? settle}) → Future<void>
Drags target by by — a swipe, a dismiss, a slider, a sheet pulled down. Negative dy moves the finger up the screen, the touch convention flutter_test itself uses.
dragFrom(Offset from, Offset by, {Duration? duration, Shot? shot, Settle? settle}) → Future<void>
Drags from a point rather than from a widget — the same gesture as drag, aimed where no finder can reach.
enterText(dynamic target, String text, {Duration? typing, Shot? shot, Settle? settle}) → Future<void>
Puts text in the field at target, replacing what was there — in one edit, the way a paste arrives.
finderFor(dynamic target) → Finder
Resolves a verb's polymorphic target to a Finder.
hover(dynamic target, {Duration? hold, Shot? shot, Settle? settle}) → Future<void>
Parks the mouse over target and holds it there, so whatever the app only shows to a mouse — a tooltip, a hover tint, a control that appears under the pointer — is on the screen the step captures.
key(String chord, {Shot? shot, Settle? settle}) → Future<void>
Presses a key — escape, enter, tab, arrowDown — or a chord: meta+k, shift+tab, control+s.
longPress(dynamic target, {Shot? shot, Settle? settle}) → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notification(String body, {String? title, String? appName, List<String> tags = const []}) → Future<void>
A push the flow's backend would have sent — a beat the recipient sees, drawn the way their phone would draw it.
pumpWidget(Widget widget, {Shot? shot, Settle? settle}) → Future<void>
runAsync<T>(Future<T> callback(), {Shot? shot, Settle? settle}) → Future<T?>
tester.runAsync with a watchdog on it: real async work, and a sentence rather than a hang when it turns out not to be work at all.
screen(String name, {List<String> tags = const [], Settle? settle, bool force = false}) → Future<void>
Names the screen as it stands, without performing an action.
scroll(dynamic target, Offset by, {Shot? shot, Settle? settle}) → Future<void>
Turns the mouse wheel over target by by — scrolls the pane under the mouse.
scrollTo(dynamic target, {dynamic within, double step = 200, int maxScrolls = 50, Shot? shot, Settle? settle}) → Future<void>
Scrolls until target is on screen, then captures it there.
secondaryTap(dynamic target, {Shot? shot, Settle? settle}) → Future<void>
Right-clicks target — the mouse's other button, and how a context menu is asked for on every desktop.
settle([Settle? policy]) → Future<void>
Waits per the scenario's Settle policy — or policy — and captures nothing.
setup<T>(String name, Future<T> body()) → Future<T>
Emits a step that has no frame — see document and notification.
split(Map<String, Future<void> Function()> branches) → Future<void>
Forks the scenario: every branch runs, each in its own replay of the whole body — so each branch starts from the exact state this line was reached with, and the flow graph fans out here.
tap(dynamic target, {Shot? shot, Settle? settle}) → Future<void>
Taps target — a Finder, a String (visible text), a Key, an IconData, a Type, or a Target for the rest (a semantics label, a tooltip, a scope, an index).
tapAt(Offset at, {Shot? shot, Settle? settle}) → Future<void>
Taps a point rather than a widget — the same press as tap, aimed where no finder can reach.
title(String text) → void
A caption for the stretch that follows — sugar over film.
toString() → String
A string representation of this object.
inherited
unhover({Duration? hold, Shot? shot, Settle? settle}) → Future<void>
Takes the mouse off the screen, so everything it was over gets its exit.
visibleTexts() → List<String>
The visible text, in tree order — the projection an agent reads next to the screenshot. EditableText too, or what the user just typed into a TextField would be pixels only.
wait(Duration duration, {Shot? shot, Settle? settle}) → Future<void>
Advances the clock by duration.

Operators

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

Static Properties

screenshotsDestinationOverride ↔ String?
Stands in for the define and the environment variable below, which are the two things a test process cannot change about itself: one is fixed at compile time and the other is read-only. Without it the standalone lane — what a bare flutter test writes, and the only lane a consumer's CI uses without the GUI — can be exercised nowhere but a subprocess.
getter/setter pair