WebdriverIO comes with its own test runner to help you start testing as quickly as possible.
Fiddling around hooking up WebdriverIO with a test framework is a thing of the past. The WebdriverIO runner does all the work for you, and helps you to run your tests as efficiently as possible.
Starting with v5, WebdriverIO's testrunner is bundled separately in the NPM package
Install it like this:
To see the command line interface help, just type the following command in your terminal:
Sweet! Now you need to define a configuration file where all information about your tests, capabilities, and settings are set. Switch over to the Configuration File section to see what that file should look like.
wdio configuration helper, it is super easy to generate your config file. Just run:
...and it launches the helper utility.
It will ask you questions and generate a config file for you in less than a minute.
Once you have your configuration file set up, you can start your tests by running:
That's it! Now, you can access to the selenium instance via the global variable
config command runs the WebdriverIO configuration helper. This helper will ask you a few questions about your WebdriverIO project and create a
wdio.conf.js file based on your answers.
This is the default command to run your configuration.
run command initializes your WebdriverIO configuration file and runs your tests.
Note: Autocompiling can be easily controlled with the appropriate library's ENV Vars. See also Test Runner's Auto Compilation functionality documented in TypeScript (ts-node) and Babel (@babel/register) pages.
install command allows you to add reporters and services to your WebdriverIO projects via the CLI.
If you want to install the packages using
yarn instead, you can pass the
--yarn flag to the command:
You could also pass a custom configuration path if your WDIO config file is not in the same folder you're working on:
The repl command allows to start an interactive command line interface to run WebdriverIO commands. It can be used for testing purposes or to just quickly spin up WebdriverIO session.
You can apply the same arguments as you can in the run command.