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:

    ๐Ÿ†• 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 for iframes 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 an iframe without src 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 in iframes without src 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)