问题
I can run the tests from the command line using
> ./node_modules/.bin/wdio wdio.conf.js
But if I try to run this from IntelliJ's run/debug configuration I get various different errors.
Featurefile or directory: /path_to_my_feature_file/myfeature.feature
Cucumber.js arguments: wdio.conf.js
Executable path: /path_to_my_project/node_modules/.bin/wdio
gives me
more than one config file specified
If I remove the Cucumber Arguments, it just runs indefinitely. If I stop it running I get the error
Failed loading configuration file
It looks like there's some kind of issue with loading the config file, but I don't know how to fix it. Any suggestions? wdio.conf.js exists and is in the project root.
回答1:
WebStorm doesn't provide any special support for wdio test runner. But you can still run/debug the tests using Node.js run configuration like the following:
But this doesn't work out of the box due to problems related to using non-tty environment (Node.js run console in IDEA is non-tty). As a workaround, please try commenting out if (process.stdin.isTTY) and else branch in node_modules\webdriverio\build\lib\cli.js:
//if (process.stdin.isTTY) {
launch();
/*
} else {
var stdinData = '';
/!*
* get a list of spec files to run from stdin, overriding any other
* configuration suite or specs.
*!/
var stdin = process.openStdin();
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
stdinData += data;
});
stdin.on('end', function () {
if (stdinData.length > 0) {
args['specs'] = stdinData.trim().split(/\r?\n/);
}
launch();
});
}*/
see WEB-31745
回答2:
To get this to work with webdriverio v5 and higher you need to set in the debug configurations screen above
the path to the runner as the javascript file to execute:
node_modules@wdio\cli\bin\wdio.js
and the conf file as the application parameters:
wdio.conf.js
来源:https://stackoverflow.com/questions/50724279/how-to-get-wdio-running-through-intellij-run-debug-configurations