Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Capture screenshots for Detox tests

Capture and access screenshots for your Detox test executions on BrowserStack App Automate.

As part of debugging, capturing screenshots makes it easier to identify the exact step in your test where the failure occurred. These screenshots also help identify any layout or design-related issues in your application.

Detox captures screenshots through its built-in screenshot artifact plugin. You configure the plugin in your Detox configuration file and capture screenshots from your test scripts. Detox testing on BrowserStack is supported on Android devices.

Enable screenshots in your Detox configuration

In your Detox configuration file, configure the screenshot artifact plugin. The following sample sets the plugin to capture screenshots for failing tests:

Detox configuration file

The screenshot plugin accepts the following values:

Value Description
none Do not capture any screenshots.
manual Capture only the screenshots taken using device.takeScreenshot() in your test scripts.
failing Capture screenshots for failing tests only.
all Capture screenshots for all tests.

Capture screenshots in your tests

Call the device.takeScreenshot('name') method to capture screenshots from your Detox tests, as shown in the following sample code snippet. The name parameter provides a name for the screenshot on your App Automate session details page.

Test script

View screenshots of the test execution

Navigate to your App Automate dashboard. On the session details page, click the Screenshots tab to view the captured screenshots.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle