Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WDIO Configuration Helper doesn't work using yarn #2319

Closed
gsccheng opened this issue Sep 26, 2017 · 5 comments
Closed

WDIO Configuration Helper doesn't work using yarn #2319

gsccheng opened this issue Sep 26, 2017 · 5 comments

Comments

@gsccheng
Copy link

The problem

WDIO Configuration Helper doesn't work using yarn@1.0.1.

Environment

  • WebdriverIO version: 4.8.0
  • Node.js version: 8.2.1
  • Standalone mode or wdio testrunner: testrunner
  • if wdio testrunner, running synchronous or asynchronous tests: n/a
  • Additional wdio packages used (if applicable): n/a

Details

11:18 $ ./node_modules/.bin/wdio config

=========================
WDIO Configuration Helper
=========================

? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? jasmine
? Shall I install the framework adapter for you? Yes
? Where are your test specs located? ./test/specs/**/*.js
? Which reporter do you want to use?  dot - https://github.com/webdriverio/wdio-dot-reporter,  spec - https://github.com/webdriverio/wdio-spec-reporter,  allure - https://github.com/webdriverio/wdio-allu
re-reporter,  json - https://github.com/fijijavis/wdio-json-reporter,  concise - https://github.com/FloValence/wdio-concise-reporter
? Shall I install the reporter library for you? Yes
? Do you want to add a service to your test setup?  selenium-standalone - https://github.com/webdriverio/wdio-selenium-standalone-service,  webpack - https://github.com/leadpages/wdio-webpack-service,  w
ebpack-dev-server - https://gitlab.com/Vinnl/wdio-webpack-dev-server-service
? Shall I install the services for you? Yes
? Level of logging verbosity verbose
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://localhost

Installing wdio packages:

Packages installed successfully, creating configuration file...
fs.js:652
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/path/to/node_modules/webdriverio/build/lib/helpers/wdio.conf.ejs'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at renderConfigurationFile (/path/to/node_modules/webdriverio/build/lib/cli.js:292:28)
    at /path/to/node_modules/webdriverio/build/lib/cli.js:282:17
    at /path/to/node_modules/npm-install-package/index.js:31:5
    at ChildProcess.exithandler (child_process.js:262:7)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:921:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

I'm opening this to track the issue that is related to here:
#2215
#2218

Link to Selenium/WebdriverIO logs

N/A

Code To Reproduce Issue [ Good To Have ]

N/A

@christian-bromann
Copy link
Member

@gsccheng please see #2218 (comment) .. I was not able to reproduce this. So either you can prepare a PR with a fix or try the suggested workaround. Thanks!

@tsemana
Copy link

tsemana commented Oct 4, 2017

Strange that this isn't reproducible. Here's a repo with only webdriverio as a dependency:
https://github.com/tsemana/wdio_yarn_error

Doing this fails:

yarn
yarn run wdio

=========================
WDIO Configuration Helper
=========================

? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? cucumber
? Shall I install the framework adapter for you? Yes
? Where are your feature files located? ./features/**/*.feature
? Where are your step definitions located? ./features/step_definitions/
? Which reporter do you want to use?  spec - https://github.com/webdriverio/wdio-spec-reporter
? Shall I install the reporter library for you? Yes
? Do you want to add a service to your test setup?  phantomjs - https://github.com/cognitom/wdio
-phantomjs-service
? Shall I install the services for you? Yes
? Level of logging verbosity verbose
? In which directory should screenshots gets saved if a command fails? ./features/errorShosts/
? What is the base url? http://localhost:3000

the console message is

Installing wdio packages:

Packages installed successfully, creating configuration file...
fs.js:652
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/tony/Code/Learn/wdio_yarn/node_modules/webdriverio/build/lib/helpers/wdio.conf.ejs'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at renderConfigurationFile (/Users/tony/Code/Learn/wdio_yarn/node_modules/webdriverio/build/lib/cli.js:292:28)
    at /Users/tony/Code/Learn/wdio_yarn/node_modules/webdriverio/build/lib/cli.js:282:17
    at /Users/tony/Code/Learn/wdio_yarn/node_modules/npm-install-package/index.js:31:5
    at ChildProcess.exithandler (child_process.js:262:7)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Socket.stream.socket.on (internal/child_process.js:348:11)

This command, from the base repo, successfully creates the config file:

npm install
./node_modules/.bin/wdio

@fenderil
Copy link

fenderil commented Oct 5, 2017

I had reproduced issue using:
node node_modules/webdriverio/bin/wdio config
with
yarn@1.0.2
webdriverio@4.8.0
node@8.5.0

Selected for config:
? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? cucumber
? Shall I install the framework adapter for you? Yes
? Where are your feature files located? ./features/**/*.feature
? Where are your step definitions located? ./features/step-definitions
? Which reporter do you want to use? dot - https://github.com/webdriverio/wdio-dot-reporter
? Shall I install the reporter library for you? Yes
? Do you want to add a service to your test setup?
? Level of logging verbosity verbose
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://localhost:6060

After start of installation wdio had deleted half of webdriverio package.

Possibly, it is associated with files structure, because packages installation with npm had solved this problem.

@gitowiec
Copy link

I have the same issue
WDIO just deleted half of the packages from node_modules and broke with this error:

WDIO Configuration Helper
=========================

? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? mocha
? Shall I install the framework adapter for you? Yes
? Where are your test specs located? ./test/specs/**/*.js
? Which reporter do you want to use?  spec - https://github.com/webdriverio/wdio-spec-reporter
? Shall I install the reporter library for you? Yes
? Do you want to add a service to your test setup?  selenium-standalone - https://github.com/webdriverio/wdio-selenium-standalone-service
? Shall I install the services for you? Yes
? Level of logging verbosity silent
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://127.0.0.1:8899

Installing wdio packages:

Packages installed successfully, creating configuration file...
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/home/user/workspace/web-ui/node_modules/webdriverio/build/lib/helpers/wdio.conf.ejs'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at renderConfigurationFile (/home/user/workspace/web-ui/node_modules/webdriverio/build/lib/cli.js:315:28)
    at /home/user/workspace/web-ui/node_modules/webdriverio/build/lib/cli.js:305:17
    at /home/user/workspace/web-ui/node_modules/npm-install-package/index.js:31:5
    at ChildProcess.exithandler (child_process.js:267:7)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
error Command failed with exit code 1.

@ayoolaao
Copy link
Contributor

ayoolaao commented Oct 17, 2018

My observations:

  • You install 'webdriverIO' with yarn and the yarn.lock is updated/created.
  • Then you run: './node_modules/.bin/wdio config' and select config options
  • I think the issue is that the WDIO configuration helper uses npm to install selected dependencies (e.g spec reporter, jasmine etc),
  • hence creating a package-lock.json file. Causing this issue because webdriverio in yarn.lock and not in the package-lock.json with selected reporters, frameworks etc.

Walk-around fix:

  1. Install 'webdriverio' with: yarn add -D webdriverio
  2. Run wdio config helper: ./node_modules/.bin/wdio config ![screen shot 2018-10-17 at 5 00 21 pm](https://user-images.githubusercontent.com/23148951/47121128-a9914a80-d22e-11e8-8b46-401aad9d3e18.png)
  3. Select desired options but don't the have helper install any of them for you, by responding with 'no' (e.g Shall I install the framework adapter for you? No).
  4. Configuration file was created successfully!
  5. Manually install the required services, frameworks and/or reporters with yarn either by:
    a. Adding them to your package.json file and running yarn install
    b. Yarn add each one of them
Desktop/a-yarn ❯❯❯❯❯ yarn add -D webdriverio
yarn add v1.10.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...

success Saved lockfile.
success Saved 137 new dependencies.
✨  Done in 4.99s.
Desktop/a-yarn ❯❯❯❯❯ ./node_modules/.bin/wdio config

WDIO Configuration Helper

? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? jasmine
? Shall I install the framework adapter for you? No
? Where are your test specs located? ./test/specs/**/*.js
? Which reporter do you want to use?  spec - https://github.com/webdriverio/wdio-spec-reporter
? Shall I install the reporter library for you? No
? Do you want to add a service to your test setup?  selenium-standalone - https://github.com/webdriverio/wdio-se
lenium-standalone-service,  visual-regression - https://github.com/zinserjan/wdio-visual-regression-service
? Shall I install the services for you? No
? Level of logging verbosity silent
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://localhost

Configuration file was created successfully!
To run your tests, execute:

$ wdio wdio.conf.js

Desktop/a-yarn ❯❯❯❯❯                                                                                       26s

christian-bromann pushed a commit that referenced this issue Feb 2, 2019
## Proposed changes

Fixes #3421 , #2319 
Tested with yarn.

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

### Reviewers: @webdriverio/technical-committee
abjerstedt added a commit that referenced this issue Feb 2, 2019
Extendable typings (#3477)

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)

Proposal for adding types to frameworks/services etc...
Please have a look at the proposed changes here and let me know what you think. It does 2 things:
- The current typings make no difference in the `suite` and `test` description, regardless of framework. Actually, they are currently describing the mocha output. However, when running jasmine, there is different output available. With this PR all you would have to do is reference the framework package in your `tsconfig.json` and it would give you the correct typings for `suite` and `test` AND give you global typings for either mocha or jasmine.
- As an example I also added typings in this way for the `selenium-standalone-service`. To get the correct typings and allowed extra properties to the `config` object, all you need to do is install selenium-standalone-service and add a reference to it in the `tsconfig.json`.

Look at the `typescript.md` file for a description/example. This is just a proposal, but one that would work pretty nicely I think. Ideally, all wdio packages would come with typings files like this.

Please let me know what you think about this.

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] I have added necessary documentation (if appropriate)

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

Fixed type error for CSSProperty #3473 (#3474)

* Added new TypeScript boilerplate for WebdriverIO

* Added Accessibility test ability to TypeScript boilerplate

* Fixed type errors in Webdriverio.d.ts #3473

* Support other types of CSS attributes #3473

Updating stale element handling (#3482)

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)
1.) Firefox is not passing stale elements per the wc3 spec. Widening the scope of errors that we refetch so that we can handle firefox
2.) Flattening the middleware (this also adds the refetch to the edge case of an element falling stale after waiting for it to exist)
3.) Fixing the stale element mock
4.) Updating the UTs that expect a function toThrow to be .rejects.toThrow()
5.) Re-enabling the skipped UTs

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [X] Bugfix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [X] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

Fix handling of yarn-managed node_modules (#3422)

Fixes #3421 , #2319
Tested with yarn.

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

fix import - ref #3422
abjerstedt added a commit that referenced this issue Feb 2, 2019
Extendable typings (#3477)

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)

Proposal for adding types to frameworks/services etc...
Please have a look at the proposed changes here and let me know what you think. It does 2 things:
- The current typings make no difference in the `suite` and `test` description, regardless of framework. Actually, they are currently describing the mocha output. However, when running jasmine, there is different output available. With this PR all you would have to do is reference the framework package in your `tsconfig.json` and it would give you the correct typings for `suite` and `test` AND give you global typings for either mocha or jasmine.
- As an example I also added typings in this way for the `selenium-standalone-service`. To get the correct typings and allowed extra properties to the `config` object, all you need to do is install selenium-standalone-service and add a reference to it in the `tsconfig.json`.

Look at the `typescript.md` file for a description/example. This is just a proposal, but one that would work pretty nicely I think. Ideally, all wdio packages would come with typings files like this.

Please let me know what you think about this.

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] I have added necessary documentation (if appropriate)

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

Fixed type error for CSSProperty #3473 (#3474)

* Added new TypeScript boilerplate for WebdriverIO

* Added Accessibility test ability to TypeScript boilerplate

* Fixed type errors in Webdriverio.d.ts #3473

* Support other types of CSS attributes #3473

Updating stale element handling (#3482)

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)
1.) Firefox is not passing stale elements per the wc3 spec. Widening the scope of errors that we refetch so that we can handle firefox
2.) Flattening the middleware (this also adds the refetch to the edge case of an element falling stale after waiting for it to exist)
3.) Fixing the stale element mock
4.) Updating the UTs that expect a function toThrow to be .rejects.toThrow()
5.) Re-enabling the skipped UTs

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [X] Bugfix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [X] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

Fix handling of yarn-managed node_modules (#3422)

Fixes #3421 , #2319
Tested with yarn.

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

fix import - ref #3422
yamkay pushed a commit to MoveInc/webdriverio that referenced this issue Jun 13, 2019
## Proposed changes

Fixes webdriverio#3421 , webdriverio#2319 
Tested with yarn.

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

### Reviewers: @webdriverio/technical-committee
yamkay pushed a commit to MoveInc/webdriverio that referenced this issue Sep 4, 2019
## Proposed changes

Fixes webdriverio#3421 , webdriverio#2319 
Tested with yarn.

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

### Reviewers: @webdriverio/technical-committee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants