Question

I have used browser and ptor in my previous tests, and they have different issues, but overall both seem buggy, although I like browser better.

So my question is, for testing a large angular application, is it more preferred to use the protractor.getInstance or just using regular browser?

Was it helpful?

Solution

The browser object and the object returned by protractor.getInstance() are the same object.

console.log("compare " + (protractor.getInstance() === browser));

prints "compare true"

It doesn't matter which you use, except stylistically. I like the browser object better.

For the non-wrapped webdriver instance, use browser.driver.

OTHER TIPS

It doesn't matter. EDIT: Per alan.myrvold, browser and protractor.getInstance() are actually the exact same object. I didn't realize this until I verified his comment just now. Therefore you can use either one.

Note that if you are testing a NON-angular app, you must use browser.driver or protractor.getInstance().driver which is a webdriver instance. Using protractor.getInstance() or browser will throw errors because it will try to search for angular.

It's a very general question.

The angular community right now seems to move to Protractor, which is WebdriverJS based and - as far as I can tell - pretty powerful. The gist behind it is, that it uses regular browsers to do automated testing for you.

However, Protractor is a very young project and it requires a bit of getting used to. I myself found it a bit buggy and not yet suited to my needs.

Second point is: Do both. Do not completely rely on (integration) tests. You should always test functionality by hand - and should have it tested by someone else. After all, your computer is not a human.

Lastly, there is no definite answer, and I do not think it belongs here - we're here to help with specific programming problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top