Skip to content

Commit 75ea5b2

Browse files
committed
Add protractor for end-to-end tests.
1 parent 0f8f2c6 commit 75ea5b2

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

app/components/header/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<a href="#/" class="pull-left">
1414
<img class="logo" alt="Icon" src="./navbar_icon.png" height="20" width="20">
1515
</a>
16-
<a class="navbar-brand app-name" href="#/">
16+
<a class="navbar-brand app-name" id="toStart" href="#/">
1717
LinkedDataVOWL
1818
<small>V{{::header.appVersion}}</small>
1919
</a>
@@ -29,7 +29,7 @@
2929
</a>
3030
</li>
3131
<li ng-class="{ active: header.isActive('/settings') }">
32-
<a ng-href="#/settings">
32+
<a ng-href="#/settings" id="toSettings">
3333
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
3434
Settings
3535
</a>

app/components/start/start.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1>LinkedDataVOWL</h1>
2020
ng-minlength="7" typeahead-min-length="0" placeholder="Type in an URL or select some from the list"/>
2121
</div>
2222
<div class="col-sm-3">
23-
<button type="button" class="btn btn-primary" ng-click="start.showGraph()"
23+
<button type="button" class="btn btn-primary" id="showGraph" ng-click="start.showGraph()"
2424
ng-disabled="endpointForm.url.$dirty && endpointForm.url.$invalid">
2525
Show Graph &raquo;
2626
</button>

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"ng-annotate-loader": "0.0.10",
5454
"node-sass": "^3.4.2",
5555
"phantomjs": "^1.9.19",
56+
"protractor": "^3.2.2",
5657
"sass-loader": "^3.1.2",
5758
"style-loader": "^0.13.0",
5859
"url-loader": "^0.5.7",
@@ -64,6 +65,7 @@
6465
"host": "webpack-dev-server --host 0.0.0.0 --content-base app --inline --hot",
6566
"proxy": "node ../anti-cors-proxy/index.js",
6667
"test": "karma start",
68+
"e2etest": "protractor protractor.conf.js",
6769
"lint": "eslint . --ext .js || true",
6870
"deploy": "NODE_ENV=production webpack -p --config webpack.production.config.js"
6971
},

protractor.conf.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
exports.config = {
2+
framework: 'jasmine',
3+
seleniumAddress: 'http://localhost:4444/wd/hub',
4+
specs: ['test/e2e/*e2e.js']
5+
};

test/e2e/settings.e2e.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* globals browser, element, by */
2+
'use strict';
3+
4+
describe('Settings Page', function () {
5+
6+
let host = 'http://localhost';
7+
let portNumber = 8080;
8+
let pageName = 'settings';
9+
let appName = 'LinkedDataVOWL';
10+
let separator = ' — ';
11+
12+
beforeEach(function () {
13+
browser.get(host + ':' + portNumber + '/#/' + pageName);
14+
});
15+
16+
it('should be on the settings page', function () {
17+
expect(browser.getTitle()).toBe(appName + separator + 'Settings');
18+
});
19+
20+
it('should be possible to go back to start page', function () {
21+
element(by.id('toStart')).click();
22+
expect(browser.getTitle()).toBe(appName + separator + 'Start');
23+
});
24+
25+
});

test/e2e/start.e2e.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* globals browser, element, by */
2+
'use strict';
3+
4+
describe('Start Page', function () {
5+
6+
let appName = 'LinkedDataVOWL';
7+
let separator = ' — ';
8+
9+
beforeEach(function () {
10+
browser.get('http://localhost:8080/#/');
11+
});
12+
13+
it('should have a title', function () {
14+
expect(browser.getTitle()).toBe(appName + separator + 'Start');
15+
});
16+
17+
it('should be possible to switch to settings page', function () {
18+
element(by.id('toSettings')).click();
19+
expect(browser.getTitle()).toBe(appName + separator + 'Settings');
20+
});
21+
22+
});

0 commit comments

Comments
 (0)