Roozenboom / rbnx

Nx plugin for WebdriverIO support
https://www.npmjs.com/package/@rbnx/webdriverio
MIT License
10 stars 1 forks source link

Could not execute "run" due to missing configuration, file #13

Closed octadecimal closed 1 year ago

octadecimal commented 1 year ago

Current Behavior

Hi, thanks for the cool library and taking the initiative to develop it. Out-of-the-box Nx integration with wdio is something I've wished for.

I've set up a test Nx workspace: Project Name Project Path Nx Generator
client apps/client @nx/react
client-e2e apps/client-e2e @rbnx/webdriverio

When I run:

nx e2e client-e2e

I get the error:

C:\Workspace\wdiotest\node_modules\.bin\wdio wdio.generated.config.ts

Could not execute "run" due to missing configuration, file

I see that the executed command is passing wdio.generated.config.ts as if it lived at the workspace root, however the file is generated in the project's root (apps/client-e2e/wdio.generated.config.ts).

If I change this line in run-wdio.ts, to use configPath instead of configFile from:

let command = `${getPackageManagerCommand().exec} wdio ${configFile}`;  // configFile

to:

let command = `${getPackageManagerCommand().exec} wdio ${configPath}`; // configPath

...it fixes this issue.

However, then the import path pointing to wdio.config is incorrect. I can modify files/wdio.generated.config.ts__tmpl__ to fix this.

So while I can workaround it, I can't help but to think I must be doing something fundamentally wrong, as I'd imagine such an obvious issue like this likely wouldn't be present.

Would you be able to offer me some guidance here, so that I could execute tests out-of-the-box without having to make the modifications I list above? I've set up a test project to repro for your convenience.

Expected Behaviour

Able to execute tests without modifications/workarounds, as outlined above.

Steps to Reproduce

  1. Clone repro project: https://github.com/octadecimal/nx-webdriverio-test/
  2. Install dependencies: yarn
  3. Run: yarn nx e2e client-e2e

Nx Report

Node   : 16.16.0
   OS     : win32-x64
   yarn   : 1.22.19

   nx                 : 16.7.4
   @nx/js             : 16.7.4
   @nx/jest           : 16.7.4
   @nx/linter         : 16.7.4
   @nx/workspace      : 16.7.4
   @nx/devkit         : 16.7.4
   @nx/eslint-plugin  : 16.7.4
   @nx/node           : 16.7.4
   @nx/react          : 16.7.4
   @nrwl/tao          : 16.7.4
   @nx/web            : 16.7.4
   @nx/webpack        : 16.7.4
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @rbnx/webdriverio : 1.5.0

Failure Logs

PS C:\Workspace\wdiotest> yarn nx e2e client-e2e
yarn run v1.22.19
$ C:\Workspace\wdiotest\node_modules\.bin\nx e2e client-e2e

> nx run client-e2e:e2e

$ C:\Workspace\wdiotest\node_modules\.bin\wdio wdio.generated.config.ts
? Could not execute "run" due to missing configuration, file

Additional Information

No response

Roozenboom commented 1 year ago

Thanks for reporting! The test project was very helpful in reproducing the issue. After a short investigation, I think this is related to the yarn package manager in combination with the use of the child process exec cwd option. The cwd option is used to change the working directory to the apps/client-e2e path. When I switch to npm/npx in your test project the configuration works. I need to do a bit more testing to see if I can change the cwd option and use the full configPath path as you suggested.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

octadecimal commented 1 year ago

Thank you for the amazingly quick turn-around -- and for the plugin as well! I've updated to 1.5.1 and can confirm it's working as expected on my side now. :+1: