0

I have an Angular 6 project and trying to run end-to-end protractor tests. I keep getting this error during the step:

webdriver-manager update --standalone false --gecko false

So I installed the webdriver-manager globally and the webdriver-manager folder is in the folder: C:\Users...\Roaming\npm\node_modules

I then update the webdriver-manager using this command from the folder C:/User/:

webdriver-manager update

That successfully adds the selenium jar, chromedriver, and geckodriver.

I try running the end to end tests using yarn. When the script gets to this command:

webdriver-manager update --standalone false --gecko false

I get this error: enter image description here

The update-config.json is in the folder: enter image description here

Where is this json file suppose to be and how do I get it there?

UPDATE These are the current scripts:

"scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config local.proxy.config.json",
    "build": "ng build --output-path ../resources/static",
    "test": "ng test",
    "test-local": "ng test --karmaConfig=karma-local.conf.js",
    "lint": "ng lint",
    "wd:update": "npm run e2e-update && protractor ./e2e/protractor-local.conf.js",
    "wd:start": "webdriver-manager start && protractor ./e2e/protractor-local.conf.js",
    "e2e-local": "npm run e2e-update && protractor ./e2e/protractor-local.conf.js",
    "e2e-local-debugger": "npm run e2e-update && node --inspect-brk node_modules/protractor/bin/protractor ./e2e/protractor-local.conf.js",
    "e2e": "npm run e2e-update && npm run e2e-test",
    "e2e-test": "protractor ./e2e/protractor.conf.js",
    "e2e-update": "webdriver-manager update --standalone false --gecko false",
    "e2e-jenkins-staging": "npm run e2e-update && npm run e2e-staging",
    "e2e-jenkins-prod": "npm run e2e-update && npm run e2e-prod",
    "e2e-staging": "protractor ./e2e/protractor-staging.conf.js",
    "e2e-prod": "protractor ./e2e/protractor-prod.conf.js",
    "sonar": "sonar-scanner"
  },
Gloria Santin
  • 2,066
  • 3
  • 51
  • 124

1 Answers1

1

The issue is because of local and global installation of webdriver-manager.

Create a npm script in package.json for updating webdriver manager some thing like

"wd:update": "webdriver-manager update"

This will download the driver and binaries for the webdriver-manager inside your node_modules of the project.

Run this npm script from the project directory npm run wd:update

Bharath Kumar S
  • 1,410
  • 2
  • 10
  • 29
  • I would need to do the same with the webdriver-manager install command too, correct? So the **npm install webdriver-manager** needs to be run from the project folder? – Gloria Santin Aug 14 '20 at 19:48
  • Nope webdriver-manager comes default with protractor it is a peer dependency. Just update it once and everything will be fine – Bharath Kumar S Aug 14 '20 at 19:49
  • I still get the same error. **Cannot find update-config.json**. The file is in the folder: **webdriver-manager/selenium** BTW...I called the command **webdriver-manager update** from the root directory folder. I put files in the node_modules folder What folder should the update-config.json file be? – Gloria Santin Aug 14 '20 at 20:29
  • Calling the command directly from the root directory is still going to update the global copy of protractor. You need to add a script to your package.json and run that instead. That will actually update the copy of protractor that is local to your project. Should fix your issue. – tehbeardedone Aug 14 '20 at 20:40
  • Please add a script tag then it will not target the global installation location. – Bharath Kumar S Aug 14 '20 at 20:42
  • Added the script and ran **npm run wd:update**. It displayed that it was using the local install. Updated selenium, chromedriver, and geckodriver. Then ran our command to run the e2e tests. (yarn e2e-local). This calls **webdriver-manager update --standalone false --gecko false**. Then get the same error...can't find update-config.json – Gloria Santin Aug 14 '20 at 20:57
  • I think your e2e test command again tries to update webdriver-manager. Just add another script to start webdriver-manager. Then just run your test – Bharath Kumar S Aug 14 '20 at 20:59
  • the script command to run the tests is, ** webdriver-manager update --standalone false --gecko false && protractor ./e2e/protractor.conf.js**. There is no **webdriver-manager start** command. When I replace the update command with the start command, The Selenium Server starts but the tests do not run – Gloria Santin Aug 14 '20 at 21:14
  • Yes just remove the the cmd before && in your test script cmd. – Bharath Kumar S Aug 14 '20 at 21:44
  • Only protractor ./e2e/protractor.conf.js is enough – Bharath Kumar S Aug 14 '20 at 21:45
  • When I do that, I get the error: internal/modules/cjs/loader.js:976 AppData\Roaming\npm\node_modules\protractor\built\cli.js:5:15) code: 'MODULE_NOT_FOUND', – Gloria Santin Aug 15 '20 at 12:38
  • Please add your entire npm scripts in the question – Bharath Kumar S Aug 15 '20 at 12:54
  • Scripts have been added above – Gloria Santin Aug 15 '20 at 13:19
  • "e2e-local": "protractor ./e2e/protractor-local.conf.js",. Change e2e local to the above mentioned cmd – Bharath Kumar S Aug 15 '20 at 13:34
  • Back to the same error: Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries. – Gloria Santin Aug 15 '20 at 13:42
  • Ok now go to the .bin folder inside node_modules and run webdriver-manager update in the .bin folder. Issue will be fixed. Then run the test – Bharath Kumar S Aug 15 '20 at 13:44
  • went to the .bin folder and ran update using this command: >webdriver-manager update That was successfully Then ran e2e-local command like this: >yarn e2e-local got the same error moved to the webapp folder to folders up (which is where this command works for the rest of the team and got the same error (Error message: Could not find update-config.json.) – Gloria Santin Aug 15 '20 at 14:21
  • Try uninstalling protractor and install it or try this https://stackoverflow.com/a/53358685/8903949 – Bharath Kumar S Aug 15 '20 at 14:31
  • I checked for the version of protractor installed and it is not installed! (fyi...im an idiot!) So should I install protractor globally or locally – Gloria Santin Aug 15 '20 at 15:02
  • locally should be fine – Bharath Kumar S Aug 15 '20 at 15:37
  • installing protractor globally because there are multiple applications I will need it and it is taking forever – Gloria Santin Aug 15 '20 at 15:58
  • seems to be stuck on es6-promise@4.2.8 checking installable status ...how long should this take? – Gloria Santin Aug 15 '20 at 16:07
  • Had to uninstall webdriver-manager and node. then reinstall them. Then I could install protractor. working now – Gloria Santin Aug 16 '20 at 19:29