TestCafe v0.21.0 Release Notes
-
โจ Enhancements
โ :gear: Test Web Pages Served Over HTTPS (#1985)
๐ท Some browser features (like Service Workers, Geolocation API, ApplePaySession, or SubtleCrypto) require a secure origin. This means that the website should use the HTTPS protocol.
โ Starting with v0.21.0, TestCafe can serve proxied web pages over HTTPS. This allows you to test pages that require a secure origin.
To enable HTTPS when you use TestCafe through the command line, specify the --ssl flag followed by the HTTPS server options. The most commonly used options are described in the TLS topic in the Node.js documentation.
testcafe --ssl pfx=path/to/file.pfx;rejectUnauthorized=true;...
๐ When you use a programming API, pass the HTTPS server options to the createTestCafe method.
'use strict'; const createTestCafe = require('testcafe'); const selfSignedSertificate = require('openssl-self-signed-certificate'); let runner = null; const sslOptions = { key: selfSignedSertificate.key, cert: selfSignedSertificate.cert }; createTestCafe('localhost', 1337, 1338, sslOptions) .then(testcafe => { runner = testcafe.createRunner(); }) .then(() => { return runner .src('test.js') // Browsers restrict self-signed certificate usage unless you // explicitly set a flag specific to each browser. // For Chrome, this is '--allow-insecure-localhost'. .browsers('chrome --allow-insecure-localhost') .run(); });
๐ See Connect to TestCafe Server over HTTPS for more information.
โ :gear: Construct Screenshot Paths with Patterns (#2152)
๐ You can include placeholders in the path, for example,
${DATE}
,${TIME}
,${USERAGENT}
, etc. For a complete list, refer to Path Pattern Placeholders.โ You should specify a screenshot path pattern when you run tests. Each time TestCafe takes a screenshot, it substitutes the placeholders with actual values and saves the screenshot to the resulting path.
๐ป The following example shows how to specify a screenshot path pattern through the command line:
testcafe all test.js -s path=screenshots,pathPattern=${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png
๐ When you use a programming API, pass the screenshot path pattern to the runner.screenshots method.
runner.screenshots({ path: 'reports/screenshots/', takeOnFails: true, pathPattern: '${TEST_INDEX}/${OS}/${BROWSER}-v${BROWSER_VERSION}/${FILE_INDEX}.png' });
โ :gear: Add Info About Screenshots and Quarantine Attempts to Custom Reports (#2216)
โ Custom reporters can now access screenshots' data and the history of quarantine attempts (if the test run in the quarantine mode).
The following information about screenshots is now available:
- the path to the screenshot file,
- the path to the thumbnail image,
- ๐ป the browser's user agent,
- the quarantine attempt number (if the screenshot was taken in the quarantine mode),
- โ whether the screenshot was taken because the test failed.
โ If the test was run in the quarantine mode, you can also determine which attempts failed and passed.
๐ Refer to the reportTestDone method description for details on how to access this information.
๐ Bug Fixes
- โ
HTML5 drag events are no longer simulated if
event.preventDefault
is called for themousedown
event (#2529) - โ File upload no longer causes an exception when there are several file inputs on the page (#2642)
- โ
File upload now works with inputs that have the
required
attribute (#2509) - โ
The
load
event listener is no longer triggered when added to an image (testcafe-hammerhead/#1688)