From c44fc94319a57b3cfb25884df102b3a241f5681d Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 15 Feb 2017 14:20:02 +0100 Subject: [PATCH 1/3] fix(ngScenario): completely remove the angular scenario runner The runner has been deprecated and undocumented since 2014: See commit 8d6d126899d4b1927360599403a7592011243270 Closes #9405 BREAKING CHANGE: The angular scenario runner end-to-end test framework has been removed from the project and will no longer be available on npm or bower starting with 1.7.0. It was deprecated and removed from the documentation in 2014. Applications that still use it should migrate to [Protractor](http://www.protractortest.org). Technically, it should also be possible to continue using an older version of the scenario runner, as the underlying APIs have not changed. However, we do not guarantee future compatibility. --- Gruntfile.js | 12 - angularFiles.js | 27 - package.json | 1 - src/ngScenario/.eslintrc.json | 15 - src/ngScenario/Application.js | 142 ---- src/ngScenario/Describe.js | 155 ----- src/ngScenario/Future.js | 64 -- src/ngScenario/ObjectModel.js | 252 -------- src/ngScenario/Runner.js | 229 ------- src/ngScenario/Scenario.js | 329 ---------- src/ngScenario/SpecRunner.js | 149 ----- src/ngScenario/angular-bootstrap.js | 60 -- src/ngScenario/angular.prefix | 7 - src/ngScenario/angular.suffix | 22 - src/ngScenario/dsl.js | 484 -------------- src/ngScenario/matchers.js | 45 -- src/ngScenario/output/Html.js | 171 ----- src/ngScenario/output/Json.js | 10 - src/ngScenario/output/Object.js | 8 - src/ngScenario/output/Xml.js | 54 -- test/ng/directive/inputSpec.js | 3 +- test/ngScenario/ApplicationSpec.js | 244 ------- test/ngScenario/DescribeSpec.js | 123 ---- test/ngScenario/FutureSpec.js | 77 --- test/ngScenario/ObjectModelSpec.js | 333 ---------- test/ngScenario/RunnerSpec.js | 116 ---- test/ngScenario/ScenarioSpec.js | 44 -- test/ngScenario/SpecRunnerSpec.js | 177 ----- test/ngScenario/dslSpec.js | 789 ----------------------- test/ngScenario/e2e/.eslintrc.json | 9 - test/ngScenario/e2e/Runner-compiled.html | 9 - test/ngScenario/e2e/Runner.html | 10 - test/ngScenario/e2e/style.css | 11 - test/ngScenario/e2e/widgets-scenario.js | 69 -- test/ngScenario/e2e/widgets.html | 99 --- test/ngScenario/matchersSpec.js | 51 -- test/ngScenario/mocks.js | 33 - test/ngScenario/output/HtmlSpec.js | 127 ---- test/ngScenario/output/jsonSpec.js | 37 -- test/ngScenario/output/objectSpec.js | 40 -- test/ngScenario/output/xmlSpec.js | 49 -- yarn.lock | 4 - 42 files changed, 1 insertion(+), 4689 deletions(-) delete mode 100644 src/ngScenario/.eslintrc.json delete mode 100644 src/ngScenario/Application.js delete mode 100644 src/ngScenario/Describe.js delete mode 100644 src/ngScenario/Future.js delete mode 100644 src/ngScenario/ObjectModel.js delete mode 100644 src/ngScenario/Runner.js delete mode 100644 src/ngScenario/Scenario.js delete mode 100644 src/ngScenario/SpecRunner.js delete mode 100644 src/ngScenario/angular-bootstrap.js delete mode 100644 src/ngScenario/angular.prefix delete mode 100644 src/ngScenario/angular.suffix delete mode 100644 src/ngScenario/dsl.js delete mode 100644 src/ngScenario/matchers.js delete mode 100644 src/ngScenario/output/Html.js delete mode 100644 src/ngScenario/output/Json.js delete mode 100644 src/ngScenario/output/Object.js delete mode 100644 src/ngScenario/output/Xml.js delete mode 100644 test/ngScenario/ApplicationSpec.js delete mode 100644 test/ngScenario/DescribeSpec.js delete mode 100644 test/ngScenario/FutureSpec.js delete mode 100644 test/ngScenario/ObjectModelSpec.js delete mode 100644 test/ngScenario/RunnerSpec.js delete mode 100644 test/ngScenario/ScenarioSpec.js delete mode 100644 test/ngScenario/SpecRunnerSpec.js delete mode 100644 test/ngScenario/dslSpec.js delete mode 100644 test/ngScenario/e2e/.eslintrc.json delete mode 100644 test/ngScenario/e2e/Runner-compiled.html delete mode 100644 test/ngScenario/e2e/Runner.html delete mode 100644 test/ngScenario/e2e/style.css delete mode 100644 test/ngScenario/e2e/widgets-scenario.js delete mode 100644 test/ngScenario/e2e/widgets.html delete mode 100644 test/ngScenario/matchersSpec.js delete mode 100644 test/ngScenario/mocks.js delete mode 100644 test/ngScenario/output/HtmlSpec.js delete mode 100644 test/ngScenario/output/jsonSpec.js delete mode 100644 test/ngScenario/output/objectSpec.js delete mode 100644 test/ngScenario/output/xmlSpec.js diff --git a/Gruntfile.js b/Gruntfile.js index ff5eb26de2a0..c9c32ca8d71a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -186,16 +186,6 @@ module.exports = function(grunt) { }, build: { - scenario: { - dest: 'build/angular-scenario.js', - src: [ - 'bower_components/jquery/dist/jquery.js', - util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular') - ], - styles: { - css: ['css/angular.css', 'css/angular-scenario.css'] - } - }, angular: { dest: 'build/angular.js', src: util.wrap([files['angularSrc']], 'angular'), @@ -281,9 +271,7 @@ module.exports = function(grunt) { files: [ 'src/**/*.js', 'test/**/*.js', - '!test/ngScenario/DescribeSpec.js', '!src/ng/directive/attrs.js', // legitimate xit here - '!src/ngScenario/**/*.js', '!test/helpers/privateMocks*.js' ], options: { diff --git a/angularFiles.js b/angularFiles.js index 4c7b8cc361e4..7c4062d41ad4 100644 --- a/angularFiles.js +++ b/angularFiles.js @@ -153,26 +153,8 @@ var angularFiles = { ] }, - 'angularScenario': [ - 'src/ngScenario/Scenario.js', - 'src/ngScenario/Application.js', - 'src/ngScenario/Describe.js', - 'src/ngScenario/Future.js', - 'src/ngScenario/ObjectModel.js', - 'src/ngScenario/Runner.js', - 'src/ngScenario/SpecRunner.js', - 'src/ngScenario/dsl.js', - 'src/ngScenario/matchers.js', - 'src/ngScenario/output/Html.js', - 'src/ngScenario/output/Json.js', - 'src/ngScenario/output/Xml.js', - 'src/ngScenario/output/Object.js' - ], - 'angularTest': [ 'test/helpers/*.js', - 'test/ngScenario/*.js', - 'test/ngScenario/output/*.js', 'test/*.js', 'test/auto/*.js', 'test/ng/**/*.js', @@ -193,22 +175,15 @@ var angularFiles = { 'test/jquery_remove.js', '@angularSrc', '@angularSrcModules', - '@angularScenario', '@angularTest' ], 'karmaExclude': [ 'test/jquery_alias.js', 'src/angular-bootstrap.js', - 'src/ngScenario/angular-bootstrap.js', 'src/angular.bind.js' ], - 'karmaScenario': [ - 'build/angular-scenario.js', - 'build/docs/docs-scenario.js' - ], - 'karmaModules': [ 'build/angular.js', '@angularSrcModules', @@ -231,13 +206,11 @@ var angularFiles = { 'test/jquery_alias.js', '@angularSrc', '@angularSrcModules', - '@angularScenario', '@angularTest' ], 'karmaJqueryExclude': [ 'src/angular-bootstrap.js', - 'src/ngScenario/angular-bootstrap.js', 'test/jquery_remove.js', 'src/angular.bind.js' ] diff --git a/package.json b/package.json index 6ca57a1193c5..86876028ed21 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "karma-firefox-launcher": "^1.0.1", "karma-jasmine": "^1.1.0", "karma-junit-reporter": "^1.2.0", - "karma-ng-scenario": "^1.0.0", "karma-sauce-launcher": "^1.2.0", "karma-script-launcher": "^1.0.0", "karma-spec-reporter": "^0.0.31", diff --git a/src/ngScenario/.eslintrc.json b/src/ngScenario/.eslintrc.json deleted file mode 100644 index 454d02348435..000000000000 --- a/src/ngScenario/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "globals": { - "includes": false, - "asyncForEach": false, - "msie": false, - "browserTrigger": false, - "console": false, - "alert": false, - "_jQuery": false, - "angularInit": false, - "formatException": false, - "$runner": false, - "callerFile": false - } -} diff --git a/src/ngScenario/Application.js b/src/ngScenario/Application.js deleted file mode 100644 index ec5d1626a6bd..000000000000 --- a/src/ngScenario/Application.js +++ /dev/null @@ -1,142 +0,0 @@ -'use strict'; - -/** - * Represents the application currently being tested and abstracts usage - * of iframes or separate windows. - * - * @param {Object} context jQuery wrapper around HTML context. - */ -angular.scenario.Application = function(context) { - this.context = context; - context.append( - '

