TestCafe v1.11.0 Released

This version brings the release of multiple browser windows mode, options to configure request timeouts and many bugfixes.

Enhancements

Multiple Browser Windows is Live (#912)

Testing in multiple browser windows is now stable.

To take full advantage of testing in multiple windows with TestCafe, read Multiple Browser Windows.

⚙ Set Request Timeouts (PR #5692)

TestCafe now enables you to set request timeouts. If TestCafe receives no response within the specified period, it throws an error.

CLI

testcafe chrome my-tests --ajax-request-timeout 40000 --page-request-timeout 8000

Configuration file

{
    "pageRequestTimeout": 8000,
    "ajaxRequestTimeout": 40000
}

JavaScript API

These options are available in the runner.run Method.

const createTestCafe = require('testcafe');
const testcafe = await createTestCafe('localhost', 1337, 1338);
try {
    const runner = testcafe.createRunner();
    const failed = await runner.run({
        pageRequestTimeout: 8000,
        ajaxRequestTimeout: 40000
    });
    console.log('Tests failed: ' + failed);
}
finally {
    await testcafe.close();
}

⚙ Set Browser Initialization Timeout (PR #5720)

This release introduces an option to control browser initialization timeout. This timeout controls the time browsers have to connect to TestCafe before an error is thrown. You can control this timeout in one of the following ways:

testcafe chrome my-tests --browser-init-timeout 180000
{
    "browserInitTimeout": 180000
}
runner.run({ "browserInitTimeout": 180000 })

This setting sets an equal timeout for local and remote browsers.

Improved Unable To Establish Browser Connection Error Message (PR #5720)

TestCafe raises this error when at least one local or remote browser was not able to connect. The error message now includes the number of browsers that have not established a connection.

TestCafe raises a warning if low system performance is causing the connectivity issue.

⚙ An Option to Retry Requests for the Test Page (PR #5738)

If a tested webpage was not served after the first request, TestCafe can now retry the request.

You can enable this functionality with a command line, API, or configuration file option:

  • the --retry-test-pages command line argument

    testcafe chrome test.js --retry-test-pages
    
  • the createTestCafe option

    const createTestCafe = require('testcafe');
    
    const testcafe = await createTestCafe('localhost', 1337, 1338, retryTestPages)
    
  • the retryTestPages configuration file property

    {
        "retryTestPages": true
    }
    

Bug Fixes

  • Fixed a bug where Selector.withText couldn’t locate elements inside an iframe (#5886)
  • Fixed a bug where TestCafe was sometimes unable to detect when a browser instance closes (#5857)
  • You can now install TestCafe with Yarn 2 (PR #5872 by @NiavlysB)
  • Fixed a bug where the typeText action does not always replace existing text (PR #5942 by @rueyaa332266)
  • Fixed a bug where TestCafe was sometimes unable to create a Web Worker from an object
  • Fixed an error thrown by TestCafe proxy when trying to delete an object property that does not exist
  • Fixed an error thrown by TestCafe proxy when a Service Worker overwrites properties of a window object
  • Fixed a bug where t.openWindow method requested a URL twice
  • Fixed an error (TypeError: Illegal invocation) thrown by TestCafe on pages that contain an XMLDocument with an iframe
  • Fixed an error (SyntaxError: Identifier has already been declared) thrown by TestCafe on pages with scripts that create nested JavaScript objects
  • Fixed a bug where TestCafe was unable to focus elements within shadow DOM
  • TestCafe now throws an error when an entity of type other than Error is thrown in a test script
  • Fixed a bug where TestCafe was sometimes unable to resolve relative URLs
  • Properties of window.location.constructor are now shadowed correctly by TestCafe proxy
  • TestCafe proxy now correctly handles requests that are not permitted by the CORS policy
  • Improved compatibility with test pages that use with statements
  • TestCafe proxy can now properly parse statements that use a comma operator in for..of loops
  • Fixed a bug where TestCafe would open a new window even if preventDefault is present in element’s event handler (testcafe-hammerhead/#2582)

Vulnerability Fix (PR #5843, PR testcafe-hammerhead#2531)

We have fixed a vulnerability found in the debug module we use for debugging. The vulnerability was a ReDos Vulnerability Regression that affected all TestCafe users. TestCafe now uses debug@4.3.1, where the issue is fixed.