-
Notifications
You must be signed in to change notification settings - Fork 12k
ng e2e --watch support #2861
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
Comments
I was wondering the same thing, especially since |
@JohannesHoppe it is because the current I agree we should have a way to re-run tests when file change though! |
This isn't something we're looking at adding. It sounds good on paper but the only e2e suite that could benefit from it would be a tiny one. |
I don't get that argument. During development I always |
I just timed how long it takes from the end of a build to the end of the e2e run in Is this an acceptable refresh rate for you? I'd expect most e2e specs to take longer than this. I'm open to reopening this issue and mark it for community help. With a bit of effort in managing the I just honestly can't imagine this being truly useful. But there's no e2e watch mode in other setups that I know of, so maybe it's actually super cool and nobody every bothered doing it. |
I agree, you should save the file with care! I still think this feature would be cool! 😄 |
I think that it would be useful to be able to run and re-test only the modified, or better, the relevant change affected parts, rather than re-run the entire thing which takes forever in dev world. |
Try out the methods |
We agree on that. Running e2e tests is slowwwwwwwwwwwwwwwwwwww and launching the suite each time is not how i imagined i would die. 👴 |
+1 for watch support. One thing that helped for me is to serve the app separately, then just run the test like so |
@dapriett Wow, thanks, I've been looking for a way to do so. |
I tried to implement it for the past 2 hours. Unfortunately I couldn't see an easy way of doing it without changing protractor itself. The thing is that the I couldn't find a way to run protractor in a way it won't run |
Heya @barnash, thanks for having a go at it. Thanks very good info that you've gathered about the current limitations. Perhaps some changes in Protractor are needed to support this after all. @dapriett that's a good way to cut down on the serve time especially if you're already testing in the browser. Be ware of the live reloads though, they can interrupt the protractor tests. |
Based on @dapriett's message and npm
Just implemented that in one of my projects: https://github.com/spy4x/read-that-later/commit/4faf0cbb41b5e0500f277afda015528c35d977d7 |
Solution provided by @spy4x works as a charm. I just want to add that Windows users have to use: |
What is weird that developer should use workaround like that : ) |
protractor's `--watch` doesn't work at present; implemented this workaround from the issue at: angular/angular-cli#2861
This is still unsolved :-) Kudos @spy4x, it worked great like this |
We've just started implementing e2e tests and I'm really surprised this doesn't exist :) How do people write them without getting them correct the first time? I've got a registration form that I need to submit to verify that it gets to a summary page. Created a import { RegisterPage } from './register.po';
fdescribe('RegisterPage', () => {
let page: RegisterPage;
beforeEach(() => {
page = new RegisterPage();
});
fit('should take user to summary step after completing form', () => {
page.navigateTo();
page.populateForm();
expect(page.getSummary()).toBeDefined();
});
}); My problem is that: I've never used protractor before in my life and getting this thing to work is gonna take probably 200 runs of In my mind, I would just use fdescribe/fit and run e2e tests on watch mode. Every code change to my po.ts file would re-run the test and I would observe that I'm writing the thing correctly. As it stands, a single run of Perhaps there's a way to run protractor manually in the Chrome console so I can just go to the register page and hammer it out until it works? It's not that I want to run a 10 minute suite on every change, it's that I want to run a single test trial and error until it works without 1 minute overhead @spy4x solution reduces overhead of the serve (55sec) but you still have to wait for Chrome to startup on each run. Would be nice if the overheard was the same as going from one it() to another |
@intellix I can't remember exactly how much time tests on my project took, but I think I made them about 11s for several pages. You can check what I did here: https://github.com/spy4x/read-that-later/tree/master/e2e |
FWIW, this is what I ended up using with cli@6.0.5 (where the
// In package.json:
"scripts": {
...
"e2e-watch": "concurrently --kill-others \"npm start\" \"npm run e2e-watch-no-serve\"",
"e2e-watch-no-serve": "watch \"npm run e2e -- --dev-server-target=\" src e2e --wait=1"
} |
@filipesilva The idea is to compile and deploy the source code on a code-server and watch for changes in non-spec files. The tests runs on a separate server pointing to the deployed code-server and watching for changes in e2e-spec files and only rerun the tests only not trigger a complete rebuild as it is right now. If you guys can sync the code-server rebuild and test rerun everything should work as expected. |
Bumping. Would love to see watch mode made available for e2e tests. |
I refine this a bit because this solution will start test immediately after you run command and before ng serve is running so it will fail at first. OK you can save one file and then it will success, but better UX will be get if we wait that ng serve is up and running. Here is my solution for that. I combine wait-on into watch.
remember to run npm install --save-dev wait-on |
@gkalpak and @spy4x I'm having trouble running your scripts. I modified it to fit my file structure (replacing
And for the other script, after stopping my server in another terminal:
Any ideas on how to get your awesome scripts to work? |
@tuzmusic, based on the output and the code paths, you seem to be inside an AngularJS (1.x) project. |
Ok thanks @gkalpak! |
I'm migrated to cypress and its awesome, recommend! Cypress itself: https://github.com/cypress-io/cypress |
Thanks for the suggestion! I was just about to start using Cypress for testing my React apps as well! |
This issue was opened almost three years ago, several Angular versions ago, and it still is not fixed? Any real reason or has the Angular team just not gotten around to it yet? |
In Angular 8+ it would be bit different like this: |
This ticket was opened about four years ago. From the comments here and the other issues opened that have been merged with this one, it is clear this would be beneficial to many users (small test suite or large). Will this ever be considered? If not, why not just close the issue then? If it is being considered, why not update us? |
Here are my steps:
|
It'd be great to have an option to start after the What I'd really love is a way to watch for the dev server restart, then restart the protractor tests immediately. |
No wonder React is strongly taking over Angular.... in all fronts! |
Closing as this is not in the Angular CLI roadmap, since Protractor is being deprecated angular/protractor#5502 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently e2e tests run once. It would be fantastic if the e2e suite could run with a watch flag like the unit tests.
The text was updated successfully, but these errors were encountered: