Specific file location required by WebStorm for protractor.conf.js to work?

I have an issue of the "oddly specific" variety. For a specific repo, my team decided that they would keep our protractor configuration in e2e/protractor.conf.js. This protractor configuration works fine from the command-line and within VSCode, but gives me issues as a WebStorm user. Specifically, I was having trouble debugging protractor tests within the IDE with this configuration.

I did some additional investigation, and I was able to work around the problem by doing the following:

  1. Move the protractor.conf.js file into the root of the repository
  2. Update all the relative paths in the protractor.conf.js file accordingly

Here is my question: Does WebStorm mandate that the protractor.conf.js file be placed in the root of the repository/project? If so, what would be the recommended way for me to correct this? It is unlikely that I'm going to be able to persuade a larger group of VSCode users to move this file.

4 comments

Just in case it helps, here is the error I was seeing when running the debug configuration:

```
[11:00:01] I/launcher - Running 1 instances of WebDriver
[11:00:01] I/direct - Using ChromeDriver directly...
Waiting for the debugger to disconnect...
[11:00:16] E/launcher - Error: Error: Cannot find module '@e2e/page-objects/naq/unapproved-grants-table.po'
at Function.Module._resolveFilename (module.js:547:15)

```

The "cannot find module" part appears to be related to whatever lookup process is being used to track down the source files used in import statements.

0

WebStorm lets you select your protractor.conf.js in run configuration, so no - it doesn't expect it to be located in root.

The actual issue, I suppose, it that it sets current working dir to the folder where the chosen protractor.conf.js is located. And it seems that your tests only work if process.cwd is equal to project root folder

1

Great answer! Unfortunately changing that behavior also might be challenging. I might just have to whip up a quick and dirty script to perform the operations I described in my post each time I want to run tests. Not perfect, but better than using another IDE :)

0

Providing a way to specify the working directory explicitly in protractor run configuration would be helpful, I suppose... Please feel free to file a request for this feature to youtrack, https://youtrack.jetbrains.com/issues/WEB

0

Please sign in to leave a comment.