TestCafe v3.6.0 Released

The TestCafe v3.6.0 update includes the t.getcurrentCDPSession method, support for Chromium’s new headless mode engine, and a number of bug fixes.

New method: t.getCurrentCDPSession

The t.getCurrentCDPSession method allows native automation users to examine and control the CDP connection between TestCafe and the browser.

Use the method to obtain the Chrome DevTools Protocol object for the current session. The CDP object exposes properties and methods that pertain to the CDP connection between TestCafe and the active browser window.

fixture `Get current CDP session`
    .page('https://devexpress.github.io/testcafe/example');

test(`Get current CDP session`, async t => {
    const mainWindowId = await t.testRun.activeWindowId;

    let clientCDP = await t.getCurrentCDPSession();

    await t.expect(clientCDP.webSocketUrl).contains(mainWindowId);
}

Headless browser connection

TestCafe v3.6.0 takes advantage of Chromium’s recent headless mode upgrade. The new headless mode offers better reliability and higher emulation accuracy.

The move to a new headless mode engine may cause unexpected changes to your tests’ behavior. Take note of the following:

  • Headless Chromium now automatically upgrades insecure HTTP requests to HTTPS.
  • Headless Chromium does not always honor the --window-size flag. This behavior is a known Chromium bug.

Bug Fixes

  • [Native automation] TestCafe does not execute the maximizeWindow() method in beforeEach hooks (#8117).
  • If TestCafe launch options include --esm, the framework crashes on launch in environments with Node.js v20 and up (#8132).
  • The Linux-based Docker image of TestCafe cannot run tests in headless Chromium (#8145).
  • TestCafe incorrectly crops Safari screenshots (#8154).