FlutsterTestRecord class

A FlutsterTestRecord mainly holds the list of test events.

Constructors

FlutsterTestRecord({String? testName, DateTime? firstRecordingStart, List<FlutsterTestEvent>? events, String? apiUrl = "https://flutster.com", String? apiUser, String? apiKey, bool active = true})
FlutsterTestRecord takes parameters described as fields of the class.
FlutsterTestRecord.fromJson(String json, {FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester})
fromJson returns the record built from the interpreted given json.
factory
FlutsterTestRecord.fromMap(Map<String, dynamic> map, {FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester})
fromMap returns the record built from the given map.
factory

Properties

active bool
Should be set to false on production environments so that the floating button is not displayed.
getter/setter pair
apiKey String?
apiUrl, apiUser, [apiKey optionally set access to https://flutster.com
getter/setter pair
apiUrl String?
apiUrl, apiUser, [apiKey optionally set access to https://flutster.com
getter/setter pair
apiUser String?
apiUrl, apiUser, [apiKey optionally set access to https://flutster.com
getter/setter pair
apiVersion String
apiVersion as set by https://flutster.com
final
buttonSize double?
buttonSize allows tweaking the size of the Flutster floating button.
getter/setter pair
events List<FlutsterTestEvent>
events are the steps of the test.
getter/setter pair
expect ↔ (dynamic Function(dynamic actual, dynamic matcher, {String? reason, dynamic skip})?)
expect is used while running the test to report on the result.
getter/setter pair
firstRecordingStart DateTime?
firstRecordingStart stores when the recording started.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id int?
id is the https://flutster.com test record id.
getter/setter pair
recording bool
recording returns true when we record the test.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
testName String
testName optionally makes it easier to find the test.
getter/setter pair

Methods

add(FlutsterTestEvent flutsterTestEvent) → dynamic
add adds an event to the list of events.
apiCallResultToMessage(String? res, String message) String
apiCallResultToMessage eases the treatment of https://flutster.com API call errors.
apiDelete() Future<String>
apiDelete deletes the record from the https://flutster.com API.
apiListing() Future<String>
apiListing returns the list of records from https://flutster.com API as a json string.
apiSave({List<FlutsterTestEvent>? runEvents, bool? runResult, int retries = 20}) Future<String>
apiSave saves the record to https://flutster.com API
clear() → void
clear flushes the events, resets the test name, api id, firstRecordingStart and stops the recording.
combineAll() → void
combineAll calls the first event combineAll method that will shrink the events list when possible. In particular, the keyboard events are combined to form words.
containsScreenShot() bool
containsScreenShot returns true if at least one of the events is a screenshot.
deleteEvent(FlutsterTestEvent event) → void
deleteEvent removes the given event from the list of recorded events.
durationToLastEvent([DateTime? dateTime]) Duration
durationToLastEvent returns the duration since the last recorded event. If dateTime is given, or now otherwise. If no event was recorded, it takes firstRecordingStart instead.
findEventIndex(FlutsterTestEvent flutsterTestEvent) int
findNextEvent(FlutsterTestEvent flutsterTestEvent) FlutsterTestEvent?
findNextEvent returns the event that was recorded right after the given one. Returns null in case the given event was the last one.
findPreviousEvent(FlutsterTestEvent flutsterTestEvent) FlutsterTestEvent?
findPreviousEvent returns the event that was recorded just before the given event. Returns null in case the given event was the first one.
fromApi(int trid, {dynamic expect(dynamic actual, dynamic matcher, {String? reason, dynamic skip})?, FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester, int retries = 10}) Future<String>
fromApi builds the record from the https://flutster.com API details.
fromJson(String json, {dynamic expect(dynamic actual, dynamic matcher, {String? reason, dynamic skip})?, FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester}) → dynamic
fromJson builds the record from the interpreted given json.
fromMap(Map<String, dynamic> map, {FlutsterTestRecorderState? flutsterTestRecorderState, WidgetTester? tester}) → dynamic
fromMap builds the record from the given map.
isCleared() bool
isCleared returns true in case the record is in a state that would be equivalent if clear was called.
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 events and returns true in case all passed.
playToApi(WidgetTester tester) Future<bool>
playToApi plays the record events and saves the run to the https://flutster.com API. Returns true in case the run succeeded. assertion to check whether test run was saved.
share(BuildContext context) → void
share is what is called when the user wants to share the record json.
shareAsFile(BuildContext context) → void
shareAsFile is a fallback in case share didn't work.
tapUp(Offset tapStop, {Duration? tapDuration, DateTime? time}) → dynamic
tapUp records the end of a tap.
toJson({List<FlutsterTestEvent>? alternateEvents}) String
toJson returns the record as a json string.
toMap({List<FlutsterTestEvent>? alternateEvents}) Map<String, dynamic>
toMap returns a Map of the record including the events. If alternateEvents is given, the events are replaced in the returned map by this given list.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

defaultRecord FlutsterTestRecord
The defaultRecord can be used in case no FlutsterTestRecord is given.
getter/setter pair

Static Methods

pctValidator(String? doubleString) String?
pctValidator returns null if the given doubleString is a valid percentage.
ratioValidator(String? doubleString) String?
ratioValidator returns null if the given doubleString is valid.
send(String urlWithoutParameters, Object data, {Map<String, String>? headers, int timeoutMS = 10000}) Future<String?>
send Function used to send the data to the server. This is for post method. Returns the response body as a String in case of success and null otherwise. urlWithoutParameters The matomo.php URL without the parameters. data The parameters to be sent by post. headers The headers to be sent along with request.
testNameValidator(String? testName) String?
testNameValidator returns null if the given testName is valid.
uDoubleValidator(String? doubleString) String?
uDoubleValidator returns null if the given doubleString is valid.
uIntValidator(String? uInt) String?
uIntValidator returns null if the given uInt is valid.
widgetNameValidator(String? widgetName) String?
widgetNameValidator returns null if the given widgetName is valid.