CLI

This guide lists the QA Wolf commands you can run in the CLI.

Use environment variables

You can use environment variables when running CLI commands.

For example, run the following to save artifacts of your test with QAW_ARTIFACT_PATH:

QAW_ARTIFACT_PATH=/tmp/artifacts npx qawolf create www.myawesomesite.com

npx qawolf --help

See all commands and options.

npx qawolf create url [name][...options]

Create a browser test on a Chromium browser.

Arguments

[--device name] (string): Emulate a supported device. See this guide to learn more. Default: No device emulation.

[--statePath file] (string): File where state data (cookies, localStorage, sessionStorage) is saved. If provided, the state will be set before you create your test. Default: null.

url (string): Visit this URL to begin your test.

[name] (string): The name of your test file. The file will be saved at ${rootDir}/${name}.test.js. Default: the hostname of the provided URL.

Examples

Create a browser test on www.google.com, emulating an iPhone 7:

npx qawolf create --device="iPhone 7" www.google.com

Create a browser test on www.google.com, saving it at .qawolf/myTest.test.js:

npx qawolf create www.google.com myTest

Create a brower test on www.google.com, loading state data from .qawolf/state/admin.json:

npx qawolf create --statePath=./.qawolf/state/admin.json www.google.com

npx qawolf edit name

Edit an existing test.

Arguments

name (string): A string that matches exactly one test file name.

[--watch] (string): Watch file for changes and rerun when something changes.

Examples

Edit the test saved at .qawolf/myTest.test.js:

npx qawolf edit myTest

Edit the test saved at .qawolf/myReallySuperLongTestName.test.js (assuming there are no other tests with names that match TestName):

npx qawolf edit TestName

When using edit mode, you can add steps to an existing test by calling the qawolf.create method in your test code. The test will pause when qawolf.create is called, allowing you to use the browser to generate additional code.

// ...
test('myTest', async () => {
await page.goto('http://todomvc.com/examples/react');
// previous test steps
// ...
// call qawolf.create to add steps
await qawolf.create();
});

npx qawolf test [name][...options]

Run your test(s) with Jest. Tests run on a Chromium browser by default.

Arguments

[--all-browsers] (boolean): Run your test(s) on Chromium, Firefox, and WebKit.

[--firefox] (boolean): Run your test(s) on Firefox.

[--headless] (boolean): Run your test(s) in headless mode.

[--webkit] (boolean): Run your test(s) on WebKit.

[name] (string): The name of the test file to run. For example, passing myTestName will run the ${rootDir}/tests/myTestName.test.js file. Default: run all tests.

[...jestOptions] (Jest CLI Options): Options for the Jest CLI.

Examples

Run all tests:

npx qawolf test

Run the test saved at .qawolf/myTest.test.js:

npx qawolf test myTest

Run the test saved at .qawolf/myTest.test.js on Chromium, Firefox, and WebKit:

npx qawolf test --all-browsers myTest

Run all tests in headless mode:

npx qawolf test --headless

Use the --runInBand Jest CLI option to run tests serially:

npx qawolf test --runInBand

npx qawolf howl

🐺😉