Current URL: None

' + - '
' - ); -}; - -/** - * Gets the jQuery collection of frames. Don't use this directly because - * frames may go stale. - * - * @private - * @return {Object} jQuery collection - */ -angular.scenario.Application.prototype.getFrame_ = function() { - return this.context.find('#test-frames iframe:last'); -}; - -/** - * Gets the window of the test runner frame. Always favor executeAction() - * instead of this method since it prevents you from getting a stale window. - * - * @private - * @return {Object} the window of the frame - */ -angular.scenario.Application.prototype.getWindow_ = function() { - var contentWindow = this.getFrame_().prop('contentWindow'); - if (!contentWindow) { - throw new Error('Frame window is not accessible.'); - } - return contentWindow; -}; - -/** - * Changes the location of the frame. - * - * @param {string} url The URL. If it begins with a # then only the - * hash of the page is changed. - * @param {function()} loadFn function($window, $document) Called when frame loads. - * @param {function()} errorFn function(error) Called if any error when loading. - */ -angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorFn) { - var self = this; - var frame = self.getFrame_(); - //TODO(esprehn): Refactor to use rethrow() - errorFn = errorFn || function(e) { throw e; }; - if (url === 'about:blank') { - errorFn('Sandbox Error: Navigating to about:blank is not allowed.'); - } else if (url.charAt(0) === '#') { - url = frame.attr('src').split('#')[0] + url; - frame.attr('src', url); - self.executeAction(loadFn); - } else { - frame.remove(); - self.context.find('#test-frames').append('