This is, or should be, an easy one, nevertheless it pained my ass because I'm a stinky newbie to Protractor.
TL;DR: Use browser.wait(protractor.until.elementLocated(locator), timeout) to wait for markers to present, like the following code
browser.wait(protractor.until.elementLocated(by.className('gmnoprint')), 10000);
The above code tells browser to wait at most 10 seconds for markers to present.
Then you can safely make expectations upon them.
expect(element.all(by.xpath("//div[@class=\"gmnoprint\" and @title]")).count()).toBeGreaterThan(0);
And thanks to this article, Protractor Testing with Google Map Markers and Markerclusterers, without which I could never get a clue about how to access markers DOM in protractor. (with a class name = "gmnoprint", how the hell do I know it?)
No comments:
Post a Comment