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/docs/content/guide/e2e-testing.ngdoc b/docs/content/guide/e2e-testing.ngdoc index 4593d10716d3..9d1fa32fcee6 100644 --- a/docs/content/guide/e2e-testing.ngdoc +++ b/docs/content/guide/e2e-testing.ngdoc @@ -5,12 +5,6 @@ # E2E Testing -
-**Note:** In the past, end-to-end testing could be done with a deprecated tool called -[AngularJS Scenario Runner](http://code.angularjs.org/1.2.16/docs/guide/e2e-testing). That tool -is now in maintenance mode. -
- As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to verify the correctness of new features, catch bugs and notice regressions. Unit tests are the first line of defense for catching bugs, but sometimes issues come up with integration 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/ng/browser.js b/src/ng/browser.js index 3f5f125ed4c3..d5fbc9b6054a 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -67,7 +67,6 @@ function Browser(window, document, $log, $sniffer) { /** * @private - * Note: this method is used only by scenario runner * TODO(vojta): prefix this method with $$ ? * @param {function()} callback Function that will be called when no outstanding request */ diff --git a/src/ng/location.js b/src/ng/location.js index 625b9297720d..369b45d3fff2 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -938,8 +938,6 @@ function $LocationProvider() { // update location manually if ($location.absUrl() !== $browser.url()) { $rootScope.$apply(); - // hack to work around FF6 bug 684208 when scenario runner clicks on links - $window.angular['ff-684208-preventDefault'] = true; } } } diff --git a/src/ngMock/browserTrigger.js b/src/ngMock/browserTrigger.js index 13b2592fea03..196772d1e3e9 100644 --- a/src/ngMock/browserTrigger.js +++ b/src/ngMock/browserTrigger.js @@ -2,13 +2,56 @@ (function() { /** - * Triggers a browser event. Attempts to choose the right event if one is - * not specified. + * @ngdoc function + * @name browserTrigger + * @description + * + * This is a global (window) function that is only available when the {@link ngMock} module is + * included. + * + * It can be used to trigger a native browser event on an element, which is useful for unit testing. + * * * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement - * @param {string} eventType Optional event type - * @param {Object=} eventData An optional object which contains additional event data (such as x,y - * coordinates, keys, etc...) that are passed into the event when triggered + * @param {string=} eventType Optional event type. If none is specified, the function tries + * to determine the right event type for the element, e.g. `change` for + * `input[text]`. + * @param {Object=} eventData An optional object which contains additional event data that is used + * when creating the event: + * + * - `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles). + * Not applicable to all events. + * + * - `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable). + * Not applicable to all events. + * + * - `charcode`: [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode) + * for keyboard events (keydown, keypress, and keyup). + * + * - `elapsedTime`: the elapsedTime for + * [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent) + * and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent). + * + * - `keycode`: [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode) + * for keyboard events (keydown, keypress, and keyup). + * + * - `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for + * [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and + * keyboard events (keydown, keypress, and keyup). + * + * - `relatedTarget`: the + * [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget) + * for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent). + * + * - `which`: [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which) + * for keyboard events (keydown, keypress, and keyup). + * + * - `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + * + * - `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) + * and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent). + * */ window.browserTrigger = function browserTrigger(element, eventType, eventData) { if (element && !element.nodeName) element = element[0]; @@ -104,30 +147,11 @@ if (!evnt) return; - var originalPreventDefault = evnt.preventDefault, - appWindow = element.ownerDocument.defaultView, - fakeProcessDefault = true, - finalProcessDefault, - angular = appWindow.angular || {}; - - // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208 - angular['ff-684208-preventDefault'] = false; - evnt.preventDefault = function() { - fakeProcessDefault = false; - return originalPreventDefault.apply(evnt, arguments); - }; - if (!eventData.bubbles || supportsEventBubblingInDetachedTree() || isAttachedToDocument(element)) { - element.dispatchEvent(evnt); + return element.dispatchEvent(evnt); } else { triggerForPath(element, evnt); } - - finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault); - - delete angular['ff-684208-preventDefault']; - - return finalProcessDefault; }; function supportsTouchEvents() { 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('