From 4e67f35ef9e72de3e0e7d05d62099714b905b1d8 Mon Sep 17 00:00:00 2001 From: tombatossals Date: Sun, 22 Dec 2013 19:31:22 +0100 Subject: [PATCH] fix(tests): Fixed the waiting times on the protractor e2e test googlemaps-example.html --- test/e2e/05-googlemaps-example.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/e2e/05-googlemaps-example.js b/test/e2e/05-googlemaps-example.js index b081f9d5..2f7153e4 100644 --- a/test/e2e/05-googlemaps-example.js +++ b/test/e2e/05-googlemaps-example.js @@ -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); }); }); });