0

I'm trying run Angular's e2e tests against an instance of the application ON A DIFFERENT SERVER than my local machine. So to be clear, I'm not testing my local code.

I just need to run protractor without the angular build steps because it's a waste of time since the code I'm testing is on another server. Unfortunately, the angular.json file throws an error if i excessively modify/remove the following line:

"builder": "@angular-devkit/build-angular:protractor",

I already have a solution for this, but it's long winded and I'd like to be able to not change how my teammates are running tests from their shells:

node node_modules/protractor/bin/protractor e2e/protractor.conf.js

I have two thoughts:

  1. Write npm script which runs this command (what i'll likely end up doing)
  2. Find out how to overwrite what ng e2e does. If I can run the more complicated command here, it'll save productivity and feedback time.

I'm on Angular V7.

Is overwriting ng e2e so that it executes node node_modules/protractor/bin/protractor e2e/protractor.conf.js instead possible?

1 Answers1

1

Yup. I would do #1. That makes sense to update your package.json

"scripts": {
  "protractor": "protractor e2e/protractor.conf.js"
}

and then just run npm run protractor. The e2e command is also downloading chromedriver, the selenium jar file, and maybe geckodriver? with webdriver-manager. If you want that as a pre-step:

"scripts": {
  "protractor": "protractor e2e/protractor.conf.js",
   // just download chromedriver and the selenium jar
  "preprotractor": "webdriver-manager update --gecko false"  
}

It also starts your angular application. If you need to do that, I would just call ng serve and run it in a background process. I hope that helps.

cnishina
  • 5,016
  • 1
  • 23
  • 40
  • That's basically the conclusion i've come to. at least running locally they can still do something like 'npm e2e' and not have to worry about the gritty details. Thanks for your input!! – Scott Williams Jan 11 '19 at 16:06