Transition from selenium to protractor - worth it?
Over the last few weeks, We have been experimenting with a protractor+typescript+cucumber framework for our new Angular 6 application. The main reason we thought our present Selenium+Cucumber+java framework may not rise up to occasion was due to angular page elements and angular architecture, in general, may render it useless. Also, we'd like to see if there are better options that make e2e test case writing quicker, easy and make maintenance easy as we have a large suite of test cases
I want to list out my observations regarding protractor(the most popular tool for testing angular apps) and wanted to ask if my understanding is correct as I do not find a strong reason to transition to it.
1) Page elements: I know that, there are different ways of grabbing angular elements in protractor. See docs here: - https://www.protractortest.org/#/locators but the only ones that give protractor the edge are "by.model", "by.repeater", "by.binding" & etc. However, this was the case with angular js. but with angular 2+ apps protractor has lost support for the locators. Also, we have seen custom components in the DOM. For e.g. this demo site: https://miherlosev.github.io/e2e_angular/ is made in angular 4 and does not have any of elements that can be identified with "by.model", "by.repeater", "by.binding" rendering these utilities useless. how does one grab angular specific page elements. If everybody is using CSS locators than what advantage does protractor give over my existing framework?
I am not able to find a good reason as to what advantages does protractor have over my present framework? Would Selenium+java framework would be unusable on angular 6 application?
Please let me know if I am not understanding this right or missing an important aspect of protractor.
I totally had the same experience as you. For a new angular project i looked into protractor as the recommended way but then just risked using java + selenium because, as you, i found that the protractor features where either not usable or have been ported to java. So far I had no problems with element locators and i don't have to wait for anything (at least not more than in non angular projects). The only waits I usually need are for modals.
In short: I see no reason to not use java + selenium for new angular projects.
There are other reasons to go for protractor, like when the developers also write tests it may be better to have just a single language, it integrates better in the node builds... but if your are feeling more comfortable with java and it fits into your project, use it.