TestCafe v0.23.1 Released

Use metadata to select and run tests and fixtures, and load tests dynamically.

Enhancements

⚙ Select Tests and Fixtures to Run by Their Metadata (#2527) by @NickCis

You can now run only those tests or fixtures whose metadata contains a specific set of values. Use the --test-meta and --fixture-meta flags to specify these values.

testcafe chrome my-tests --test-meta device=mobile,env=production
testcafe chrome my-tests --fixture-meta subsystem=payments,type=regression

In the API, test and fixture metadata is now passed to the runner.filter method in the testMeta and fixtureMeta parameters. Use this metadata to build a logic that determines whether to run the current test.

runner.filter((testName, fixtureName, fixturePath, testMeta, fixtureMeta) => {
    return testMeta.mobile === 'true' &&
        fixtureMeta.env === 'staging';
});

⚙ Run Dynamically Loaded Tests (#2074)

You can now run tests imported from external libraries or generated dynamically even if the .js file does not contain any tests.

Previously, test files had to contain the fixture and test directives. You can now add the --disable-test-syntax-validation command line flag to bypass this check.

testcafe safari test.js --disable-test-syntax-validation

In the API, use the disableTestSyntaxValidation option.

runner.run({ disableTestSyntaxValidation: true })

Bug Fixes

  • Touch events are now simulated with correct touch properties (touches, targetTouches, changedTouches) (#2856)
  • Google Chrome now closes correctly on macOS after tests are finished (#2860)
  • Internal attribute and node changes no longer trigger MutationObserver notifications
  • The ECONNABORTED error is no longer raised
  • Websites that use Location.ancestorOrigins are now proxied correctly