FlutsterTestEvent class

FlutsterTestEvent is a Flutster test step.

Constructors

FlutsterTestEvent.fromJson(String json, {FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester})
fromJson factory returns an event made from a json string.
factory
FlutsterTestEvent.fromMap(Map<String, dynamic> map, {FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester})
fromMap factory returns an event build from a map.
factory
FlutsterTestEvent.screenShot({DateTime? time, required Image screenShot, required Uint8List screenShotBytes, FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester, String? widgetName})
screenShot factory is used to create a validating screenshot test event.
factory
FlutsterTestEvent.tap({DateTime? time, required Offset tapStart, Offset? tapStop, Duration tapDuration = const Duration(milliseconds: 0), FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester, String? widgetName})
tap factory is used to create a tap test event.
factory
FlutsterTestEvent.text({DateTime? time, required String typedText, required KeyEvent? keyEvent, String? keyLabel, FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester, String? widgetName})
text factory is used to create key test event.
factory

Properties

context BuildContext?
context used while displaying the Flutster test recording menu.
getter/setter pair
editTypedTextController TextEditingController
editTypedTextController allows to set the typed text for a key event in the context of the Flutster test recording menu.
getter/setter pair
flutsterTestRecorderState FlutsterTestRecorderState?
flutsterTestRecorderState if given is returned as the current FlutsterTestRecorderState by recorderState.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
iMEDBlurRatio double
iMEDBlurRatio is used for the IMED image comparison method.
getter/setter pair
iMEDBlurRatioEditKey Key
iMEDBlurRatioEditKey can be used to retrieve the ratio value.
getter/setter pair
iMEDSigma double
iMEDSigma is used for the IMED image comparison method.
getter/setter pair
iMEDSigmaEditKey Key
iMEDSigmaEditKey can be used to retrieve the sigma value.
getter/setter pair
keyEvent KeyEvent?
keyEvent is the originating key event available while recording.
getter/setter pair
keyEventDown bool?
keyEventDown is true for key press and false for key release.
getter/setter pair
keyEventKeyLabel String?
keyEventKeyLabel is the non static version of the keyEventKeyLabelStatic function.
no setter
keyLabel String?
keyLabel value of logicalKey.keyLabel of a KeyEvent.
getter/setter pair
pixelMatchingTolerance double
pixelMatchingTolerance is necessary when using the pixel matching image comparison method. The smaller the stricter.
getter/setter pair
pixelMatchingToleranceEditKey Key
pixelMatchingToleranceEditKey can be used to retrieve the tolerance value.
getter/setter pair
resultMessage Widget?
resultMessage is the output Widget of the test event run.
getter/setter pair
resumeTime DateTime?
resumeTime is the time at which the recording resumed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenShot Image?
screenShot is the Image of the screenshot.
getter/setter pair
screenShotAcceptancePctThreshold double
screenShotAcceptancePctThreshold is the minimum percentage of picture matching to consider that two screenshots are identical.
getter/setter pair
screenShotBytes Uint8List?
screenShotBytes holds the bytes of the screenshot image.
getter/setter pair
screenShotComparisonFunctionName String?
screenShotComparisonFunctionName as held in screenShotComparisonFunctions.
getter/setter pair
screenShotComparisonFunctions Map<String, Function>
screenShotComparisonFunctions holds the image comparison functions used for the validation screenshots. More information here: https://pub.dev/packages/image_compare
getter/setter pair
screenShotMatchResult double?
screenShotMatchResult holds the result of the screenshot image comparison.
getter/setter pair
tapDuration Duration?
tapDuration is the duration of the tap.
getter/setter pair
tapStart Offset?
tapStart is the position of the tap start.
getter/setter pair
tapStop Offset?
tapStart is the position of the tap stop.
getter/setter pair
tester WidgetTester?
tester is provided by the integration testing to conduct the testing.
getter/setter pair
time DateTime
time is the time at which the event occurred.
getter/setter pair
type FlutsterTestEventType
type holds the type of the event.
getter/setter pair
typedText String?
typedText for a key event is the equivalent typed text if any.
getter/setter pair
waitDuration Duration?
waitDuration is the duration to wait before starting the event play.
getter/setter pair
widgetName String?
widgetName is used by recorderState to find the right FlutsterTestRecorderState while testing.
getter/setter pair

