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

Commit 7bd2dde

Browse files
committed
chore(angular): upgrade angular to version 1.3.
This change updates Protractor's test application from 1.2.9 to 1.3.0-r0. There is a significant behind-the-scenes change in the implementation of locating elements and waiting for the page to be stable. If you are updating your application to Angular 1.3, you may run into some changes you will need to make in your tests: - `by.binding` no longer allows using the surrounding `{{}}`. Previously, these were optional. Before: `var el = element(by.binding('{{foo}}'))` After: `var el = element(by.binding('foo'))` - Prefixes `ng_` and `x-ng-` are no longer allowed for models. Use `ng-model`. - `by.repeater` cannot find elements by row and column which are not children of the row. For example, if your template is `<div ng-repeat="foo in foos">{{foo.name}}</div>` Before: `var el = element(by.repeater('foo in foos').row(2).column('foo.name'))` After: You may either enclose `{{foo.name}}` in a child element or simply use: `var el = element(by.repeater('foo in foos').row(2))`
1 parent ee82f9e commit 7bd2dde

File tree

10 files changed

+309
-52
lines changed

10 files changed

+309
-52
lines changed

lib/clientsidescripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ functions.findByModel = function(model, using, rootSelector) {
385385

386386
if (angular.getTestability) {
387387
return angular.getTestability(using).
388-
findModels(using, model);
388+
findModels(using, model, true);
389389
}
390390
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
391391
for (var p = 0; p < prefixes.length; ++p) {

spec/basic/lib_spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ describe('protractor library', function() {
9292
it('should get the absolute URL', function() {
9393
browser.get('index.html');
9494
expect(browser.getLocationAbsUrl()).
95-
toMatch('index.html#/form');
95+
toMatch('/form');
9696

9797
element(by.linkText('repeater')).click();
9898
expect(browser.getLocationAbsUrl()).
99-
toMatch('index.html#/repeater');
99+
toMatch('/repeater');
100100
});
101101

102102
it('should navigate to another url with setLocation', function() {
@@ -105,7 +105,7 @@ describe('protractor library', function() {
105105
browser.setLocation('/repeater');
106106

107107
expect(browser.getLocationAbsUrl()).
108-
toMatch('index.html#/repeater');
108+
toMatch('/repeater');
109109
});
110110
});
111111
});

spec/basic/locators_spec.js

+5-33
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe('locators', function() {
55

66
describe('by binding', function() {
77
it('should find an element by binding', function() {
8-
var greeting = element(by.binding('{{greeting}}'));
8+
var greeting = element(by.binding('greeting'));
99

1010
expect(greeting.getText()).toEqual('Hiya');
1111
});
@@ -19,11 +19,11 @@ describe('locators', function() {
1919
}
2020
});
2121

22-
expect(element(by.binding('{{greeting}}'))).toHaveText('Hiya');
22+
expect(element(by.binding('greeting'))).toHaveText('Hiya');
2323
});
2424

2525
it('ElementFinder.then should resolve to itself', function() {
26-
var elem = element(by.binding('{{greeting}}'));
26+
var elem = element(by.binding('greeting'));
2727

2828
elem.then(function(elem2) {
2929
expect(elem).toEqual(elem2);
@@ -57,7 +57,7 @@ describe('locators', function() {
5757

5858
it('should find an element by binding with ng-bind-template attribute',
5959
function() {
60-
var name = element(by.binding('{{nickname|uppercase}}'));
60+
var name = element(by.binding('nickname|uppercase'));
6161

6262
expect(name.getText()).toEqual('(ANNIE)');
6363
});
@@ -116,12 +116,6 @@ describe('locators', function() {
116116

117117
element(by.model('check.x')).click();
118118
expect(letterList.getText()).toBe('wx');
119-
120-
element(by.model('check.y')).click();
121-
expect(letterList.getText()).toBe('wxy');
122-
123-
element(by.model('check.z')).click();
124-
expect(letterList.getText()).toBe('wxyz');
125119
});
126120

127121
it('should find multiple inputs', function() {
@@ -182,7 +176,7 @@ describe('locators', function() {
182176
it('should find by partial match', function() {
183177
var fullMatch = element(
184178
by.repeater('baz in days | filter:\'T\'').
185-
row(0).column('{{baz.initial}}'));
179+
row(0).column('baz.initial'));
186180
expect(fullMatch.getText()).toEqual('T');
187181

188182
var partialMatch = element(
@@ -274,28 +268,6 @@ describe('locators', function() {
274268
expect(byCol.getText()).toEqual('W');
275269
});
276270

277-
it('should find using ng_repeat', function() {
278-
var byRow =
279-
element(by.repeater('foo in days').row(2));
280-
expect(byRow.getText()).toEqual('W');
281-
282-
var byCol =
283-
element(by.repeater('foo in days').row(2).
284-
column('foo'));
285-
expect(byCol.getText()).toEqual('W');
286-
});
287-
288-
it('should find using x-ng-repeat', function() {
289-
var byRow =
290-
element(by.repeater('qux in days').row(2));
291-
expect(byRow.getText()).toEqual('W');
292-
293-
var byCol =
294-
element(by.repeater('qux in days').row(2).
295-
column('qux'));
296-
expect(byCol.getText()).toEqual('W');
297-
});
298-
299271
it('should determine if repeater elements are present', function() {
300272
expect(element(by.repeater('allinfo in days').row(3)).isPresent()).
301273
toBe(true);

spec/basicConf.js

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ exports.config = {
2020

2121
baseUrl: env.baseUrl,
2222

23+
jasmineNodeOpts: {
24+
isVerbose: true,
25+
realtimeFailure: true
26+
},
27+
2328
params: {
2429
login: {
2530
user: 'Jane',

testapp/form/form.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ <h4>Selects</h4>
4545
<h4>Checkboxes</h4>
4646
<input ng-model="show" type="checkbox"/> Show?
4747
<span id="shower" ng-show="show">Shown!!</span>
48-
<input ng:model="check.w" ng-true-value="w" type="checkbox"/> W
49-
<input data-ng-model="check.x" ng-true-value="x" type="checkbox"/> X
50-
<input x-ng-model="check.y" ng-true-value="y" type="checkbox"/> Y
51-
<input ng_model="check.z" ng-true-value="z" type="checkbox"/> Z
48+
<input ng:model="check.w" ng-true-value="'w'" type="checkbox"/> W
49+
<input data-ng-model="check.x" ng-true-value="'x'" type="checkbox"/> X
5250

53-
<span id="letterlist">{{check.w}}{{check.x}}{{check.y}}{{check.z}}</span>
51+
<span id="letterlist">{{check.w}}{{check.x}}</span>
5452
</div>
5553

5654
<div>

testapp/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
<div>Angular seed app: v<span app-version></span></div>
2323

24-
<script src="lib/angular_v1.2.9/angular.min.js"></script>
25-
<script src="lib/angular_v1.2.9/angular-animate.min.js"></script>
26-
<script src="lib/angular_v1.2.9/angular-route.min.js"></script>
24+
<script src="lib/angular_v1.3.0-rc0/angular.min.js"></script>
25+
<script src="lib/angular_v1.3.0-rc0/angular-animate.min.js"></script>
26+
<script src="lib/angular_v1.3.0-rc0/angular-route.min.js"></script>
2727

2828
<script src="components/app-version.js"></script>
2929
<script src="async/async.js"></script>

testapp/lib/angular_v1.3.0-rc0/angular-animate.min.js

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)