New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

testcafe

Package Overview
Dependencies
Maintainers
6
Versions
466
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testcafe - npm Package Versions

1
46
47

2.6.0

Diff
kirovboris
published 2.6.0 •

Changelog

Source

v2.6.0 (2023-05-11)

TestCafe v2.6.0 introduces two enhancements: a new hook that allows users to modify reporter output, and support for JavaScript configuration files with the .cjs extension.

New reporter hook

The onBeforeWrite hook allows you to modify the output of a reporter.

If you want your test reports to include custom content, you can create a custom reporter from scratch. However, this approach takes time and effort. Use the onBeforeWrite hook if you want to make minor changes to the output of an existing reporter.

Define an onBeforeWrite hook in a JavaScript configuration file. The following hook adds the duration in milliseconds to every test entry in the report:

//.testcaferc.js or .testcaferc.cjs
function onBeforeWriteHook(writeInfo) { // This function will fire every time the reporter calls the "write" method.
    if (writeInfo.initiator === 'reportTestDone') { // The "initiator" property contains the name of the reporter event that triggered the hook.
         const {
            name,
            testRunInfo,
            meta
        } = writeInfo.data || {}; // If you attached this hook to a compatible reporter (such as "spec" or "list"), the hook can process data related to the event.
        const testDuration = testRunInfo.durationMs; // Save the duration of the test.
        writeInfo.formattedText = writeInfo.formattedText + ' (' + testDuration + 'ms)'; // Add test duration to the reporter output.
    };
}


module.exports = { // Attach the hook
    hooks: {
        reporter: {
            onBeforeWrite: {
                'spec': onBeforeWriteHook, // This hook will fire when you use the default "spec" reporter.
            },
        },
    },
};

Reporter hook demonstration

CJS support

If you run TestCafe v2.6.0 and higher, you can now use a configuration file with the .cjs file extension. TestCafe detects the .testcaferc.cjs file on startup, alongside its .js and .json counterparts.

TestCafe configuration files only support CommonJS syntax. Meanwhile, modern JavaScript tools often default to ESM syntax. If a JavaScript project is of type module, Node.js expects the project's .js files to contain ESM syntax.

Use the .cjs configuration file extension to let Node.js know that the file contains CommonJS syntax.

Many thanks to the TestCafe contributor Damien Guérin (@gigaga) for the implementation of this capability.

Bug fixes

  • If you call the t.skipJsErrors method without arguments, TestCafe passes a false value to the method. This behavior is inconsistent with similar methods of a greater scope --- test.skipJsErrors and fixture.skipJsErrors (#7648).
  • Users cannot disable the "quarantine mode" or "skipJsErrors" settings from the command line (#7077).
  • TestCafe incorrectly processes exceptions of types other than Error (#7627).
  • TestCafe does not consistently execute the t.pressKey action in Mozilla Firefox. Attempts to press the "backspace" key and the "tab" key, among others, may fail. (#7623)
  • When TestCafe runs in Native Automation mode, it incorrectly executes some instances of the t.request method. (#7609)
  • The TestCafe proxy incorrectly processes private class properties in client-side scripts, which leads to page load failure (#7632, PR by @sorin-davidoi).
kirovboris
published 2.6.0-rc.1 •
kirovboris
published 2.5.1-rc.1 •
kirovboris
published 2.5.0 •

Changelog

Source

v2.5.0 (2023-04-06)

TestCafe v2.5.0 introduces three major enhancements:

  • The new t.report method passes custom data to the test reporter.
  • The new --native-automation flag enables TestCafe to automate all Chromium-based browsers with the native CDP protocol.
  • The new --esm flag allows users to import ESM modules in test files.
kirovboris
published 2.5.0-rc.3 •
kirovboris
published 2.5.0-rc.2 •
kirovboris
published 2.5.0-rc.1 •
kirovboris
published 2.4.0 •

Changelog

Source

v2.4.0 (2023-03-06)

TestCafe v2.4.0 introduces the Visual Selector Debugger. You can now create and debug Selector queries in the browser window.

Visual Selector Debugger

TestCafe v2.4.0 displays the Visual Selector Debugger panel when you activate Debug Mode. Use the panel to debug Selector queries from your test, or generate new Selector queries.

If a Selector query causes your test to fail, add the t.debug() command after the last successful action, and launch the test.

When the test reaches the breakpoint, the window that runs the test displays the Selector Debugger panel. Copy the failing Selector query from test code to the Selector Debugger input field.

  • TestCafe highlights page elements that match the Selector query.
  • If no elements match the Selector query, the panel displays the No Matching Elements warning.
  • If your Selector query contians a syntax error, the panel displays the Invalid Selector warning.

To interactively generate a Selector query, click the Pick button, and select the target element on the page.

For more information on the panel, its capabilities, and limitations, read the Visual Selector Debugger Guide.

Bug Fixes

kirovboris
published 2.4.0-rc.1 •
kirovboris
published 2.3.1 •

Changelog

Source

v2.3.1 (2023-02-09)

TestCafe v2.3.1 introduces a number of bug fixes.

Bug Fixes

  • Client-side code with optional chaining may trigger a TestCafe error (#7387).
  • TestCafe cannot interact with images from the Shadow DOM (#7454).
  • TestCafe v2.3.0 fails to launch when the test.meta method precedes test code (#7482).
  • When TestCafe launches a headless instance of Google Chrome in proxyless mode, it cannot interact with elements that are overlapped by the status bar (#7483).