A screenshot image with overlaid status bar and appended navigation bar placed in a device frame.
For introduction to Screenshots see https://medium.com/@nocnoc/automated-screenshots-for-flutter-f78be70cd5fd.
Screenshots is a standalone command line utility and package for capturing screenshot images for Flutter.
Screenshots will start the required android emulators and iOS simulators (or find attached devices), run your screen capture tests on each emulator/simulator (or device), process the images, and drop them off to Fastlane for delivery to both stores.
It is inspired by three tools from Fastlane:
Since all three of these Fastlane tools do not work with Flutter, Screenshots combines key features of all three Fastlane tools into one tool. Plus, it is much easier to use!
Screenshots main features includes:
Additional automation features:
$ brew update && brew install imagemagick $ pub global activate screenshots
Or, if using a config file other than the default 'screenshots.yaml':
$ screenshots -c <path to config file>
A special function is provided in the Screenshots package that is called by the test each time you want to capture a screenshot. Screenshots will then process the images appropriately during a Screenshots run.
To capture screenshots in your tests:
screenshots: ^<current version>
import 'package:screenshots/config.dart'; import 'package:screenshots/capture_screen.dart';
final Map config = Config().config;
await screenshot(driver, config, 'myscreenshot1');
Note: make sure your screenshot names are unique across all your tests.
Note: to turn off the debug banner on your screens, in your integration test's main(), call:
WidgetsApp.debugAllowBannerOverride = false; // remove debug banner for screenshots
Screenshots uses a configuration file to configure a run.
The default config filename is
# A list of screen capture tests tests: - test_driver/main1.dart - test_driver/main2.dart # Note: flutter driver expects a pair of files for testing # For example: # main1.dart is the test app (that calls your app) # main1_test.dart is the matching test that flutter driver # expects to find. # Interim location of screenshots from tests staging: /tmp/screenshots # A list of locales supported by the app locales: - de-DE - en-US # A list of devices to emulate devices: ios: - iPhone X - iPad Pro (12.9-inch) (2nd generation) android: - Nexus 6P # Frame screenshots frame: true
Note: emulators and simulators corresponding to the devices in your config file must be installed on your test machine.
Since Screenshots is intended to be used with Fastlane, after Screenshots completes, the images can be found in your project at:
Tip: The easiest way to use Screenshots with Fastlane is to call Screenshots before calling Fastlane. Calling Fastlane (for either iOS or Android) will then find the images in the appropriate place.
(For a live demo of using Fastlane to upload screenshot images to both store consoles, see demo of Fledge at https://github.com/mmcc007/fledge#demo)
To change the devices to run your tests on, just change the list of devices in screenshots.yaml.
Make sure the devices you select have supported screens and corresponding emulators/simulators.
Note: In practice, multiple devices share the same screen size.
Devices are therefore organized by supported screen size in a file called
For each selected device:
Screenshots will check your configuration before running.
To upgrade, simply re-issue the install command
$ pub global activate screenshots
Note: the Screenshots version should be the same for both the command line and package:
To view the images generated by Screenshots during run on travis see:
Your feedback is welcome and is used to guide where development effort is focused. So feel free to create as many issues and pull requests as you want. You should expect a timely and considered response.
The default counter app with internationalization support.
This is an app that demonstrates
First confirm emulators/simulators are installed for the following devices:
# A list of devices to emulate devices: ios: - iPhone X - iPad Pro (12.9-inch) (2nd generation) android: - Nexus 6P
The run with:
The generated screenshots can be found in:
screenshots running with this example app on travis see:
To download the images generated by
screenshots during run on travis see:
You can install the package from the command line:
$ pub global activate screenshots
The package has the following executables:
Add this to your package's pubspec.yaml file:
dependencies: screenshots: ^0.1.7
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.1.7||Apr 4, 2019|
|0.1.6||Mar 14, 2019|
|0.1.5||Mar 5, 2019|
|0.1.4||Feb 21, 2019|
|0.1.3||Feb 13, 2019|
|0.1.2||Feb 4, 2019|
|0.1.1||Feb 3, 2019|
|0.1.0||Jan 26, 2019|
|0.0.2||Jan 25, 2019|
|0.0.1||Jan 19, 2019|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Apr 12, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, other
|Dart SDK||>=2.0.0 <3.0.0|