Skip to content

Commit 14e91e2

Browse files
committed
feat(test): add e2e tests for benchmarks and examples
Disables running the actual benchmarks on every commit as well to speed up the build.
1 parent 8c65272 commit 14e91e2

File tree

14 files changed

+232
-4
lines changed

14 files changed

+232
-4
lines changed

karma-js.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module.exports = function(config) {
2626
'test-main.js'
2727
],
2828

29+
exclude: [
30+
'modules/**/e2e_test/**'
31+
],
32+
2933
preprocessors: {
3034
'modules/**/*.js': ['traceur'],
3135
'modules/**/*.es6': ['traceur'],
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng2 change detection benchmark', function () {
4+
5+
var URL = 'benchmarks/web/change_detection/change_detection_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#ng2DetectChanges', '#baselineDetectChanges']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
var benchpress = require('../../../tools/benchpress/index.js');
3+
4+
describe('ng2 compiler benchmark', function () {
5+
6+
var URL = 'benchmarks/web/compiler/compiler_benchmark.html';
7+
8+
afterEach(benchpress.verifyNoBrowserErrors);
9+
10+
it('should not throw errors', function() {
11+
browser.get(URL);
12+
clickAll(['#compileWithBindings', '#compileNoBindings']);
13+
});
14+
15+
});
16+
17+
function clickAll(buttonSelectors) {
18+
buttonSelectors.forEach(function(selector) {
19+
$(selector).click();
20+
});
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng2 di benchmark', function () {
4+
5+
var URL = 'benchmarks/web/di/di_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#getByToken', '#getByKey', '#getChild', '#instantiate']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng2 element injector benchmark', function () {
4+
5+
var URL = 'benchmarks/web/element_injector/element_injector_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#instantiate', '#instantiateDirectives']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng2 tree benchmark', function () {
4+
5+
var URL = 'benchmarks/web/tree/tree_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#ng2CreateDom', '#ng2DestroyDom', '#baselineCreateDom', '#baselineDestroyDom']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng1.x compiler benchmark', function () {
4+
5+
var URL = 'benchmarks_external/web/compiler/compiler_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#compileWithBindings', '#compileNoBindings']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var benchpress = require('../../../tools/benchpress/index.js');
2+
3+
describe('ng1.x tree benchmark', function () {
4+
5+
var URL = 'benchmarks_external/web/tree/tree_benchmark.html';
6+
7+
afterEach(benchpress.verifyNoBrowserErrors);
8+
9+
it('should not throw errors', function() {
10+
browser.get(URL);
11+
clickAll(['#createDom', '#destroyDom']);
12+
});
13+
14+
});
15+
16+
function clickAll(buttonSelectors) {
17+
buttonSelectors.forEach(function(selector) {
18+
$(selector).click();
19+
});
20+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var benchpress = require('../../../../tools/benchpress/index.js');
2+
describe('hello world', function () {
3+
4+
afterEach(benchpress.verifyNoBrowserErrors);
5+
6+
describe('static reflection', function() {
7+
var URL = 'examples/web/hello_world/index_static.html';
8+
9+
it('should greet', function() {
10+
browser.get(URL);
11+
12+
expect(getShadowText('hello-app')).toBe('hello world!');
13+
});
14+
});
15+
16+
describe('dynamic reflection', function() {
17+
var URL = 'examples/web/hello_world/index.html';
18+
19+
it('should greet', function() {
20+
browser.get(URL);
21+
22+
expect(getShadowText('hello-app')).toBe('hello world!');
23+
});
24+
});
25+
26+
});
27+
28+
function getShadowText(selector) {
29+
return browser.executeScript('return document.querySelector("'+selector+'").shadowRoot.textContent');
30+
}

protractor-e2e-dart2js.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var config = exports.config = require('./protractor-e2e-shared.js').config;
2+
config.baseUrl = 'http://localhost:8002/';
3+

0 commit comments

Comments
 (0)