Skip to content

Commit

Permalink
feat(tests): Added a new E2E protractor tests for the paths-simple-ex…
Browse files Browse the repository at this point in the history
…ample.html
  • Loading branch information
tombatossals committed Jan 9, 2014
1 parent 0fb1a42 commit c74c231
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/paths-simple-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ <h2>Types of paths</h2>

<div class="row">
<div class="btn-group">
<button type="button" ng-click="addShape('polyline')" class="btn btn-default">Polyline</button>
<button type="button" ng-click="addShape('polyline')" class="btn btn-default">polyline</button>
<button type="button" ng-click="addShape('multiPolyline')" class="btn btn-default">multiPolyline</button>
<button type="button" ng-click="addShape('polygon')" class="btn btn-default">Polygon</button>
<button type="button" ng-click="addShape('polygon')" class="btn btn-default">polygon</button>
<button type="button" ng-click="addShape('multiPolygon')" class="btn btn-default">multiPolygon</button>
<button type="button" ng-click="addShape('rectangle')" class="btn btn-default">Rectangle</button>
<button type="button" ng-click="addShape('circle')" class="btn btn-default">Circle</button>
<button type="button" ng-click="addShape('rectangle')" class="btn btn-default">rectangle</button>
<button type="button" ng-click="addShape('circle')" class="btn btn-default">circle</button>
<button type="button" ng-click="addShape('circleMarker')" class="btn btn-default">circleMarker</button>
</div>
</div>
Expand Down
56 changes: 56 additions & 0 deletions test/e2e/12-path-simple-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict';

describe('Loading paths-simple-example.html', function() {

var ptor, driver;
beforeEach(function() {
ptor = protractor.getInstance();
browser.get('paths-simple-example.html');
driver = ptor.driver;
});

it('should show a polyline on the map when clicked the polyline button', function() {
element(by.xpath('//button[text()="polyline"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M320 200L300 291L392 280"]'))).toBe(true);
});
});

it('should show a multipolyline on the map when clicked the multipolyline button', function() {
element(by.xpath('//button[text()="multiPolyline"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M320 200L269 304"]'))).toBe(true);
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M334 223L300 291"]'))).toBe(true);
});
});

it('should show a polygon on the map when clicked the polygon button', function() {
element(by.xpath('//button[text()="polygon"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M320 200L269 304L300 291L334 223z"]'))).toBe(true);
});
});

it('should show a multipolygon on the map when clicked the multipolygon button', function() {
element(by.xpath('//button[text()="multiPolygon"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M320 200L269 304L300 291L334 223z"]'))).toBe(true);
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M397 191L392 280L344 206z"]'))).toBe(true);
});
});

it('should show a rectangle on the map when clicked the rectangle button', function() {
element(by.xpath('//button[text()="rectangle"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M269 304L269 191L397 191L397 304z"]'))).toBe(true);
});
});

it('should show a circle on the map when clicked the circle button', function() {
element(by.xpath('//button[text()="circle"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M344,165A41,41,0,1,1,343.9,165 z" and @stroke-linejoin="round"]'))).toBe(true);
});
});

it('should show a circleMarker on the map when clicked the circleMarker button', function() {
element(by.xpath('//button[text()="circleMarker"]')).click().then(function() {
expect(ptor.isElementPresent(by.xpath('//*[local-name()="svg" and namespace-uri()="http://www.w3.org/2000/svg"]//*[local-name()="path" and @d="M392,230A50,50,0,1,1,391.9,230 z" and @stroke-linejoin="round"]'))).toBe(true);
});
});

});

0 comments on commit c74c231

Please sign in to comment.