Skip to content

Commit

Permalink
fix(tests): Some code updates to the e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tombatossals committed Dec 22, 2013
1 parent e15a4e1 commit 5e47141
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
18 changes: 9 additions & 9 deletions test/e2e/01-center-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ describe('Loading center-example.html', function() {
element(by.className('leaflet-control-zoom-in')).click();
// Wait for zoom animation
ptor.sleep(300);
element(by.model("center.zoom")).then(function(zoom) {
expect(zoom).toBe('5');
});
expect(element(by.model("london.zoom")).getAttribute("value")).toBe('5');
});

it('should update the zoom value if the map is dragged', function() {
element(by.css('img.leaflet-map-pane')).find().then(function(el) {
console.log(el.getLocation());
browser.actions().mouseDown(el.find(), protractor.Button.LEFT).mouseMove({ x: 1400, y: 1200 }).perform();
ptor.sleep(1300);
});
it('should update the center value if the map is dragged', function() {
expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505');
expect(element(by.model("london.lng")).getAttribute("value")).toBe('-0.09');
var el = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][1]'));
browser.actions().dragAndDrop(el.find(), { x: 40, y: 40 }).perform();
ptor.sleep(t 300);
expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505');
expect(element(by.model("london.lng")).getAttribute("value")).toBe('-0.09');
});

});
3 changes: 2 additions & 1 deletion test/e2e/02-marker-add-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ describe('Loading marker-add-example.html', function() {
driver = ptor.driver;
});

it('should update the zoom value in the input if clicked the zoom control', function() {
it('should load a marker when clicked on the map', function() {
ptor.wait(function() {
return ptor.isElementPresent(by.css('img.leaflet-tile-loaded'));
});

element(by.css('img.leaflet-tile-loaded')).click().then(function() {
ptor.sleep(100);
expect(ptor.isElementPresent(by.css("img.leaflet-marker-icon"))).toBe(true);
});
});
Expand Down
1 change: 1 addition & 0 deletions test/e2e/05-googlemaps-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Loading googlemaps-example.html', function() {
return ptor.isElementPresent(by.xpath('//img[contains(@draggable, "false")]'));
});

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

Expand Down

0 comments on commit 5e47141

Please sign in to comment.