
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
screengrab
Advanced tools
deliver • screengrab • frameit • pem • sigh • produce • cert • spaceship • pilot • boarding • gym • scan • match
-------
screengrab generates localized screenshots of your Android app for different device types and languages for Google Play and can be uploaded using supply.
fastlane and supplyInstall the gem
sudo gem install screengrab
androidTestCompile 'tools.fastlane:screengrab:x.x.x'
The latest version can be determined by visiting the screengrab RubyGems page
Ensure that the following permissions exist in your src/debug/AndroidManifest.xml
<!-- Allows unlocking your device and activating its screen so UI tests can succeed -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Allows for storing and retrieving screenshots -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Allows changing locales -->
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
@ClassRule public static final LocaleTestRule localeTestRule = new LocaleTestRule(); to your tests class to handle automatic switching of localesScreengrab.screenshot("name_of_screenshot_here"); on the appropriate screensscreengrab you'll need a debug and test apk
./gradlew assembleDebug assembleAndroidTestscreengrab in your app project directory to generate screenshots
fastlane/metadata/android in the directory where you ran screengrabAs of screengrab 0.5.0, you can specify different strategies to control the way screengrab captures screenshots. The newer strategy delegates to UI Automator which fixes a number of problems compared to the original strategy:
However, UI Automator requires a device with API level >= 18, so it is not yet the default strategy. To enable it for all screenshots by default, make the following call before your tests run:
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
Running screengrab init generated a Screengrabfile which can store all of your configuration options. Since most values will not change often for your project, it is recommended to store them there.
The Screengrabfile is written in Ruby, so you may find it helpful to use an editor that highlights Ruby syntax to modify this file.
# remove the leading '#' to uncomment lines
# app_package_name 'your.app.package'
# use_tests_in_packages ['your.screenshot.tests.package']
# app_apk_path 'path/to/your/app.apk'
# tests_apk_path 'path/to/your/tests.apk'
locales ['en-US', 'fr-FR', 'it-IT']
# clear all previously generated screenshots in your local output directory before creating new ones
clear_previous_screenshots true
For more information about all available options run
screengrab --help
Check out Testing UI for a Single App for an introduction to using Espresso for UI testing.
@RunWith(JUnit4.class)
public class JUnit4StyleTests {
@ClassRule
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
@Rule
public ActivityTestRule<MainActivity> activityRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void testTakeScreenshot() {
Screengrab.screenshot("before_button_click");
onView(withId(R.id.fab)).perform(click());
Screengrab.screenshot("after_button_click");
}
}
There is an example project showing how to use use JUnit 3 or 4 and Espresso with the screengrab Java library to capture screenshots during a UI test run.
Using JUnit 4 is preferable because of its ability to perform actions before and after the entire test class is run. This means you will change the device's locale far fewer times when compared with JUnit 3 running those commands before and after each test method.
When using JUnit 3 you'll need to add a bit more code:
LocaleUtil.changeDeviceLocaleTo(LocaleUtil.getTestLocale()); in setUp()LocaleUtil.changeDeviceLocaleTo(LocaleUtil.getEndingLocale()); in tearDown()Screengrab.screenshot("name_of_screenshot_here"); to capture screenshots at the appropriate points in your testsIf you're having trouble getting your device unlocked and the screen activated to run tests, try using ScreenUtil.activateScreenForTesting(activity); in your test setup.
fastlane Toolchainfastlane: The easiest way to automate beta deployments and releases for your iOS and Android appssupply: Upload screenshots, metadata and your app to the Play StoreYou can find all the tools on fastlane.tools.
Please submit an issue on GitHub and provide information about your setup.
Help us keep screengrab open and inclusive. Please read and follow our Code of Conduct.
This project is licensed under the terms of the MIT license. See the LICENSE file.
This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All fastlane tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use fastlane tools.
FAQs
Unknown package
We found that screengrab demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.