testfairy 1.0.8

testfairy #

TestFairy integration for Flutter, bundles with the native SDK.

Installation #

See details...

Quick Start #

Include the library and run your main app like this. Make sure your project is AndroidX compatible.

# inside pubspec.yaml

dependencies:
  testfairy: any
// inside your main.dart
import 'dart:async';
import 'dart:io';
import 'package:testfairy/testfairy.dart';

void main() {
    HttpOverrides.runWithHttpOverrides(
         () async {
           try {
             // Enables widget error logging
             FlutterError.onError =
                 (details) => TestFairy.logError(details.exception);
   
             // Initializes a session
             await TestFairy.begin(TOKEN);
   
             // Runs your app
             runApp(TestfairyExampleApp());
           } catch (error) {
   
             // Logs synchronous errors
             TestFairy.logError(error);
           }
         },
   
         // Logs network events
         TestFairy.httpOverrides(),
   
         // Logs asynchronous errors
         onError: TestFairy.logError,
   
         // Logs console messages
         zoneSpecification: new ZoneSpecification(
           print: (self, parent, zone, message) {
             TestFairy.log(message);
           },
         )
     );
}

How to update native SDKs? #

This is done automatically for Android.

If you need to update the native iOS SDK used by your current integration, run pod repo update; pod install in your ios directory.

Troubleshoot #

  1. I see Looks like TestFairy has an upgrade to do... 1.X.Y+hotfixZ is the latest stable branch or errors related to Jetifier in the logs when I call an SDK method.

Migrate your Android project to AndroidX by following this guide.

  1. I see Undefined symbols for architecture error during compilation.

You must use frameworks and specify a platform version of at least 9.0 in your generated iOS project's Podfile. Please make the following changes in ios/Podfile and rebuild.

target 'Runner' do
  platform :ios, '9.0'   ####################################### <--- add this and specify at least 9.0

  use_frameworks!        ####################################### <--- add this, and try building if there is 
                         #######################################      no Swift code or plugin in the project.
                         #######################################      If there is Swift code, please also add 
                         #######################################      the marked line below

  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '3.2'  ########## <--- add this, change the version to what's being
                                                      ##########      used in the project, remove if there is none
    end
  end
end
  1. CocoaPods could not find compatible versions for pod "TestFairy".

This is an old bug in the plugin pubspec file. First, run flutter clean in your root directory.

Please move ios/Podfile.lock into a temporary place before running pod repo update; pod install in your ios directory.

If some of the libraries you use need to be at specific versions, copy the necessary lines from your backed up Podfile.lock into the newly created one. Please keep the lines related to TestFairy (note the title case in the name) untouched.

Finally, run pod repo update; pod install; pod update TestFairy again to re-download libraries from the replaced lines.

If everything went smoothly, this issue should never happen again.

  1. There are syntax errors in TestFairyFlutterPlugin.java or TestFairyFlutterPlugin.m file.

In your project root, run flutter clean; cd ios; pod repo update; pod install; pod update TestFairy; cd .. and test again.

  1. My widget's are not hidden in screenshots.

This is currently not supported in iOS and will be fixed in the next release.

Docs #

Go to docs...

Features supported by both Android and iOS #

  • begin
  • beginWithOptions
  • setServerEndpoint
  • getVersion
  • sendUserFeedback
  • addCheckpoint
  • addEvent
  • setCorrelationId
  • identifyWithTraits
  • identify
  • setUserId
  • setAttribute
  • getSessionUrl
  • showFeedbackForm
  • stop
  • resume
  • pause
  • log
  • setScreenName
  • didLastSessionCrash
  • enableCrashHandler
  • disableCrashHandler
  • enableMetric
  • disableMetric
  • enableFeedbackForm
  • disableFeedbackForm
  • setMaxSessionLength
  • bringFlutterToFront
  • enableVideo
  • disableVideo
  • takeScreenshot
  • disableAutoUpdate
  • hideWidget

Features supported by only Android #

  • setFeedbackOptions

1.0.8 #

  • Added hideWidget() support for iOS.
  • Fixed missing screenshots in feedbacks.

1.0.7 #

  • Bugfix for small pixel buffers during screenshots in Android.

1.0.6 #

  • Embedded Flutter and v2 Android plugin support.

1.0.5 #

  • AndroidX support.

1.0.4 #

  • disableAutoUpdate() support.

1.0.3 #

  • Android Screenshots and hideWidget().
  • Network logging.

1.0.2 #

  • iOS Screenshots.

1.0.1 #

  • iOS support.

1.0.0 #

  • Initial release.
  • Android support.

example/README.md

Example SDK App (also includes test cases) #

Demonstrates how to use the TestFairy plugin. Execute flutter run in this folder to see it in action.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  testfairy: ^1.0.8

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:testfairy/testfairy.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Feb 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Fix lib/src/network_logging.dart. (-7.24 points)

Analysis of lib/src/network_logging.dart reported 15 hints, including:

line 40 col 3: Avoid return types on setters.

line 50 col 3: Avoid return types on setters.

line 60 col 3: Avoid return types on setters.

line 70 col 3: Avoid return types on setters.

line 80 col 3: Avoid return types on setters.

Fix lib/src/feedback_options.dart. (-1 points)

Analysis of lib/src/feedback_options.dart reported 2 hints:

line 19 col 6: Name non-constant identifiers using lowerCamelCase.

line 22 col 6: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/testfairy_base.dart. (-0.50 points)

Analysis of lib/src/testfairy_base.dart reported 1 hint:

line 96 col 60: The member 'screenshot' can only be used within instance members of subclasses of 'package:flutter/src/widgets/widget_inspector.dart'.

Format lib/testfairy.dart.

Run flutter format to format lib/testfairy.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8