4

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.

rozza
  • 679
  • 1
  • 7
  • 19
  • what run configuration do you use? Please try Node.js - see https://i.stack.imgur.com/ieFVT.png – lena Jun 06 '18 at 17:48
  • thanks lena. I've been using cucumber.js. I tried Node.js as in your image - it doesn't error, but the tests don't seem to run either - they just don't do anything, looks like they start but don't stop, don't output anything. – rozza Jun 07 '18 at 08:10
  • known issue, please see my answer for a workaround – lena Jun 07 '18 at 13:17

2 Answers2

3

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:

enter image description here

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

lena
  • 73,196
  • 6
  • 110
  • 121
  • It's not working for me. I'm using IntellJ IDEA and have setup configuration as you mentioned it above, but I get this error when clicking on debug button (in my next comment). Can you help with that? Thanks in advance :) – mismas Sep 21 '18 at 09:25
  • `C:\WORK\IntelliJ_IDEA\project\node_modules\.bin\wdio:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) Waiting for the debugger to disconnect... Process finished with exit code 1` – mismas Sep 21 '18 at 09:28
  • you are passing a bash script as `.js` file to Node.js; change *Javascript file* path in your run configuration from `node_modules\.bin\wdio` to `node_modules\webdriverio\bin\wdio ` – lena Sep 21 '18 at 12:43
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