diff --git a/karma-js.conf.js b/karma-js.conf.js index 1fecb6ae1b..d90b9c07d6 100644 --- a/karma-js.conf.js +++ b/karma-js.conf.js @@ -26,6 +26,10 @@ module.exports = function(config) { 'test-main.js' ], + exclude: [ + 'modules/**/e2e_test/**' + ], + preprocessors: { 'modules/**/*.js': ['traceur'], 'modules/**/*.es6': ['traceur'], diff --git a/modules/benchmarks/e2e_test/change_detection_spec.es6 b/modules/benchmarks/e2e_test/change_detection_spec.es6 new file mode 100644 index 0000000000..fcd7b2a10d --- /dev/null +++ b/modules/benchmarks/e2e_test/change_detection_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng2 change detection benchmark', function () { + + var URL = 'benchmarks/web/change_detection/change_detection_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#ng2DetectChanges', '#baselineDetectChanges']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks/e2e_test/compiler_spec.es6 b/modules/benchmarks/e2e_test/compiler_spec.es6 new file mode 100644 index 0000000000..aef09eb623 --- /dev/null +++ b/modules/benchmarks/e2e_test/compiler_spec.es6 @@ -0,0 +1,21 @@ +"use strict"; +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng2 compiler benchmark', function () { + + var URL = 'benchmarks/web/compiler/compiler_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#compileWithBindings', '#compileNoBindings']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks/e2e_test/di_spec.es6 b/modules/benchmarks/e2e_test/di_spec.es6 new file mode 100644 index 0000000000..3fd6a7b800 --- /dev/null +++ b/modules/benchmarks/e2e_test/di_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng2 di benchmark', function () { + + var URL = 'benchmarks/web/di/di_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#getByToken', '#getByKey', '#getChild', '#instantiate']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks/e2e_test/element_injector_spec.es6 b/modules/benchmarks/e2e_test/element_injector_spec.es6 new file mode 100644 index 0000000000..272928e996 --- /dev/null +++ b/modules/benchmarks/e2e_test/element_injector_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng2 element injector benchmark', function () { + + var URL = 'benchmarks/web/element_injector/element_injector_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#instantiate', '#instantiateDirectives']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks/e2e_test/tree_spec.es6 b/modules/benchmarks/e2e_test/tree_spec.es6 new file mode 100644 index 0000000000..4524d72791 --- /dev/null +++ b/modules/benchmarks/e2e_test/tree_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng2 tree benchmark', function () { + + var URL = 'benchmarks/web/tree/tree_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#ng2CreateDom', '#ng2DestroyDom', '#baselineCreateDom', '#baselineDestroyDom']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks_external/e2e_test/compiler_spec.es6 b/modules/benchmarks_external/e2e_test/compiler_spec.es6 new file mode 100644 index 0000000000..5fb262d68b --- /dev/null +++ b/modules/benchmarks_external/e2e_test/compiler_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng1.x compiler benchmark', function () { + + var URL = 'benchmarks_external/web/compiler/compiler_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#compileWithBindings', '#compileNoBindings']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/benchmarks_external/e2e_test/tree_spec.es6 b/modules/benchmarks_external/e2e_test/tree_spec.es6 new file mode 100644 index 0000000000..19f6bbbbc5 --- /dev/null +++ b/modules/benchmarks_external/e2e_test/tree_spec.es6 @@ -0,0 +1,20 @@ +var benchpress = require('../../../tools/benchpress/index.js'); + +describe('ng1.x tree benchmark', function () { + + var URL = 'benchmarks_external/web/tree/tree_benchmark.html'; + + afterEach(benchpress.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + clickAll(['#createDom', '#destroyDom']); + }); + +}); + +function clickAll(buttonSelectors) { + buttonSelectors.forEach(function(selector) { + $(selector).click(); + }); +} diff --git a/modules/examples/e2e_test/hello_world/hello_world_spec.es6 b/modules/examples/e2e_test/hello_world/hello_world_spec.es6 new file mode 100644 index 0000000000..8a58a38075 --- /dev/null +++ b/modules/examples/e2e_test/hello_world/hello_world_spec.es6 @@ -0,0 +1,30 @@ +var benchpress = require('../../../../tools/benchpress/index.js'); +describe('hello world', function () { + + afterEach(benchpress.verifyNoBrowserErrors); + + describe('static reflection', function() { + var URL = 'examples/web/hello_world/index_static.html'; + + it('should greet', function() { + browser.get(URL); + + expect(getShadowText('hello-app')).toBe('hello world!'); + }); + }); + + describe('dynamic reflection', function() { + var URL = 'examples/web/hello_world/index.html'; + + it('should greet', function() { + browser.get(URL); + + expect(getShadowText('hello-app')).toBe('hello world!'); + }); + }); + +}); + +function getShadowText(selector) { + return browser.executeScript('return document.querySelector("'+selector+'").shadowRoot.textContent'); +} \ No newline at end of file diff --git a/protractor-e2e-dart2js.conf.js b/protractor-e2e-dart2js.conf.js new file mode 100644 index 0000000000..06200fb728 --- /dev/null +++ b/protractor-e2e-dart2js.conf.js @@ -0,0 +1,3 @@ +var config = exports.config = require('./protractor-e2e-shared.js').config; +config.baseUrl = 'http://localhost:8002/'; + diff --git a/protractor-e2e-js.conf.js b/protractor-e2e-js.conf.js new file mode 100644 index 0000000000..c29d611e39 --- /dev/null +++ b/protractor-e2e-js.conf.js @@ -0,0 +1,3 @@ +var config = exports.config = require('./protractor-e2e-shared.js').config; +config.baseUrl = 'http://localhost:8001/'; + diff --git a/protractor-e2e-shared.js b/protractor-e2e-shared.js new file mode 100644 index 0000000000..94aa97602e --- /dev/null +++ b/protractor-e2e-shared.js @@ -0,0 +1,46 @@ +// load traceur runtime as our tests are written in es6 +require('traceur/bin/traceur-runtime.js'); + +var config = exports.config = { + + specs: ['dist/cjs/**/*_spec.js'], + + // Disable waiting for Angular as we don't have an integration layer yet... + // TODO(tbosch): Implement a proper debugging API for Ng2.0, remove this here + // and the sleeps in all tests. + onPrepare: function() { + browser.ignoreSynchronization = true; + var _get = browser.get; + var sleepInterval = process.env.TRAVIS ? 5000 : 2000; + browser.get = function() { + var result = _get.apply(this, arguments); + browser.sleep(sleepInterval); + return result; + } + }, + + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000 + } +}; + +if (process.env.TRAVIS) { + config.capabilities = { + name: 'Dartium', + browserName: 'chrome', + chromeOptions: { + 'binary': process.env.DARTIUM + }, + loggingPrefs: { + performance: 'ALL' + } + }; +} else { + config.capabilities = { + browserName: 'chrome', + loggingPrefs: { + performance: 'ALL' + } + }; +} diff --git a/protractor-perf-shared.js b/protractor-perf-shared.js index 17b0195f7a..a2751f0567 100644 --- a/protractor-perf-shared.js +++ b/protractor-perf-shared.js @@ -27,10 +27,11 @@ var config = exports.config = { onPrepare: function() { browser.ignoreSynchronization = true; var _get = browser.get; - var sleepInterval = process.env.TRAVIS ? 5000 : 1000; + var sleepInterval = process.env.TRAVIS ? 5000 : 2000; browser.get = function() { + var result = _get.apply(this, arguments); browser.sleep(sleepInterval); - return _get.apply(this, arguments); + return result; } }, diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index 707c0c6fd0..ed0a98a5ca 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -29,5 +29,5 @@ serverPid=$! trap killServer EXIT -./node_modules/.bin/protractor protractor-perf-js.conf.js -./node_modules/.bin/protractor protractor-perf-dart2js.conf.js \ No newline at end of file +./node_modules/.bin/protractor protractor-e2e-js.conf.js +./node_modules/.bin/protractor protractor-e2e-dart2js.conf.js \ No newline at end of file