1
1
describe ( 'Angularjs.org' , function ( ) {
2
- var protractor = require ( 'protractor' )
3
- , protractorConfig = require ( '../protractorConf.js' )
4
- , webdriver = require ( 'selenium-webdriver' ) ;
2
+ var webdriver = require ( 'selenium-webdriver' ) ;
5
3
6
4
describe ( 'App' , function ( ) {
7
5
beforeEach ( function ( ) {
@@ -12,14 +10,14 @@ describe('Angularjs.org', function () {
12
10
it ( 'should have the correct version of angularjs loaded' , function ( ) {
13
11
//This only runs if an environment variable tells us to check
14
12
if ( process . env . CHECK_SCRIPT_TAG !== 'true' ) return ;
15
- var scriptTag = browser . findElement ( protractor . By . css ( 'script#angularScript' ) ) ;
13
+ var scriptTag = browser . findElement ( by . css ( 'script#angularScript' ) ) ;
16
14
expect ( scriptTag . getAttribute ( 'src' ) ) .
17
15
toContain ( process . env . ANGULAR_VERSION ) ;
18
16
} ) ;
19
17
20
18
21
19
it ( 'should load the web page' , function ( ) {
22
- var body = browser . findElement ( protractor . By . css ( 'body' ) ) ;
20
+ var body = browser . findElement ( by . css ( 'body' ) ) ;
23
21
expect ( body . getAttribute ( 'ng-controller' ) ) . toEqual ( 'AppController' ) ;
24
22
} ) ;
25
23
@@ -29,25 +27,25 @@ describe('Angularjs.org', function () {
29
27
downloadVersions = process . env . ANGULAR_DOWNLOAD_VERSIONS . split ( ' ' ) ;
30
28
31
29
beforeEach ( function ( ) {
32
- var downloadBtn = browser . findElement ( protractor . By . css ( '.download-btn' ) ) , done ;
30
+ var downloadBtn = browser . findElement ( by . css ( '.download-btn' ) ) , done ;
33
31
downloadBtn . click ( ) ;
34
32
browser . driver . sleep ( 500 ) ;
35
- cdnInput = browser . findElement ( protractor . By . css ( '#cdnURL' ) ) ;
33
+ cdnInput = browser . findElement ( by . css ( '#cdnURL' ) ) ;
36
34
cdnInput . getAttribute ( 'value' ) ;
37
35
cdnInput . getText ( ) . then ( function ( text ) {
38
36
stableVersion = text . toString ( ) . split ( '/' ) . splice ( - 2 , 1 ) [ 0 ] ;
39
37
} ) ;
40
38
} ) ;
41
39
42
40
it ( 'should open a modal prompting for download configuration' , function ( ) {
43
- var downloadModal = browser . findElement ( protractor . By . css ( '.download-modal' ) )
41
+ var downloadModal = browser . findElement ( by . css ( '.download-modal' ) )
44
42
expect ( downloadModal . getCssValue ( 'display' ) ) . toEqual ( 'block' ) ;
45
43
} ) ;
46
44
47
45
48
46
it ( 'should change the CDN url based on user selection of stable or unstable' , function ( ) {
49
47
var okay ;
50
- var unstableButton = browser . findElement ( protractor . By . css ( ".branch-btns button:nth-child(1)" ) ) ;
48
+ var unstableButton = browser . findElement ( by . css ( ".branch-btns button:nth-child(1)" ) ) ;
51
49
browser . driver . sleep ( 500 ) ;
52
50
unstableButton . click ( ) ;
53
51
cdnInput . getAttribute ( 'value' ) . then ( function ( val ) {
@@ -71,7 +69,7 @@ describe('Angularjs.org', function () {
71
69
replace ( / \* / g, 'x' ) ,
72
70
73
71
branchBtn = browser . findElement (
74
- protractor . By . css ( branchBtnSelector ) ) ;
72
+ by . css ( branchBtnSelector ) ) ;
75
73
branchBtn . click ( ) ;
76
74
77
75
expect ( cdnInput . getAttribute ( 'value' ) ) .
@@ -82,7 +80,7 @@ describe('Angularjs.org', function () {
82
80
83
81
it ( 'should allow downloading uncompressed angular' , function ( ) {
84
82
var uncompressedBtn = browser . findElement (
85
- protractor . By . css (
83
+ by . css (
86
84
'.download-modal .modal-body > dl button.uncompressed' ) ) ;
87
85
uncompressedBtn . click ( ) ;
88
86
@@ -91,7 +89,7 @@ describe('Angularjs.org', function () {
91
89
92
90
93
91
it ( 'should have a working close button' , function ( ) {
94
- var closeButton = browser . findElement ( protractor . By . css ( '.download-modal .modal-header button.close' ) ) ;
92
+ var closeButton = browser . findElement ( by . css ( '.download-modal .modal-header button.close' ) ) ;
95
93
closeButton . click ( ) ;
96
94
expect ( element ( by . css ( '.download-modal' ) ) . isPresent ( ) ) . toBe ( false ) ;
97
95
} ) ;
@@ -100,10 +98,10 @@ describe('Angularjs.org', function () {
100
98
[ 'Branches' , 'Builds' , 'Why Google CDN?' , 'What is Bower?' ] . forEach ( function ( value ) {
101
99
102
100
it ( 'should be displayed for ' + value , function ( ) {
103
- var popoverButton = browser . findElement ( protractor . By . css ( '.download-modal [popover-title="' + value + '"]' ) ) ;
101
+ var popoverButton = browser . findElement ( by . css ( '.download-modal [popover-title="' + value + '"]' ) ) ;
104
102
popoverButton . click ( ) ;
105
103
106
- var popover = browser . findElement ( protractor . By . css ( '.popover' ) ) ;
104
+ var popover = browser . findElement ( by . css ( '.popover' ) ) ;
107
105
expect ( popover . getCssValue ( 'display' ) ) . toEqual ( 'block' ) ;
108
106
} ) ;
109
107
@@ -115,62 +113,62 @@ describe('Angularjs.org', function () {
115
113
116
114
describe ( 'The Basics' , function ( ) {
117
115
it ( 'should show the code example' , function ( ) {
118
- var hello = browser . findElement ( protractor . By . css ( '[app-source="hello.html"]' ) ) ;
116
+ var hello = browser . findElement ( by . css ( '[app-source="hello.html"]' ) ) ;
119
117
expect ( hello . getText ( ) ) . toContain ( '{{yourName}}' ) ;
120
118
} ) ;
121
119
122
120
123
121
it ( 'should have a hoverable region called ng-app' , function ( ) {
124
- var noCode = browser . findElement ( protractor . By . css ( '[popover-title="ng-app"]' ) )
122
+ var noCode = browser . findElement ( by . css ( '[popover-title="ng-app"]' ) )
125
123
expect ( noCode . getText ( ) ) . toEqual ( 'ng-app' ) ;
126
124
} ) ;
127
125
128
126
129
127
it ( 'should update the Hello text after entering a name' , function ( ) {
130
- var el = browser . findElement ( protractor . By . model ( 'yourName' ) ) ;
128
+ var el = browser . findElement ( by . model ( 'yourName' ) ) ;
131
129
el . click ( )
132
130
el . sendKeys ( 'Jeff' )
133
131
134
- var bound = browser . findElement ( protractor . By . css ( '[app-run="hello.html"] h1' ) ) ;
132
+ var bound = browser . findElement ( by . css ( '[app-run="hello.html"] h1' ) ) ;
135
133
expect ( bound . getText ( ) ) . toEqual ( 'Hello Jeff!' ) ;
136
134
} ) ;
137
135
} ) ;
138
136
139
137
140
138
describe ( 'Add Some Control' , function ( ) {
141
139
it ( 'should strike out a todo when clicked' , function ( ) {
142
- var el = browser . findElement ( protractor . By . css ( '[ng-controller="TodoListController as todoList"] ul >li:nth-child(2) input' ) ) ;
140
+ var el = browser . findElement ( by . css ( '[ng-controller="TodoListController as todoList"] ul >li:nth-child(2) input' ) ) ;
143
141
el . click ( ) ;
144
142
expect ( el . getAttribute ( 'value' ) ) . toBe ( 'on' ) ;
145
143
} ) ;
146
144
147
145
148
146
it ( 'should add a new todo when added through text field' , function ( ) {
149
- var el = browser . findElement ( protractor . By . model ( 'todoList.todoText' ) ) ;
147
+ var el = browser . findElement ( by . model ( 'todoList.todoText' ) ) ;
150
148
el . click ( ) ;
151
149
el . sendKeys ( 'Write tests!' ) ;
152
150
el . sendKeys ( webdriver . Key . RETURN ) ;
153
- var lastTodo = browser . findElement ( protractor . By . css ( '[ng-repeat="todo in todoList.todos"]:nth-child(3) span' ) ) ;
151
+ var lastTodo = browser . findElement ( by . css ( '[ng-repeat="todo in todoList.todos"]:nth-child(3) span' ) ) ;
154
152
expect ( lastTodo . getText ( ) ) . toEqual ( 'Write tests!' ) ;
155
153
} ) ;
156
154
157
155
158
156
it ( 'should show a secondary tab when selected' , function ( ) {
159
- var todoJsTab = browser . findElement ( protractor . By . css ( '[annotate="todo.annotation"] ul.nav-tabs li:nth-child(2) a' ) ) ;
157
+ var todoJsTab = browser . findElement ( by . css ( '[annotate="todo.annotation"] ul.nav-tabs li:nth-child(2) a' ) ) ;
160
158
todoJsTab . click ( )
161
159
browser . driver . sleep ( 500 ) ;
162
- var todojs = browser . findElement ( protractor . By . css ( '[annotate="todo.annotation"] .tab-pane:nth-child(2)' ) ) ;
160
+ var todojs = browser . findElement ( by . css ( '[annotate="todo.annotation"] .tab-pane:nth-child(2)' ) ) ;
163
161
expect ( todojs . getCssValue ( 'display' ) ) . toEqual ( 'block' ) ;
164
162
} ) ;
165
163
} ) ;
166
164
167
165
168
166
describe ( 'Wire up a Backend' , function ( ) {
169
167
it ( 'should show a secondary tab when selected' , function ( ) {
170
- var listBtn = browser . findElement ( protractor . By . css ( '[annotate="project.annotation"] ul.nav-tabs li:nth-child(2) a' ) ) ;
168
+ var listBtn = browser . findElement ( by . css ( '[annotate="project.annotation"] ul.nav-tabs li:nth-child(2) a' ) ) ;
171
169
listBtn . click ( ) ;
172
170
browser . driver . sleep ( 500 ) ;
173
- var listTab = browser . findElement ( protractor . By . css ( '[module="project"] .tab-pane:nth-child(2)' ) ) ;
171
+ var listTab = browser . findElement ( by . css ( '[module="project"] .tab-pane:nth-child(2)' ) ) ;
174
172
expect ( listTab . getCssValue ( 'display' ) ) . toEqual ( 'block' ) ;
175
173
} ) ;
176
174
@@ -190,35 +188,35 @@ describe('Angularjs.org', function () {
190
188
191
189
describe ( 'Create Components' , function ( ) {
192
190
it ( 'should show the US localization of date' , function ( ) {
193
- var dateText = browser . findElement ( protractor . By . css ( '[module="app-us"] .tab-content > .tab-pane > span:first-child' ) ) ;
191
+ var dateText = browser . findElement ( by . css ( '[module="app-us"] .tab-content > .tab-pane > span:first-child' ) ) ;
194
192
var text = dateText . getText ( ) ;
195
193
196
194
expect ( text ) . toMatch ( / ^ D a t e : [ A - Z a - z ] * , [ A - Z a - z ] + [ 0 - 9 ] { 1 , 2 } , [ 0 - 9 ] { 4 } $ / ) ;
197
195
} ) ;
198
196
199
197
200
198
/*it('should show the US pluralization of beer', function () {
201
- var pluralTabLink = browser.findElement(protractor.By .css('[module="app-us"] .nav-tabs > li:nth-child(2) a'));
199
+ var pluralTabLink = browser.findElement(by .css('[module="app-us"] .nav-tabs > li:nth-child(2) a'));
202
200
pluralTabLink.click()
203
201
204
- var pluralTab = browser.findElement(protractor.By .css('[module="app-us"] [ng-controller="BeerCounter"] > div > ng-pluralize'));
202
+ var pluralTab = browser.findElement(by .css('[module="app-us"] [ng-controller="BeerCounter"] > div > ng-pluralize'));
205
203
expect(pluralTab.getText()).toEqual('no beers');
206
204
});
207
205
208
206
209
207
it('should show the Slovak pluralization of beer', function () {
210
- var pluralTabLink = browser.findElement(protractor.By .css('[module="app-sk"] .nav-tabs > li:nth-child(2) a'));
208
+ var pluralTabLink = browser.findElement(by .css('[module="app-sk"] .nav-tabs > li:nth-child(2) a'));
211
209
pluralTabLink.click();
212
210
213
- var pluralTab = browser.findElement(protractor.By .css('[module="app-sk"] [ng-controller="BeerCounter"] > div > ng-pluralize'));
211
+ var pluralTab = browser.findElement(by .css('[module="app-sk"] [ng-controller="BeerCounter"] > div > ng-pluralize'));
214
212
expect(pluralTab.getText()).toEqual('žiadne pivo');
215
213
});*/
216
214
} ) ;
217
215
218
216
219
217
describe ( 'Testability Built-in' , function ( ) {
220
218
it ( 'should have some content under and "Testability Built-in" heading' , function ( ) {
221
- var testability = browser . findElement ( protractor . By . css ( '#testability' ) )
219
+ var testability = browser . findElement ( by . css ( '#testability' ) )
222
220
expect ( testability . getText ( ) ) . toEqual ( 'Testability Built-in' ) ;
223
221
} ) ;
224
222
} ) ;
0 commit comments