Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor(test/e2e): restore consistency across tests and remove redundant waitForAngular() calls #14920

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/e2e/fixtures/angular-already-loaded/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!DOCTYPE html>
<html ng-app="test">
<div ng-controller="TestCtrl">
<p>{{text}}</p>
</div>
<body>
<div ng-controller="TestController">
<p>{{text}}</p>
</div>

<script src="angular.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
<script src="angular.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</body>
</html>
7 changes: 4 additions & 3 deletions test/e2e/fixtures/angular-already-loaded/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("test", []).
controller("TestCtrl", function($scope) {
$scope.text = "Hello, world!";
angular.
module('test', []).
controller('TestController', function($scope) {
$scope.text = 'Hello, world!';
});
35 changes: 19 additions & 16 deletions test/e2e/fixtures/loader/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<!DOCTYPE html>
<html ng-app="test">
<div ng-controller="TestCtrl">
<p>{{text}}</p>
</div>
<body>
<div ng-controller="TestController">
<p>{{text}}</p>
</div>

<script src="angular-loader.js"></script>
<script src="angular-touch.js"></script>
<script src="angular-sanitize.js"></script>
<script src="angular-route.js"></script>
<script src="angular-resource.js"></script>
<script src="angular-parse-ext.js"></script>
<script src="angular-messages.js"></script>
<script src="angular-message-format.js"></script>
<script src="angular-cookies.js"></script>
<script src="angular-aria.js"></script>
<script src="angular-animate.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
<!-- Load modules before `angular.js` -->
<script src="angular-loader.js"></script>
<script src="angular-touch.js"></script>
<script src="angular-sanitize.js"></script>
<script src="angular-route.js"></script>
<script src="angular-resource.js"></script>
<script src="angular-parse-ext.js"></script>
<script src="angular-messages.js"></script>
<script src="angular-message-format.js"></script>
<script src="angular-cookies.js"></script>
<script src="angular-aria.js"></script>
<script src="angular-animate.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion test/e2e/fixtures/loader/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ angular.
'ngAria',
'ngAnimate'
]).
controller('TestCtrl', function TestCtrl($scope) {
controller('TestController', function($scope) {
$scope.text = 'Hello, world!';
});
2 changes: 1 addition & 1 deletion test/e2e/fixtures/ngJq/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
window[''] = window.jQuery;
</script>
<script src="angular.js"></script>
<script type="text/javascript" src="script.js"></script>
<script src="script.js"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions test/e2e/fixtures/ngJq/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('test', [])
.run(function($rootScope) {
angular.
module('test', []).
run(function($rootScope) {
$rootScope.jqueryVersion = window.angular.element().jquery || 'jqLite';
});
18 changes: 9 additions & 9 deletions test/e2e/fixtures/ngJqJquery/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html ng-app="test" ng-jq="jQuery_2_1_0">
<body>
{{jqueryVersion}}
{{jqueryVersion}}

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script>
var jQuery_2_1_0 = jQuery.noConflict();
</script>
<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
<script src="angular.js"></script>
<script type="text/javascript" src="script.js"></script>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script>
var jQuery_2_1_0 = jQuery.noConflict();
</script>
<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions test/e2e/fixtures/ngJqJquery/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module('test', [])
.run(function($rootScope) {
angular.
module('test', []).
run(function($rootScope) {
$rootScope.jqueryVersion = window.angular.element().jquery || 'jqLite';
});
12 changes: 7 additions & 5 deletions test/e2e/fixtures/sample/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<!DOCTYPE html>
<html ng-app="test">
<div ng-controller="TestCtrl">
<p>{{text}}</p>
</div>
<body>
<div ng-controller="TestController">
<p>{{text}}</p>
</div>

<script src="angular.js"></script>
<script src="script.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</body>
</html>
7 changes: 4 additions & 3 deletions test/e2e/fixtures/sample/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
angular.module("test", []).
controller("TestCtrl", function($scope) {
$scope.text = "Hello, world!";
angular.
module('test', []).
controller('TestController', function($scope) {
$scope.text = 'Hello, world!';
});
5 changes: 2 additions & 3 deletions test/e2e/tests/angular-already-loadedSpec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
describe('App where angular is loaded more than once', function() {
beforeEach(function() {
loadFixture("angular-already-loaded").andWaitForAngular();
loadFixture('angular-already-loaded');
});

it('should have the interpolated text', function() {
expect(element(by.binding('text')).getText())
.toBe('Hello, world!');
expect(element(by.binding('text')).getText()).toBe('Hello, world!');
});
});
3 changes: 0 additions & 3 deletions test/e2e/tests/helpers/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
var helper = {
andWaitForAngular: function() {
browser.waitForAngular();
},
loadFixture: function(fixture) {
var i = 0;
while (fixture[i] === '/') ++i;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/loaderSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('loader', function() {
describe('angular-loader', function() {
beforeEach(function() {
loadFixture("loader").andWaitForAngular();
loadFixture('loader');
});

it('should not be broken by loading the modules before core', function() {
Expand Down
9 changes: 4 additions & 5 deletions test/e2e/tests/ngJqSpec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
describe('Customizing the jqlite / jquery version', function() {

it('should be able to force jqlite', function() {
loadFixture("ngJq").andWaitForAngular();
describe('Customizing the jqLite / jQuery version', function() {
it('should be able to force jqLite', function() {
loadFixture('ngJq');
expect(element(by.binding('jqueryVersion')).getText()).toBe('jqLite');
});

it('should be able to use a specific version jQuery', function() {
loadFixture("ngJqJquery").andWaitForAngular();
loadFixture('ngJqJquery');
expect(element(by.binding('jqueryVersion')).getText()).toBe('2.1.0');
});
});
6 changes: 2 additions & 4 deletions test/e2e/tests/sampleSpec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// Sample E2E test:
//
describe('Sample', function() {
beforeEach(function() {
loadFixture("sample").andWaitForAngular();
loadFixture('sample');
});

it('should have the interpolated text', function() {
expect(element(by.binding('text')).getText())
.toBe('Hello, world!');
expect(element(by.binding('text')).getText()).toBe('Hello, world!');
});
});