TestCafe v1.10.0 Release Notes
Release Date: 2020-12-15 // over 3 years ago-
โจ Enhancements
๐ Window Resize and Screenshot Support for Child Windows in Chrome (PR #5661, PR #5567)
๐ You can now use the following actions in Google Chrome when you switch the test context to a child window:
- ๐ t.maximizeWindow
- ๐ t.resizeWindow
- ๐ t.resizeWindowToFitDevice
- ๐ t.takeElementScreenshot
- ๐ t.takeScreenshot
๐ New API to Specify Compiler Options (#5519)
In previous versions, you used the following methods to specify TypeScript compiler options:
๐ the --ts-config-path command line flag
testcafe chrome my-tests --ts-config-path path/to/config.json
๐ the runner.tsConfigPath method
runner.tsConfigPath('path/to/config.json');
๐ the tsConfigPath configuration file property
{ "tsConfigPath": "path/to/config.json" }
๐ In v1.10.0, we introduced a new easy-to-use API that allows you to specify the compiler options in the command line, API or TestCafe configuration file, without creating a separate JSON file. The new API is also designed to accept options for more compilers (for instance, Babel) in future releases.
The API consists of the following members:
๐ the --compiler-options command line flag
testcafe chrome my-tests --compiler-options typescript.experimentalDecorators=true
๐ the runner.compilerOptions method
runner.compilerOptions({ typescript: { experimentalDecorators: true } });
๐ the compilerOptions configuration file property
{ "compilerOptions": { "typescript": { "experimentalDecorators": true } } }
๐ง If you prefer to keep compiler settings in a configuration file, you can use the new API to specify the path to this file:
testcafe chrome my-tests --compiler-options typescript.configPath='path/to/config.json'
In v1.10.0, you can customize TypeScript compiler options only.
๐ For more information, see TypeScript and CoffeeScript.
โ Added a Selector Method to Access Shadow DOM (PR #5560 by @mostlyfabulous)
๐ This release introduces the selector.shadowRoot method that allows you to access and interact with the shadow DOM elements. This method returns a shadow DOM root hosted in the selector's matched element.
import { Selector } from 'testcafe' fixture `Target Shadow DOM elements` .page('https://devexpress.github.io/testcafe/example') test('Get text within shadow tree', async t => { const shadowRoot = Selector('div').withAttribute('id', 'shadow-host').shadowRoot(); const paragraph = shadowRoot.child('p'); await t.expect(paragraph.textContent).eql('This paragraph is in the shadow tree'); });
๐ Note that you should chain other selector methods to selector.shadowRoot to access elements in the shadow DOM. You cannot interact with the root element (an error occurs if you specify
selector.shadowRoot
as an action's target element).๐ Bug Fixes
- โ Browsers now restart correctly on BrowserStack when the connection is lost (#5238)
- ๐ Fixed an error that occurs if a child window is opened in an
iframe
(#5033) - ๐ TestCafe can now switch between the child and parent windows after the parent window is reloaded (#5463, #5597)
- ๐ Fixed an issue when touch and mouse events fired on mobile devices even though the mouse event was prevented in page code (#5380)
- โ
Cross-domain
iframes
are now focused correctly in Safari (#4793) - ๐ Fixed an excessive warning displayed when an assertion is executed in a loop or against an element returned by a
selector.xxxSibling
method (#5449, #5389) - โ
A page error is no longer emitted if the destination server responded with the
304
status (#5025) - ๐ Fixed an issue when TestCafe could not authenticate websites that use MSAL (#4834)
- โ
The
srcdoc
attributes foriframes
are now processed (testcafe-hammerhead/#1237) - โ
The
authorization
header is now preserved in response headers of fetch requests (testcafe-hammerhead/#2334) - โ
The
document.title
for aniframe
withoutsrc
can now be correctly obtained in Firefox (PR testcafe-hammerhead/#2466) - โ TestCafe UI is now displayed correctly if the tested page's body content is added dynamically (PR testcafe-hammerhead/#2454)
- โ
Service Workers now receive
fetch
events (testcafe-hammerhead/#2412) - ๐ Fixed the case of headers sent to the web app server (testcafe-hammerhead/#2344)
- โ
Location
objects iniframes
withoutsrc
now contain the correct data (PR testcafe-hammerhead/#2448) - โ Native function wrappers are now converted to strings correctly (testcafe-hammerhead/#2394)
- โ Values retrieved from the local storage are now converted to strings (testcafe-hammerhead/#2313)
- ๐ Fixed an issue when relative URLs were resolved incorrectly in
iframes
(testcafe-hammerhead/#2461) - ๐ Fixed an issue when TestCafe took a very long time to process large CSS files (testcafe-hammerhead/#2475)
- ๐ Fixed an issue with client-side JavaScript processing (testcafe-hammerhead/#2442)
- ๐ Fixed an issue that suppressed Adobe Launch Analytics requests (testcafe-hammerhead/#2453)
- โ Added support for Web Workers created from Blob URLs (testcafe-hammerhead/#1221)
- ๐ Fixed an issue when network requests were not received by the server (testcafe-hammerhead/#2467)
- โ
Cross-domain
iframe
source links now have the correct protocol when SSL is used (PR testcafe-hammerhead/#2478)