Skip to content

Commit

Permalink
fix(tests): Fixed the waiting times on the protractor e2e test google…
Browse files Browse the repository at this point in the history
…maps-example.html
  • Loading branch information
tombatossals committed Dec 22, 2013
1 parent a9204a7 commit 4e67f35
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/e2e/05-googlemaps-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ describe('Loading googlemaps-example.html', function() {

it('should change the Google Maps tiles if clicked on the leaflet control switch layer', function() {
ptor.wait(function() {
return ptor.isElementPresent(by.xpath('//img[contains(@draggable, "false")]'));
return ptor.isElementPresent(by.xpath('//img[contains(@src, "http://mt1.googleapis.com")]')).then(function(elementLoaded) {
return elementLoaded;
});
});

ptor.sleep(300);
var img1 = element(by.xpath('//img[contains(@draggable, "false")][1]'));
expect(img1.getAttribute("src")).toMatch("mt.\\.googleapis\\.com");

expect(ptor.isElementPresent(by.xpath('//img[contains(@src, "http://mt1.googleapis.com")]'))).toBe(true);
ptor.actions().mouseMove(element(by.xpath('//a[contains(@class, "leaflet-control-layers-toggle")][1]')).find()).perform();

ptor.sleep(100);
ptor.findElements(by.css("input.leaflet-control-layers-selector")).then(function(inputs) {
var input = inputs[1];
input.click().then(function() {
ptor.sleep(300);
var img1 = element(by.xpath('//img[contains(@draggable, "false")][1]'));
expect(img1.getAttribute("src")).toMatch("khm.\\.googleapis\\.com");
ptor.wait(function() {
return ptor.isElementPresent(by.xpath('//img[contains(@src, "http://khm1.googleapis.com")]')).then(function(elementLoaded) {
return elementLoaded;
});
});
expect(ptor.isElementPresent(by.xpath('//img[contains(@src, "http://khm1.googleapis.com")]'))).toBe(true);
});
});
});
Expand Down

0 comments on commit 4e67f35

Please sign in to comment.