Skip to content

Commit 9565cca

Browse files
juliemrpetebacondarwin
authored andcommitted
chore(protractor tests): fix up e2e tests
1 parent cd50867 commit 9565cca

16 files changed

Lines changed: 46 additions & 48 deletions

src/ng/directive/booleanAttrs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@
176176
</file>
177177
<file name="protractor.js" type="protractor">
178178
it('should toggle button', function() {
179-
expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeFalsy();
179+
expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
180180
element(by.model('checked')).click();
181-
expect(element(by.css('.doc-example-live button')).getAttribute('disabled')).toBeTruthy();
181+
expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
182182
});
183183
</file>
184184
</example>
@@ -246,9 +246,9 @@
246246
</file>
247247
<file name="protractor.js" type="protractor">
248248
it('should toggle readonly attr', function() {
249-
expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeFalsy();
249+
expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
250250
element(by.model('checked')).click();
251-
expect(element(by.css('.doc-example-live [type="text"]')).getAttribute('readonly')).toBeTruthy();
251+
expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
252252
});
253253
</file>
254254
</example>

src/ng/directive/input.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,13 +955,13 @@ var VALID_CLASS = 'ng-valid',
955955
<textarea ng-model="userContent"></textarea>
956956
</form>
957957
</file>
958-
<file name="protractorTest.js">
958+
<file name="protractor.js" type="protractor">
959959
it('should data-bind and become invalid', function() {
960960
if (browser.params.browser = 'safari') {
961961
// SafariDriver can't handle contenteditable.
962962
return;
963963
};
964-
var contentEditable = element(by.css('.doc-example-live [contenteditable]'));
964+
var contentEditable = element(by.css('[contenteditable]'));
965965
966966
expect(contentEditable.getText()).toEqual('Change me!');
967967

src/ng/directive/ngBind.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@
4040
</file>
4141
<file name="protractor.js" type="protractor">
4242
it('should check ng-bind', function() {
43-
var exampleContainer = $('.doc-example-live');
4443
var nameInput = element(by.model('name'));
4544
46-
expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('Whirled');
45+
expect(element(by.binding('name')).getText()).toBe('Whirled');
4746
nameInput.clear();
4847
nameInput.sendKeys('world');
49-
expect(exampleContainer.findElement(by.binding('name')).getText()).toBe('world');
48+
expect(element(by.binding('name')).getText()).toBe('world');
5049
});
5150
</file>
5251
</example>
@@ -162,7 +161,7 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
162161
}]);
163162
</file>
164163
165-
<file name="protractorTest.js">
164+
<file name="protractor.js" type="protractor">
166165
it('should check ng-bind-html', function() {
167166
expect(element(by.binding('myHTML')).getText()).toBe(
168167
'I am an HTMLstring with links! and other stuff');

src/ng/directive/ngClass.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ function classDirective(name, selector) {
114114
color: red;
115115
}
116116
</file>
117-
<file name="protractorTest.js">
118-
var ps = element.all(by.css('.doc-example-live p'));
117+
<file name="protractor.js" type="protractor">
118+
var ps = element.all(by.css('p'));
119119
120120
it('should let you toggle the class', function() {
121121
@@ -168,7 +168,7 @@ function classDirective(name, selector) {
168168
font-size:3em;
169169
}
170170
</file>
171-
<file name="protractorTest.js">
171+
<file name="protractor.js" type="protractor">
172172
it('should check ng-class', function() {
173173
expect(element(by.css('.base-class')).getAttribute('class')).not.
174174
toMatch(/my-class/);
@@ -232,7 +232,7 @@ var ngClassDirective = classDirective('', true);
232232
color: blue;
233233
}
234234
</file>
235-
<file name="protractorTest.js">
235+
<file name="protractor.js" type="protractor">
236236
it('should check ng-class-odd and ng-class-even', function() {
237237
expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
238238
toMatch(/odd/);
@@ -280,7 +280,7 @@ var ngClassOddDirective = classDirective('Odd', 0);
280280
color: blue;
281281
}
282282
</file>
283-
<file name="protractorTest.js">
283+
<file name="protractor.js" type="protractor">
284284
it('should check ng-class-odd and ng-class-even', function() {
285285
expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
286286
toMatch(/odd/);

src/ng/directive/ngCloak.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
</file>
4848
<file name="protractor.js" type="protractor">
4949
it('should remove the template directive and css class', function() {
50-
expect($('.doc-example-live #template1').getAttribute('ng-cloak')).
50+
expect($('#template1').getAttribute('ng-cloak')).
5151
toBeNull();
52-
expect($('.doc-example-live #template2').getAttribute('ng-cloak')).
52+
expect($('#template2').getAttribute('ng-cloak')).
5353
toBeNull();
5454
});
5555
</file>

src/ng/directive/ngEventDirs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<file name="protractor.js" type="protractor">
2525
it('should check ng-click', function() {
2626
expect(element(by.binding('count')).getText()).toMatch('0');
27-
element(by.css('.doc-example-live button')).click();
27+
element(by.css('button')).click();
2828
expect(element(by.binding('count')).getText()).toMatch('1');
2929
});
3030
</file>
@@ -330,14 +330,14 @@ forEach(
330330
<file name="protractor.js" type="protractor">
331331
it('should check ng-submit', function() {
332332
expect(element(by.binding('list')).getText()).toBe('list=[]');
333-
element(by.css('.doc-example-live #submit')).click();
333+
element(by.css('#submit')).click();
334334
expect(element(by.binding('list')).getText()).toContain('hello');
335335
expect(element(by.input('text')).getAttribute('value')).toBe('');
336336
});
337337
it('should ignore empty strings', function() {
338338
expect(element(by.binding('list')).getText()).toBe('list=[]');
339-
element(by.css('.doc-example-live #submit')).click();
340-
element(by.css('.doc-example-live #submit')).click();
339+
element(by.css('#submit')).click();
340+
element(by.css('#submit')).click();
341341
expect(element(by.binding('list')).getText()).toContain('hello');
342342
});
343343
</file>

src/ng/directive/ngInclude.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@
110110
top:50px;
111111
}
112112
</file>
113-
<file name="protractorTest.js">
113+
<file name="protractor.js" type="protractor">
114114
var templateSelect = element(by.model('template'));
115-
var includeElem = element(by.css('.doc-example-live [ng-include]'));
115+
var includeElem = element(by.css('[ng-include]'));
116116
117117
it('should load template1.html', function() {
118118
expect(includeElem.getText()).toMatch(/Content of template1.html/);

src/ng/directive/ngNonBindable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<file name="protractor.js" type="protractor">
2828
it('should check ng-non-bindable', function() {
2929
expect(element(by.binding('1 + 2')).getText()).toContain('3');
30-
expect(element.all(by.css('.doc-example-live div')).last().getText()).toMatch(/1 \+ 2/);
30+
expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
3131
});
3232
</file>
3333
</example>

src/ng/directive/ngRepeat.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,8 @@
172172
max-height:40px;
173173
}
174174
</file>
175-
<file name="protractorTest.js">
176-
var friends = element(by.css('.doc-example-live'))
177-
.element.all(by.repeater('friend in friends'));
175+
<file name="protractor.js" type="protractor">
176+
var friends = element.all(by.repeater('friend in friends'));
178177
179178
it('should render initial data set', function() {
180179
expect(friends.count()).toBe(10);
@@ -188,7 +187,7 @@
188187
it('should update repeater when filter predicate changes', function() {
189188
expect(friends.count()).toBe(10);
190189
191-
element(by.css('.doc-example-live')).element(by.model('q')).sendKeys('ma');
190+
element(by.model('q')).sendKeys('ma');
192191
193192
expect(friends.count()).toBe(2);
194193
expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');

src/ng/directive/ngShowHide.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@
132132
background:white;
133133
}
134134
</file>
135-
<file name="protractorTest.js">
136-
var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
137-
var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
135+
<file name="protractor.js" type="protractor">
136+
var thumbsUp = element(by.css('span.icon-thumbs-up'));
137+
var thumbsDown = element(by.css('span.icon-thumbs-down'));
138138
139139
it('should check ng-show / ng-hide', function() {
140140
expect(thumbsUp.isDisplayed()).toBeFalsy();
@@ -289,9 +289,9 @@ var ngShowDirective = ['$animate', function($animate) {
289289
background:white;
290290
}
291291
</file>
292-
<file name="protractorTest.js">
293-
var thumbsUp = element(by.css('.doc-example-live span.icon-thumbs-up'));
294-
var thumbsDown = element(by.css('.doc-example-live span.icon-thumbs-down'));
292+
<file name="protractor.js" type="protractor">
293+
var thumbsUp = element(by.css('span.icon-thumbs-up'));
294+
var thumbsDown = element(by.css('span.icon-thumbs-down'));
295295
296296
it('should check ng-show / ng-hide', function() {
297297
expect(thumbsUp.isDisplayed()).toBeFalsy();

0 commit comments

Comments
 (0)