Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit 4e67f35

Browse files
committed
fix(tests): Fixed the waiting times on the protractor e2e test googlemaps-example.html
1 parent a9204a7 commit 4e67f35

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/e2e/05-googlemaps-example.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ describe('Loading googlemaps-example.html', function() {
1111

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

17-
ptor.sleep(300);
18-
var img1 = element(by.xpath('//img[contains(@draggable, "false")][1]'));
19-
expect(img1.getAttribute("src")).toMatch("mt.\\.googleapis\\.com");
20-
19+
expect(ptor.isElementPresent(by.xpath('//img[contains(@src, "http://mt1.googleapis.com")]'))).toBe(true);
2120
ptor.actions().mouseMove(element(by.xpath('//a[contains(@class, "leaflet-control-layers-toggle")][1]')).find()).perform();
2221

23-
ptor.sleep(100);
2422
ptor.findElements(by.css("input.leaflet-control-layers-selector")).then(function(inputs) {
2523
var input = inputs[1];
2624
input.click().then(function() {
27-
ptor.sleep(300);
28-
var img1 = element(by.xpath('//img[contains(@draggable, "false")][1]'));
29-
expect(img1.getAttribute("src")).toMatch("khm.\\.googleapis\\.com");
25+
ptor.wait(function() {
26+
return ptor.isElementPresent(by.xpath('//img[contains(@src, "http://khm1.googleapis.com")]')).then(function(elementLoaded) {
27+
return elementLoaded;
28+
});
29+
});
30+
expect(ptor.isElementPresent(by.xpath('//img[contains(@src, "http://khm1.googleapis.com")]'))).toBe(true);
3031
});
3132
});
3233
});

0 commit comments

Comments
 (0)