TestCafe v1.6.0 Released

This release adds support for macOS 10.15 Catalina, introduces full-page screenshots and compound screenshot options.

🌟 Support for macOS 10.15 Catalina

This version provides compatibility with macOS 10.15. Update TestCafe to v1.6.0 if you run macOS Catalina.

Enhancements

⚙ Full-Page Screenshots (#1520)

TestCafe can now take screenshots that show the full page, including content that is not visible due to overflow.

Enable the fullPage option in CLI, API or configuration file to capture the full page on all screenshots. You can also pass this option to t.takeScreenshot to capture a single full-page screenshot.

Command line interface

Enable the fullPage parameter of the -s (--screenshots) flag:

testcafe chrome test.js -s fullPage=true

API

Pass the fullPage option to runner.screenshots:

runner.screenshots({
    fullPage: true
});

Configuration file

Set the screenshots.fullPage property:

{
    "screenshots": {
        "fullPage": true
    }
}

Test code

Pass the fullPage option to the t.takeScreenshot action:

t.takeScreenshot({
    fullPage: true
});

⚙ Compound Screenshot Options

The command line interface and configuration file schema have been updated to provide a more concise way to specify the screenshot options.

Note

TestCafe v1.6.0 also supports the existing options to maintain backward compatibility. However, these options are now marked deprecated in the documentation. In the future updates, we will deprecate them and emit warnings.

Command line interface

Screenshot options in CLI are now consolidated under the -s (--screenshots) flag in an option=value string:

testcafe chrome test.js -s takeOnFails=true,pathPattern=${DATE}_${TIME}/${FILE_INDEX}.png
Old Usage New Usage
-s artifacts/screenshots -s path=artifacts/screenshots
-S, --screenshots-on-fails -s takeOnFails=true
-p ${DATE}_${TIME}/${FILE_INDEX}.png -s pathPattern=${DATE}_${TIME}/${FILE_INDEX}.png

Configuration file

Configuration file properties that specify screenshot options are now combined in the screenshots object:

{
    "screenshots": {
        "path": "artifacts/screenshots",
        "takeOnFails": true,
        "pathPattern": "${DATE}_${TIME}/${FILE_INDEX}.png"
    }
}
Old Property New Property
screenshotPath screenshots.path
takeScreenshotsOnFails screenshots.takeOnFails
screenshotPathPattern screenshots.pathPattern

⚙ Default Screenshot Directory

TestCafe now saves the screenshots to ./screenshots if the base directory is not specified.

The --screenshots CLI flag, the runner.screenshots method or the screenshotPath configuration option are not required to take screenshots. For instance, you can run TestCafe with no additional parameters and use the t.takeScreenshot action in test code:

testcafe chrome test.js

test.js

fixture `My fixture`
    .page `https://example.com`;

test('Take a screenshot', async t => {
    await t.takeScreenshot();
});

The path argument in runner.screenshots is now optional.

runner.screenshots({
    takeOnFails: true
});

⚙ New Option to Disable Screenshots

We have added an option that allows you to disable taking screenshots. If this option is specified, TestCafe does not take screenshots when a test fails and when the t.takeScreenshot or t.takeElementScreenshot action is executed.

You can disable screenshots with a command line, API or configuration file option:

  • the --disable-screenshots command line flag

    testcafe chrome my-tests --disable-screenshots
    
  • the disableScreenshots option in the runner.run method

    runner.run({ disableScreenshots: true });
    
  • the disableScreenshots configuration file property

    {
        "disableScreenshots": true
    }
    

Bug Fixes

  • Fixed an error thrown when you pass the -b command line flag (#4294)
  • TestCafe no longer hangs when Firefox downloads a file (#2741)
  • You can now start tests from TypeScript code executed with ts-node (#4276)
  • Fixed TypeScript definitions for client script injection API (PR #4272)
  • Fixed TypeScript definitions for disablePageCaching (PR #4274)
  • Fixed a bug when anchor links did not navigate to their target destinations