Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Spoon | 2,642 | 10 | 2 | 2 years ago | 38 | February 03, 2017 | 95 | apache-2.0 | HTML | |
Distributing instrumentation tests to all your Androids. | ||||||||||
Screenshot Tests For Android | 1,689 | 1 | 4 | 3 months ago | 21 | February 03, 2022 | 51 | apache-2.0 | Java | |
Generate fast deterministic screenshots during Android instrumentation tests | ||||||||||
Composer | 555 | 4 years ago | 61 | apache-2.0 | Kotlin | |||||
Reactive Android Instrumentation Test Runner. Archived. Marathon is recommended as an alternative (https://github.com/Malinskiy/marathon). | ||||||||||
Espresso Cucumber | 47 | 8 years ago | 1 | apache-2.0 | Java | |||||
Library to test Android applications using Espresso test framework with cucumber BDD language and Spoon screenshots | ||||||||||
Easy Screenshots | 22 | 2 years ago | 9 | apache-2.0 | Java | |||||
Android Instrumentation Test Screenshots made Easy. |
Android Instrumentation Test Screenshots made Easy.
androidTestCompile 'com.capitalone.easyscreenshots:easyscreenshots:1.1.0'
EasyScreenshots.takeScreenshot("clicking_button");
or (if you use a static import)
import static com.capitalone.easyscreenshots.EasyScreenshots.takeScreenshot;
...
takeScreenshot("clicking_button");
Note: at this point you would have screenshots taken and stored locally on the device.
Add the android.permission.WRITE_EXTERNAL_STORAGE
Permission to your app's AndroidManifest.xml
.
This is required in order to save the screenshots to the device's SD Card. You must declare the WRITE_EXTERNAL_STORAGE
permission. If your app is not already using this permission, we recommend you add it to a non-release build variant's manifest (ex. debug
).
Note: This cannot be added to your test application's manifest, it must be added to your normal app's manifest.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
GrantPermissionRule
- (Requires Android Testing Support Library 1.0.0 or Higher)
In order to work around this bug: https://issuetracker.google.com/issues/64389280, you currently need to grant READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE. So, you will need both of these in your application's manifest while this issues exists.
@Rule
public GrantPermissionRule permissionRule =
GrantPermissionRule.grant(android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
If you do NOT grant this permission, the following exception will be thrown.
java.lang.RuntimeException: Unable to capture screenshot.
Do you have the 'android.permission.WRITE_EXTERNAL_STORAGE' permission requested and granted?
Options:
Device File Explorer
in Android Studio and view the images.Alternatively, you can also use the Spoon Gradle Plugin, but only works with the Android Gradle Plugin <3.
Easy Screenshots uses a FileProvider
to provide the filepath for a taken screenshot.
By default, we provide the SpoonFileProvider
for Spoon compatibility, but you can create your own which will specify where you want the screenshots to be saved on the device by either:
screenshotFileProvider(...)
when constructing an EasyScreenshots
instance with an Initializer
.EasyScreenshots.setScreenshotFileProvider(...)
.Control when screenshots are taken by either:
policy(...)
when constructing an EasyScreenshots
instance with an Initializer
.EasyScreenshots.setPolicy(...)
.screenshot-policy
instrumentation argument.By default, we use Falcon for <18 and UiAutomator for 18+, which should meet most use-cases. If you'd like to force a specific library, you can call EasyScreenshots.setScreenshotLibrary(...)
with ex. new FalconScreenshotLibrary()
We welcome your interest in Capital Ones Open Source Project (the Project). Any Contributor to the Project must accept and sign a CLA indicating agreement to the CLA's terms. Except for the license granted in the CLA to Capital One and to recipients of software distributed by Capital One, you reserve all right, title, and interest in and to your contributions; this CLA does not impact your rights to use your own contributions for any other purpose.
This project adheres to the Open Source Code of Conduct. By participating, you are expected to honor this code.