Testcafe: take screenshot only when test fails

Created on 1 Feb 2018  路  3Comments  路  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

Feature

What is the current behavior?

testcafe provide a way to take screenshot

What is the expected behavior?

a callback function or similar which check if test/assertion/action fails and take screenshot

Auto-locked

Most helpful comment

You can use -S flag to take screenshots on failures.

-S, --screenshots-on-fails
Takes a screenshot whenever a test fails. Screenshots are saved to the directory specified by using the -screenshots <path> option.

For example, the following command runs tests from the  sample-fixture.js file in all browsers, takes screenshots if tests fail, and saves the screenshots to the  screenshots directory.

testcafe all tests/sample-fixture.js -S -s screenshots

All 3 comments

You can use -S flag to take screenshots on failures.

-S, --screenshots-on-fails
Takes a screenshot whenever a test fails. Screenshots are saved to the directory specified by using the -screenshots <path> option.

For example, the following command runs tests from the  sample-fixture.js file in all browsers, takes screenshots if tests fail, and saves the screenshots to the  screenshots directory.

testcafe all tests/sample-fixture.js -S -s screenshots

very good :)

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings