Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Best practice about synchronization #1599

Closed
bitliner opened this issue Dec 5, 2014 · 3 comments
Closed

Best practice about synchronization #1599

bitliner opened this issue Dec 5, 2014 · 3 comments

Comments

@bitliner
Copy link

bitliner commented Dec 5, 2014

I have dozens of test cases.
The problem I note is that they look to be completely nondeterministic: sometimes test have success, some other time they fail.

The tests that fail do not include pages with a lot of jquery plugin. It is pure angular sometimes, with REST calls. But still they fail.

When does waitForAngular is applied and when does not?
Is waitForAngular enough or should I care of some particular situation?
When does waitForAngular return?

The documentation says I shoudn't care of synchronization, but it does not look to be so true.

@juliemr
Copy link
Member

juliemr commented Dec 5, 2014

Protractor should be taking care of synchronization for you, if your application is pure angular (as you read, it can't handle stuff outside of the Angular world). Our tests show various examples of synchronization (see https://github.com/angular/protractor/blob/master/spec/basic/synchronize_spec.js)

waitForAngular is applied before any webdriver action (sendKeys, click, etc) and before searching for an element.

I'd love to see specific examples of what's not working for you. If you could provide a reduced test case which is nondeterministic, I'd be happy to take a look!

@bitliner
Copy link
Author

bitliner commented Dec 9, 2014

I do not have now a reduced test case which is nondeterministic.

Anyway one problem comes from a jquery plugin, called masonry (i am using the wrapper in angular) that basically loads elements with images and format this elements (like width , position, etc.) when the image is loaded.
For this I solved using a timeout of ~8 secs. Is there any other way to handle situations like this?

Regarding waitForAngular(), I think 2 words in the documentation about what it waits for could help understand and improve the library in a better way.

@FuturaITLtd
Copy link

So after the elements are loaded are you able to call browser.wait which
verifies the elements are present before continuing with the tests rather
than having an implicit timeout. I've pretty much replaced all of my
implicit waits with explicit checks for an element / checks current url
etc. Although some may say this is not required, I've found that it makes
the test framework I am working on more robust.

On 9 December 2014 at 17:57, Giovanni Gaglione [email protected]
wrote:

I do not have now a reduced test case which is nondeterministic.

Anyway one problem comes from a jquery plugin, called masonry (i am using
the wrapper in angular) that basically loads elements with images and
format this elements (like width , position, etc.) when the image is loaded.
For this I solved using a timeout of ~8 secs. Is there any other way to
handle situations like this?

Regarding waitForAngular(), I think 2 words in the documentation about
what it waits for could help understand and improve the library in a better
way.


Reply to this email directly or view it on GitHub
#1599 (comment).

@juliemr juliemr closed this as completed in 7c700d7 Jan 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants