question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@cypress/schematic: ng e2e does not start server

See original GitHub issue

Current behavior

When adding the schematic to a new CLI project, then ng e2e does not start the server.

Desired behavior

ng e2e should start the server behind the scene as the @briebug/cypress-schematic was (and the built-in Protractor as well).

Test code to reproduce

npx @angular/cli@12.0.0 new cypress-schematic-v12 --defaults
cd cypress-schematic-v12
ng add @cypress/schematic
ng e2e

Versions

Cypress: 7.3.0 @cypress/schematic: 1.0.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cexbrayatcommented, May 17, 2021

@admah Thank you for your answer.

I think this is a rather surprising change as most schematics work the other way around (default e2e schematic for protractor, the cypress one from Briebug, the one for webdriverio). ng e2e usually starts the server and that’s what your run on CI (with a --headless parameter). Note that ng e2e does start a server on a different port if you want to, or if the port is already taken, so it’s usually fairly easy to use locally.

This will probably be a surprise to most Angular developers who migrate from Protractor or from the original cypress schematic. My 2 cents is that I would stick to the default behavior of the ecosystem.

If you keep it that way, it should probably be clearly stated in the documentation. It was a bit weird for me because the configuration of the e2e property in angular.json does refer to devServerTarget so that was clear in mind that it should start the server. Maybe that’s unnecessary then, and would need to be fixed as well.

0reactions
admahcommented, May 18, 2021

You’re welcome @cexbrayat! I’m looking over the PR now. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding @cypress/schematic to Angular workspace results in ...
When you run ng e2e app1 it starts Cypress but the default spec.js is not found. In fact, cypress is run without a...
Read more >
Migrating from protractor to cypress in angular giving error
I tested the Angular 8 starter app + @cypress/schematic, and trying to run ng e2e gives the same error. will open the Cypress...
Read more >
5 steps to set Cypress as your E2E test runner in Angular
Integrate Cypress E2E tests in your Angular app and run them with the CLI's “ng” command. End to end tests are a great...
Read more >
CI ready e2e tests for Angular with Cypress and TypeScript in ...
This article aims to describe how you can set up end-to-end testing for Angular with Cypress including TypeScript. You will write your very ......
Read more >
@cypress/schematic - npm
Add npm scripts for running Cypress e2e tests in run mode and open mode ... If you have chosen to add or update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found