-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Consider making a library of retry helper methods for situations outside of Angular's control #1557
Comments
Hey Julie, I started to write tests for our application. The first part of the flow (the loging in part) is outside of Angular. Somewhere I read that to make Protractor work with stuff outside of Angular you have to use: beforeEach(function(){
browser.ignoreSynchronization = true;
}); Because the example said that you have to put in in the describe('logging in', function(){
beforeEach(function(){
browser.ignoreSynchronization = true;
});
// Logging in flow
});
describe('Angular application', function(){
// Angular application tests
}); This problem got me quite a headache, because my Angular tests where not synchronized anymore. The only way I managed to solve it is by writing functions like To prevent any other people for making the same mistake it might be good to make very clear that:
When that would be taken care of, I would really think that these utils might be handy to have. Mark |
I'm in favor of such additions. In particular, even in pure Angular apps, I had some synchronization issues due to pure CSS animations. For example, angular-ui-bootstrap has modal dialogs that appear using a sliding CSS animation, and tests randomly fail when trying to locate an element in the modal because the element to locate is not clickable/visible yet due to the animation. |
@marklagendijk where exactly in the official docs is suggested to put For the |
@juliemr thanks for putting out loud here discussions about
|
Didn't make a waitFor for each condition, but wrote conditions that you can plug into |
Honestly, I think only the The wait method that was added is okay, but it would be nice if Protractor could wait until an element is clickable from within the click method if not otherwise available. Then let it throw an error if the element is still un-clickable after the designated timeout |
+1 that the frameworks couple use some sort of We have an angular application that is only a part of a greater non-angular application, so we keep |
It's already there. It's called This is straight from the example:
|
fyi, the API names are make consistent with the java/python selenium expected conditions (although I think some could sound a little weird) Closing this issue since it's already addressed and released. |
@hankduan Thank you, great to hear! Could you please point to the documents you extracted them from though? I'm trying your example and wanted to read deeper (it's not working out of the box, but I'm inclined to blame myself first). |
Unfortunately it's not part of the website (note to self: add to API page), but you can read about it in the src https://github.com/angular/protractor/blob/master/lib/expectedConditions.js What's not working? (fyi, your protractor needs to be version 1.7.0 or above) |
Thanks again, a little more tweaking and I got it running. ^Handy read too |
fyi: issue for adding expected conditions to website: #1936 |
Indeed, that expected condition is inherited from the native Selenium suite (or...at least it was last I checked...). Let me take a dive into the source here though. I've been assuming (due to the speed at which my tests fail to quick hide/show animations) that the wait for clickability is not baked into the Protractor WebElement click method. If it's not though, and you guys feel it's an acceptable enhancement to the project, I'd be happy to put in a PR :) |
...and if it is baked in, and my tests have been failing for some other dumb reason, then I'll happily flog the developer who made me look like an idiot ;) |
I would also second @juliemr's and @davidadas's suggestion in adding waitFor functionality into click() functions, as well as sendKeys(), clear() and others. |
+1 On Thu, Aug 6, 2015 at 3:13 PM, joshin4colours notifications@github.com
|
+1! |
I'm not sure if these belong in Protractor core or not, but let's consolidate discussion under this issue.
This would be functions like:
Needing these can be red flags, because they mean that synchronization isn't working - but that may be true for websites outside of Angular (e.g. login pages).
The text was updated successfully, but these errors were encountered: