TestStep class

Defines an individual executable action, assertion, or wait step in a test case.

Constructors

TestStep({String? id, required TestStepType type, TargetFinder? target, String? text, Offset? offset, Offset? dragEndOffset, Duration? duration, Duration? timeout, bool clearFirst = false, String? description, Future<void> customAction(BuildContext context)?, bool isBreakpoint = false, TestStatus status = TestStatus.pending, DateTime? startTime, DateTime? endTime, String? errorMessage, StackTrace? stackTrace, List<RunnerLogEntry>? logs})
TestStep.clearText({required TargetFinder target, String? description, bool isBreakpoint = false})
Create a clearText step.
factory
TestStep.custom(Future<void> action(BuildContext context), {String? description, bool isBreakpoint = false})
Custom async callback step.
factory
TestStep.dismissKeyboard({String? description, bool isBreakpoint = false})
Dismiss the on-screen soft keyboard.
factory
TestStep.doubleTap({required TargetFinder target, String? description, bool isBreakpoint = false})
Create a double-tap step on a target widget.
factory
TestStep.drag({required TargetFinder target, required Offset offset, Duration duration = const Duration(milliseconds: 300), String? description, bool isBreakpoint = false})
Create a drag gesture from target to target + offset.
factory
TestStep.enterText({required TargetFinder target, required String text, bool clearFirst = true, String? description, bool isBreakpoint = false})
Create an enterText step typing text into target input field.
factory
TestStep.expectNotVisible({required TargetFinder target, Duration? timeout, String? description, bool isBreakpoint = false})
Assert that target is NOT visible on screen.
factory
TestStep.expectText({required TargetFinder target, required String text, Duration? timeout, String? description, bool isBreakpoint = false})
Assert that target contains text.
factory
TestStep.expectVisible({required TargetFinder target, Duration? timeout, String? description, bool isBreakpoint = false})
Assert that target is visible on screen.
factory
TestStep.fromJson(Map<String, dynamic> json)
Create a TestStep from JSON map.
factory
TestStep.longPress({required TargetFinder target, Duration duration = const Duration(milliseconds: 700), String? description, bool isBreakpoint = false})
Create a long-press step on a target widget.
factory
TestStep.scroll({required TargetFinder target, required Offset offset, String? description, bool isBreakpoint = false})
Create a scroll step with relative offset delta.
factory
TestStep.scrollTo({required TargetFinder target, String? description, bool isBreakpoint = false})
Create an auto-scroll step to bring target into viewport.
factory
TestStep.tap({required TargetFinder target, String? description, bool isBreakpoint = false})
Create a tap step on a target widget.
factory
TestStep.wait(Duration duration, {String? description, bool isBreakpoint = false})
Wait for a duration.
factory

Properties

clearFirst bool
Whether to clear existing text before typing in an enterText action.
final
customAction Future<void> Function(BuildContext context)?
Optional custom asynchronous action callback.
final
description String?
User-defined description of this step.
final
dragEndOffset Offset?
End coordinate for drag gesture.
final
duration Duration?
Duration to wait (for wait step) or drag duration.
final
endTime DateTime?
Timestamp when step finished executing.
getter/setter pair
errorMessage String?
Error message if the step failed.
getter/setter pair
executionDuration Duration
Total duration taken to execute this step.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this step.
final
isBreakpoint bool
Whether execution should pause before running this step (breakpoint).
getter/setter pair
logs List<RunnerLogEntry>
Logs captured during the execution of this step.
final
offset Offset?
Scroll delta offset, or start coordinate for pointer drag.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
Stack trace if an unhandled exception occurred.
getter/setter pair
startTime DateTime?
Timestamp when step started executing.
getter/setter pair
status TestStatus
Current execution status.
getter/setter pair
target TargetFinder?
Target widget finder to locate in the Element tree.
final
text String?
Text to enter (for enterText) or expected text (for expectText).
final
timeout Duration?
Maximum timeout duration for assertions and widget lookup.
final
type TestStepType
Type of action or assertion.
final

Methods

copy() TestStep
Clone this step.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset execution state to pending.
toJson() Map<String, dynamic>
Serialize this step to JSON.
toString() String
A string representation of this object.
override

Operators

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