Ask questions`ng e2e --debug`

🚀 Feature request

Command (mark with an x)

  • [X] e2e


I've been looking for means to debug faulty e2e Protractor tests, however I don't see a means of accomplishing this in the Angular CLI, or a documented solution.

Describe the solution you'd like

Ideally, I'd like to see some kind of ng e2e --debug or ng e2e --inspect which builds/runs the application, starts Protractor, and opens up a debugging port. If there is a way to break after test files are loaded, so I can set breakpoints without manually adding a debugger; statement, that would be great too.

Describe alternatives you've considered

Most of the material I've found online tells me to call Protractor directly, via something like node --inspect node_modules/.bin/protractor e2e/protractor.conf.js. This has a couple problems to me:

  1. This is a leaky abstraction.
    • We can do every other execution necessary via the CLI, but not debug e2e tests. As a tangential example, take a look at this package.json scripts configuration I have, all of which just uses ng directly, except for debugging e2e tests.
    • We do seem to leak Protractor in a few other places (such as the configuration file).
    • Subtle implementation changes in ng e2e could cause the debug command to need to be changed. For instance, should I update webdriver-manager before running?
  2. I don't see any official documentation or stance on how to debug e2e tests; everything I've found is community built.
  3. Running Protractor directly also does not boot up the actual application, so a separate ng serve command is necessary.
    • I didn't realize this and lost a lot of time debugging, confused why it worked previously and suddenly stopped today. Turns out I had the server running the background last time and didn't realize that was a dependency!

Answer questions alan-agius4

Closing as this is not in the Angular CLI roadmap, since Protractor is being deprecated

Alan Agius alan-agius4 Malta Angular Team, Loves TypeScript, Build Tools, Food, Beer & Coffee 🇲🇹
Github User Rank List