Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
added new e2e spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Wasilkowski committed Oct 3, 2015
1 parent 0642f3f commit 4d83c67
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
57 changes: 57 additions & 0 deletions test/e2e/specs/feature-layer-events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
'use strict';

var helper = require('../helper');

describe('Feature Layer Events', function() {
// shared element locators
var map = element(by.id('map'));
var mapGraphics = element(by.id('map_gc'));
// point
var pointFeatureLayer = element(by.id('graphicsLayer1_layer'));
var treesUpdateEndCountInfo = element(by.id('treesUpdateEndCountInfo'));

beforeAll(function() {
// refer to "gulp test" task to get the baseUrl that is prepended
browser.get('/feature-layer-events.html');
});

it('should check that the map has a feature layer', function() {
// element locator(s) specific to this test
helper.waitUntilElementIsReady(map);
helper.waitUntilElementIsReady(mapGraphics);

helper.getAsyncAttributeValue(pointFeatureLayer, 'data-geometry-type').then(function(value) {
expect(value).toEqual('point');
});
});

it('should load the point feature layer and change informational text', function() {
// element locator(s) specific to this test
var treesLoadedInfo = element(by.id('treesLoadedInfo'));
helper.waitUntilElementIsReady(map);
helper.waitUntilElementIsReady(mapGraphics);

helper.getAsyncAttributeValue(pointFeatureLayer, 'data-geometry-type').then(function() {
// we are not concerned with the data-geometry-type
// but we want to give the layer time to load
expect(treesLoadedInfo.getText()).toBe('is loaded');
expect(treesUpdateEndCountInfo.getText()).toBe('has been updated 0 times');
});
});

it('should click on the checkbox control, toggle on layer visibility, and change informational text', function() {
// element locator(s) specific to this test
var showTreesToggle = element(by.model('map.showTrees'));
var treesVisibleInfo = element(by.id('treesVisibleInfo'));

showTreesToggle.click();

helper.getAsyncAttributeValue(pointFeatureLayer, 'data-geometry-type').then(function() {
// we are not concerned with the data-geometry-type
// but we want to give the layer time to display itself after executing showTreesToggle.click()
expect(pointFeatureLayer.getCssValue('display')).toEqual('block');
expect(treesVisibleInfo.getText()).toBe('is visible');
expect(treesUpdateEndCountInfo.getText()).not.toBe('has been updated 0 times');
});
});
});
4 changes: 2 additions & 2 deletions test/feature-layer-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Feature Layers</title>
<title>Feature Layer Events</title>

<!-- load Esri CSS -->
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.11/esri/css/esri.css">
</head>
<body ng-controller="MapController">
<h2>Feature Layers</h2>
<h2>Feature Layer Events</h2>
<!-- add map to page and bind to scope map parameters -->
<esri-map id="map" center="map.center" zoom="map.zoom" basemap="topo">
<esri-feature-layer
Expand Down

0 comments on commit 4d83c67

Please sign in to comment.