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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
More infos/tutorials about Protractor and e2e tests #41369
Comments
I hope I don't offend anyone but let me give you my advice as a relatively experienced Angular developer: You should seriously consider dropping Protractor. I would recommend tools like Cypress for end-2-end testing. I would also consider using Jest for unit testing, as your test runner. There are plenty of tutorials and walk throughs for both libraries online. |
Karma and jasmine are wonderful. I don鈥檛 think jest would be a better solution (as angular supports it out of the box. Whatever protractor or cypress used (I don鈥檛 recommend it as you need to modify ton of things to make it works), the problem is the lack of official documentation. Or maybe e2e are not relevant and will eventually be removed in the future ? |
Protractor is default experience for Angular e2e, so, I think, it should be used. |
As no one is born with the whole knowledge and cannot guess what they don鈥檛 know, it may be great to have at least a little bit of informations about e2e as a lot of companies don鈥檛 use it so it鈥檚 hard to find someone in your environnement that can actually help you to start with testing. You have to learn all by yourself and if you want to change people鈥檚 mind you have to show them the power of what you are learning (angular in my case) but if can鈥檛 find a quick and proper way to learn you cannot do anything. |
@MikaStark This about of not only e2e, IMO :) |
Yes but as you can see, protractor as fairly no documentation (open source or not) and the large majority of the community is focused on AngularJS (common guys we are in 2021...). So how can I use it ? Yes I see you can reach html and test a click or assert a attribute/content. Fine. testing attributes/event are not enough for a real world project |
Why would you mock in E2E tests? |
Most of my projects are Back offices. If you cannot sign in you cannot do anything. Furthermore, I don鈥檛 want to insert stupid data in preproduction or production database. I鈥檓 front end developer not fullstack so I don鈥檛 care how APIs work, I just want to prove that my front is working. Currently I skip writing e2e tests because of my lack of knowledge about e2e. Also unit tests are not sufficient to ensure that your front is working as expected. |
@MikaStark I hear you. The primary issue with Protractor (imho of course) is that it is closely coupled with Angular, and that it was made with Angular1 in mind. You want to use (again imho of course) a testing library that is frontend tech agnostic, so you can use it for whatever project you might do in the future. If you jump between frameworks it's especially a pain to have to use different libraries for testing. I would strongly recommend you take a look at Cypress, but there are also other good E2E testing frameworks out there. Cypress is easy to learn, it works with anything and you can mock all you want as well. Documentation is good, it supports modern standards like async/await, and can run in a browser or command line (so that you can use it for CI stuff). There are even lots of presentations at ANGULAR conferences where they showcase the use of Cypress. You should try not to couple your testing tools with your development tools. Again, these are just my 2cents .. cheers |
@MikaStark You just need to prepare helper which will sign in into your application in the "beforeAll" hook of your test (inject it into your e2e framework-wrapper). And so all your tests will work. It will be more plausible case since e2e involves to use full scenarios of user-application interaction. |
Anyway you have to deal with 芦聽real聽禄 api that cannot even be considered in my case. I cannot sign in to real APIs for testing. |
It sounds like you are looking for Integration testing, not E2E. |
Closing - Protractor is being deprecated. See 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. |
馃摎 Docs or angular.io bug report
Description
Hello Angular team :). First I want to thank you about your amazing work with Angular ! Today I want to learn how to use e2e tests in my NG projects but it's very hard to found good resources. Your website explains very well how to unit test but not how to e2e test. There are several questions asked on stackoverflow but there are mostly related to angularJS.
馃敩 Minimal Reproduction
What's the affected URL?
https://angular.io/guide/testing
Reproduction Steps
None, there isn't any e2e section
Expected vs Actual Behavior
It will be awsome to have a guide explaining how to write good e2e tests and how to deal with common issues (how to handle authentication, a good style guide, etc.)
The text was updated successfully, but these errors were encountered: