user2714417
user2714417

Reputation: 53

testing non-angular app with protractor and webdriver fundamentals

I am writing e2e tests for a non-angular app using protractor and while there is quite a bit of information on how to accomplish this, it seems there are many different ways and so I have some fundamental questions.

  1. When testing non-angular sites some folks say to just use webdriver calls, 'browser.driver.get()' for instance so that protractor does not expect angular to finish loading on a page etc. Other responses say that you can set browser.ignoreSynchronization = true, and make calls to browser.get() with no problem (this seems like the ideal solution so you can rely on one api call if dealing with angular and non-angular). Are these two methods equivalent and if not please explain differences.

  2. Does protractor still respect promises when dealing with webdriver or browser.ignoreSynchronization = true? For instance if I make a 'get' call, will protractor wait before executing next step until that 'get' request is fulfilled?

  3. Related to #2, Do I have to use promise chaining when dealing with webdriver/non-angular app to ensure user interactions are executed in order? For example if I use sendKeys() to enter a name and then click() to submit info, do I have to nest the click() inside of sendKeys().then?

  4. How exactly does webdriver know all elements of a page are ready after a get request (every solution I see involves using a timeout or relying checking if an element exists first)? What if that page has embedded apps (like a google map for instance) and I want to simulate a user clicking on 'view larger map' for my e2e test?

Upvotes: 0

Views: 364

Answers (1)

aas
aas

Reputation: 136

  1. No, they are not equivalent. browser.get() is a wrapper on top of browser.driver.get(). It will throw an error if it does not find angular library on page load. So, use browser.driver.get() for non angular apps.

  2. No, it does not respect promises and will not wait.

  3. No, webdriver manages that using promise library and control flow.

Upvotes: 0

Related Questions