You can run the test from a command shell by calling a single command where you specify the target browser and file path. TestCafe automatically opens the chosen browser and starts test execution within it. Make sure the browser tab that runs tests stays active. Do not minimize the browser window.
How do I run a TestCafe file?
You can run TestCafe tests from the command line or JavaScript/TypeScript API. TestCafe also allows you to create a configuration file where you can define test run settings. You can then omit these settings in the command line or API to use values from the configuration file.
How do I run TestCafe locally?
- the npx command: npx testcafe chrome tests/
- the yarn run command: yarn run testcafe chrome tests/
- npm scripts – add the testcafe command to the scripts section in package.json : “scripts”: { “test”: “testcafe chrome tests/” }