TestFairy class abstract

This is the main entry point to TestFairy integration in Flutter.

An example usage can be found below.

void main() {
  HttpOverrides.global = TestFairy.httpOverrides();

  runZonedGuarded(
    () async {
      try {
        FlutterError.onError =
            (details) => TestFairy.logError(details.exception);

        // Call `await TestFairy.begin()` or any other setup code here.

        runApp(TestFairyGestureDetector(child: TestfairyExampleApp()));
      } catch (error) {
        TestFairy.logError(error);
      }
    },
    (e, s) {
      TestFairy.logError(e);
    },
    zoneSpecification: new ZoneSpecification(
      print: (self, parent, zone, message) {
        TestFairy.log(message);
      },
    )
  );
}

Constructors

TestFairy()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

addCheckpoint(String name) Future<void>
@Deprecated backward compatibility wrapper for addEvent. Use addEvent unless really necessary.
addEvent(String name) Future<void>
Marks an event in session. Use this text to tag a session with an event name.
addNetworkEvent(String uri, String method, int code, int startTimeMillis, int endTimeMillis, int requestSize, int responseSize, String? errorMessage, {String? requestHeaders, Uint8List? requestBodyBytes, String? responseHeaders, Uint8List? responseBodyBytes}) Future<void>
Call this function to log your network events. See httpOverrides to automatically do this for all your http calls.
addUserInteraction(UserInteractionKind kind, String label, Map<String, String> info) Future<void>
Adds a new user interaction to session timeline.
begin(String appToken) Future<void>
Initialize a TestFairy session.
beginWithOptions(String appToken, Map<String, dynamic> options) Future<void>
Initialize a TestFairy session with fine grained options.
bringFlutterToFront() Future<void>
Brings Flutter activity or view controller to front. Can be used for testing native plugins.
didLastSessionCrash() Future<bool>
Indicates in runtime whether your last session was crashed.
disableAutoUpdate() Future<void>
Disables auto update prompts for current session.
disableCrashHandler() Future<void>
Disables the ability to capture crashes. Must be called before begin.
disableFeedbackForm() Future<void>
Disables the ability to present users with feedback when devices is shaken, or if a screenshot is taken. Must be called before begin.
disableMetric(String metric) Future<void>
Disables recording of a metric regardless of build settings. Must be called be before begin.
disableVideo() Future<void>
Disables the ability to capture video recording. Must be called before begin.
enableCrashHandler() Future<void>
Enables the ability to capture crashes. Must be called before begin.
enableFeedbackForm(String method) Future<void>
Enables the ability to present the feedback form based on the method given. Must be called before begin.
enableMetric(String metric) Future<void>
Enables recording of a metric regardless of build settings. Must be called be before begin.
enableVideo(String policy, String quality, double framesPerSecond) Future<void>
Enables the ability to capture video recording regardless of build settings.
getSessionUrl() Future<String?>
Returns the address of the recorded session on TestFairy’s developer portal. Will return null if recording not yet started.
getVersion() Future<String>
Returns SDK version (x.x.x)
hideWidget(GlobalKey<State<StatefulWidget>> widgetKey) Future<void>
Hides a specific view from appearing in the video generated.
httpOverrides() HttpOverrides
Creates necessary overrides to be used with HttpOverrides.runWithHttpOverrides. Use this if you need to log all your http requests by default.
identify(String id) Future<void>
@Deprecated backward compatibility wrapper for setUserId. Use setUserId unless really necessary.
identifyWithTraits(String id, Map<String, dynamic> traits) Future<void>
@Deprecated backward compatibility wrapper for setUserId and setAttribute. Use those unless really necessary.
installCrashHandler(String appToken) Future<void>
Initialize crash reporting.
installFeedbackHandler(String appToken) Future<void>
Initialize shake gesture recognizer for launching the feedback form.
log(String message) Future<void>
Send a VERBOSE log message to TestFairy.
logError(dynamic error) Future<void>
Send a VERBOSE Error or Exception to TestFairy.
pause() Future<void>
Pauses the current session.
resume() Future<void>
Resumes the recording of the current session.
sendUserFeedback(String feedback) Future<void>
Send a feedback on behalf of the user.
setAttribute(String key, String value) Future<void>
Records an attribute that will be added to the session.
setCorrelationId(String id) Future<void>
@Deprecated backward compatibility wrapper for setUserId. Use setUserId unless really necessary.
setFeedbackOptions({String? defaultText, String? browserUrl, bool emailFieldVisible = true, bool emailMandatory = false, bool takeScreenshotButtonVisible = true, bool recordVideoButtonVisible = true, List<FeedbackFormField>? feedbackFormFields, dynamic onFeedbackSent(FeedbackContent) = emptyFeedbackContentFunction, dynamic onFeedbackCancelled() = emptyFunction, dynamic onFeedbackFailed(FeedbackContent) = emptyFeedbackContentFunction}) Future<void>
Customizes the feedback form.
setMaxSessionLength(double seconds) Future<void>
Sets the maximum recording time. Must be called before begin.
setScreenName(String name) Future<void>
Set a custom name for the current screen. Useful for applications that don't use more than one activity or view controller.
setServerEndpoint(String endpoint) Future<void>
Override the server endpoint address for using with on-premise installations and private cloud configuration.
setUserId(String id) Future<void>
Use this to tell TestFairy who the user is. It will help you to search the specific user in the TestFairy dashboard.
showFeedbackForm() Future<void>
Displays the feedback activity or view controller depending on your platform. Must be called after begin.
stop() Future<void>
Stops the current session recording. Unlike pause, when calling resume, a new session will be created and linked to the previous recording. Useful if you want short session recordings of specific use-cases of the app. Hidden widgets and user identity will be applied to the new session as well.