TestCafe v1.16.0 Release Notes

Release Date: 2021-09-08 // about 1 month ago
  • โœจ Enhancements

    ๐Ÿ‘Œ Support for JavaScript configuration files

    ๐Ÿ”ง You can now store TestCafe settings in a js file. Configuration properties in JavaScript files can reference JavaScript methods, functions and variables, which makes it easy to create dynamic configuration files.

    Just export the JSON name/value pairs in the file:

    module.exports = {
        skipJsErrors: true,
        hostname: "localhost",
        // other settings
    }
    

    ๐Ÿ‘Œ Support for custom user variables in the configuration file

    ๐Ÿ”ง TestCafe v1.16.0 and later supports configuration files with variable declarations. Users can reference variables from a configuration file in the tests that utilize that configuration file. To enable access to configuration file variables, import the userVariables object from the testcafe module at the beginning of the test script.

    ๐Ÿšš This capability can come in handy if there's a single piece of data you want to use in multiple tests โ€” for example, the website's URL. That way, if your website moves to a new domain name, you don't have to change your tests one by one.

    If you previously used environment variables to achieve the same goal, you might prefer the new method โ€” it significantly simplifies the setup process, and allows you to commit the data to a version control system.

    Define your custom variables with the userVariables JSON object:

    {
      "userVariables": {
        "url": "http://devexpress.github.io/testcafe/example",
      }
    }
    

    โœ… Reference this variable in your test:

    import { userVariables } from 'testcafe';
    
    fixture `Test user variables`
        .page(userVariables.url);
    
    test('Type text', async t => {
        await t
            .typeText('#developer-name', 'John Smith')
            .click('#submit-button');
    });
    

    Other enhancements

    • ๐Ÿ†• New option that disables thumbnail generation for test screenshots (PR by @taki-fw).
    • ๐Ÿ†• New embedding-utils API method that retrieves information about skipped tests (PR by @flora8984461).
    • โœ… The Runner.filter function supports asynchronous arguments (PR by @eignatyev).
    • โœ… You can import the test and fixture objects directly from the testcafe module (PR #6338).

    ๐Ÿ› Bug Fixes

    • โœ… TestCafe does not keep track of file changes in live mode (#6481).

Previous changes from v1.15.3

  • ๐Ÿ› Bug Fixes

    • โœ… TestCafe throws an error if you use the 'all' alias in the command line to run tests in all installed browsers (#6456).
    • ๐Ÿ”ง TestCafe does not check if the configuration file exists (#6337).
    • โœ… TestCafe cannot disable HTTP/2 to avoid compatibility issues (testcafe-hammerhead/#2681).
    • โœ… TestCafe works incorrectly if you use extended Function objects (testcafe-hammerhead/#2439).
    • โœ… TestCafe processes a test application incorrectly if it uses the Immutable.js library (testcafe-hammerhead/#2669).
    • โœ… TestCafe adds an element incorrectly into a nested body element (PR testcafe-hammerhead/#2682).