Changelog
v1.17.0 (2021-11-02)
You can now specify global test and fixture hooks. TestCafe attaches these hooks to every test / fixture in the test suite.
module.exports = {
hooks: {
fixture: {
before: async (ctx) => {
// your code
},
after: async (ctx) => {
// your code
}
},
test: {
before: async (t) => {
// your code
},
after: async (t) => {
// your code
}
}
}
};
You can now specify custom timeouts for tests and test runs. If a test/test run is idle or unresponsive for the specified length of time, TestCafe terminates it. Specify these timeouts in the configuration file or from the command line.
Command line interface
testcafe chrome my-tests --test-execution-timeout 180000
testcafe chrome my-tests --run-execution-timeout 180000
Configuration file
{
"runExecutionTimeout": 180000,
"testExecutionTimeout": 180000
}
Changelog
v1.16.0 (2021-09-08)
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
}
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');
});
embedding-utils
API method that retrieves information about skipped tests (PR by @flora8984461).Runner.filter
function supports asynchronous arguments (PR by @eignatyev).test
and fixture
objects directly from the testcafe
module (PR #6338).Changelog
v1.15.3 (2021-08-19)
Changelog
v1.15.2 (2021-08-11)
tab
action if a page contains a cross-domain iframe (#6405).