Methods

build(StateSetter setState, List<FlutsterTestEvent> events, BuildContext context) Widget
build returns the widget that can be used to represent the event in a UI.
buildEditWidgets(StateSetter updateParent, StateSetter setState) List<Widget>
buildEditWidgets builds the edit widget as the content to the dialog displayed by edit.
buildIcon() Widget
buildIcon returns the icon icon widget that best represents the event.
buildPreview() Widget
buildPreview returns the widget to display to preview the event.
canBeCombined() Future<bool>
canBeCombined returns true in case the event can be combined. This is often the case for key events that have never been combined.
character() String
character tries to get the character from the keyEvent. If it fails, it tries the correspondence from the keyEvent.logicalKey.
characterCharacter() String
characterCharacter returns the keyEvent.character if any.
combine(StateSetter updateParent) → dynamic
combine is called to combine the event with others. In effect, it will combine all events in the record that can be combined.
combineAll({String text = "", List<LogicalKeyboardKey>? keysToCloseUp, int cursorPosition = 0}) Future<bool>
combineAll combines all the key events in the record that can be combined. Returns true if "this" event would combine previous one and thus the previous one can be deleted.
compareTwoImages(Uint8List image1, Uint8List image2, double pixelMatchingTolerance, double iMEDSigma, double iMEDBlurRatio, {bool reverse = false}) Future<double>
compareTwoImages returns the output of the screenshot comparison function. Number between 0 and 1. Closer to 0 means very similar images. Closer to 1 means very different images.
delete() → dynamic
delete deletes the event from the record.
edit(StateSetter updateParent) → void
edit displays a dialog fro which the event can be edited.
eventReplayComparisonResultString(FlutsterTestEvent? playEvent) Future<Widget>
eventReplayComparisonResultString returns a Text widget with the result of the result of the event run.
getRecord() Future<FlutsterTestRecord?>
getRecord returns the FlutsterTestRecord holding this event.
isAZ() bool
isAZ returns true if the keyEvent.logicalKey is between 'a' and 'z'.
isCharacterAZ() bool
isCharacterAZ returns true if the keyEvent.character is printable.
isStopKey() bool
keyToSwallow() bool
keyToSwallow returns true if the keyLabel is considered as not useful in a combine and can be removed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
play({WidgetTester? tester, List<FlutsterTestEvent>? results}) Future<bool>
play runs the event if possible and returns false if there was a failure.
playButton(StateSetter setState, {BuildContext? editDialogContext}) Widget
playButton returns the widget to display a play button to run the event.
presentImage(Widget image) Widget
presentImage returns a widget to display the given image in a UI.
recorderState({int retries = 10}) Future<FlutsterTestRecorderState?>
recorderState returns the FlutsterTestRecorderState displayed on the testing screen.
screenShotComparison(Uint8List newScreenShotBytes) Future<bool>
screenShotComparison returns true if the given screenshot matches the event screenshot.
screenShotToB64() String
screenShotToB64 returns the screenshot image bytes in base 64.
strSummary() String
strSummary returns a printable summary of the event.
tapSummaryStr() String
tapSummaryStr returns part of the strSummary in case of a tap event.
tapUp(Offset tapStop, {Duration? tapDuration, DateTime? time}) → dynamic
tapUp records the end of a tap.
toJson() String
toJson returns the event as a json string.
toMap() Map<String, dynamic>
toMap returns the event as a map.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

keyEventKeyLabelStatic(KeyEvent? keyEvent) String?
keyEventKeyLabelStatic returns the String that can be used to represent the given event in a UI.

Constants

defaultScreenshotComparisonFunctionName → const String
defaultScreenshotComparisonFunctionName is the default name of the image comparison function as held in defaultScreenshotComparisonFunctionName