@@ -9,205 +9,205 @@ describe('Dependency Injection Tests', function () {
99 } ) ;
1010
1111 describe ( 'Cars:' , function ( ) {
12-
12+
1313 it ( 'DI car displays as expected' , function ( ) {
1414 expectedMsg = 'DI car with 4 cylinders and Flintstone tires.' ;
1515 expect ( element ( by . css ( '#di' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
1616 } ) ;
17-
17+
1818 it ( 'No DI car displays as expected' , function ( ) {
19- expectedMsg = 'No DI car with 4 cylinders and Flintstone tires.' ;
19+ expectedMsg = 'No DI car with 4 cylinders and Flintstone tires.' ;
2020 expect ( element ( by . css ( '#nodi' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
2121 } ) ;
22-
22+
2323 it ( 'Injector car displays as expected' , function ( ) {
24- expectedMsg = 'Injector car with 4 cylinders and Flintstone tires.' ;
24+ expectedMsg = 'Injector car with 4 cylinders and Flintstone tires.' ;
2525 expect ( element ( by . css ( '#injector' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
2626 } ) ;
27-
27+
2828 it ( 'Factory car displays as expected' , function ( ) {
29- expectedMsg = 'Factory car with 4 cylinders and Flintstone tires.' ;
29+ expectedMsg = 'Factory car with 4 cylinders and Flintstone tires.' ;
3030 expect ( element ( by . css ( '#factory' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
3131 } ) ;
32-
32+
3333 it ( 'Simple car displays as expected' , function ( ) {
34- expectedMsg = 'Simple car with 4 cylinders and Flintstone tires.' ;
34+ expectedMsg = 'Simple car with 4 cylinders and Flintstone tires.' ;
3535 expect ( element ( by . css ( '#simple' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
3636 } ) ;
37-
37+
3838 it ( 'Super car displays as expected' , function ( ) {
39- expectedMsg = 'Super car with 12 cylinders and Flintstone tires.' ;
39+ expectedMsg = 'Super car with 12 cylinders and Flintstone tires.' ;
4040 expect ( element ( by . css ( '#super' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
4141 } ) ;
42-
42+
4343 it ( 'Test car displays as expected' , function ( ) {
44- expectedMsg = 'Test car with 8 cylinders and YokoGoodStone tires.' ;
44+ expectedMsg = 'Test car with 8 cylinders and YokoGoodStone tires.' ;
4545 expect ( element ( by . css ( '#test' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
4646 } ) ;
4747 } ) ;
48-
48+
4949 describe ( 'Other Injections:' , function ( ) {
5050 it ( 'DI car displays as expected' , function ( ) {
51- expectedMsg = 'DI car with 4 cylinders and Flintstone tires.' ;
51+ expectedMsg = 'DI car with 4 cylinders and Flintstone tires.' ;
5252 expect ( element ( by . css ( '#car' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
5353 } ) ;
5454
5555 it ( 'Hero displays as expected' , function ( ) {
56- expectedMsg = 'Mr. Nice' ;
56+ expectedMsg = 'Mr. Nice' ;
5757 expect ( element ( by . css ( '#hero' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
5858 } ) ;
5959
6060 it ( 'Optional injection displays as expected' , function ( ) {
61- expectedMsg = 'R.O.U.S.\'s? I don\'t think they exist!' ;
61+ expectedMsg = 'R.O.U.S.\'s? I don\'t think they exist!' ;
6262 expect ( element ( by . css ( '#rodent' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
63- } ) ;
63+ } ) ;
6464 } ) ;
65-
65+
6666 describe ( 'Tests:' , function ( ) {
67-
67+
6868 it ( 'Tests display as expected' , function ( ) {
6969 expectedMsg = / T e s t s p a s s e d / ;
7070 expect ( element ( by . css ( '#tests' ) ) . getText ( ) ) . toMatch ( expectedMsg ) ;
7171 } ) ;
7272
7373 } ) ;
74-
74+
7575 describe ( 'Provider variations:' , function ( ) {
76-
76+
7777 it ( 'P1 (class) displays as expected' , function ( ) {
7878 expectedMsg = 'Hello from logger provided with Logger class' ;
7979 expect ( element ( by . css ( '#p1' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
80- } ) ;
81-
80+ } ) ;
81+
8282 it ( 'P2 (Provider) displays as expected' , function ( ) {
8383 expectedMsg = 'Hello from logger provided with Provider class and useClass' ;
8484 expect ( element ( by . css ( '#p2' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
8585 } ) ;
86-
86+
8787 it ( 'P3 (provide) displays as expected' , function ( ) {
8888 expectedMsg = 'Hello from logger provided with useClass' ;
8989 expect ( element ( by . css ( '#p3' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
9090 } ) ;
91-
91+
9292 it ( 'P4 (useClass:BetterLogger) displays as expected' , function ( ) {
9393 expectedMsg = 'Hello from logger provided with useClass:BetterLogger' ;
9494 expect ( element ( by . css ( '#p4' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
9595 } ) ;
96-
96+
9797 it ( 'P5 (useClass:EvenBetterLogger - dependency) displays as expected' , function ( ) {
9898 expectedMsg = 'Message to Bob: Hello from EvenBetterlogger.' ;
9999 expect ( element ( by . css ( '#p5' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
100100 } ) ;
101-
101+
102102 it ( 'P6a (no alias) displays as expected' , function ( ) {
103103 expectedMsg = 'Hello OldLogger (but we want NewLogger)' ;
104104 expect ( element ( by . css ( '#p6a' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
105105 } ) ;
106-
106+
107107 it ( 'P6b (alias) displays as expected' , function ( ) {
108108 expectedMsg = 'Hello from NewLogger (via aliased OldLogger)' ;
109109 expect ( element ( by . css ( '#p6b' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
110110 } ) ;
111-
111+
112112 it ( 'P7 (useValue) displays as expected' , function ( ) {
113113 expectedMsg = 'Silent logger says "Shhhhh!". Provided via "useValue"' ;
114114 expect ( element ( by . css ( '#p7' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
115115 } ) ;
116-
116+
117117 it ( 'P8 (useFactory) displays as expected' , function ( ) {
118118 expectedMsg = 'Hero service injected successfully' ;
119119 expect ( element ( by . css ( '#p8' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
120120 } ) ;
121-
121+
122122 it ( 'P9a (string token) displays as expected' , function ( ) {
123123 expectedMsg = '"app.config" Application title is Dependency Injection' ;
124124 expect ( element ( by . css ( '#p9a' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
125125 } ) ;
126-
126+
127127 it ( 'P9b (OpaqueToken) displays as expected' , function ( ) {
128128 expectedMsg = 'APP_CONFIG Application title is Dependency Injection' ;
129129 expect ( element ( by . css ( '#p9b' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
130- } ) ;
131-
130+ } ) ;
131+
132132 it ( 'P10a (required dependency) displays as expected' , function ( ) {
133133 expectedMsg = 'Hello from the required logger.' ;
134134 expect ( element ( by . css ( '#p10a' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
135135 } ) ;
136-
136+
137137 it ( 'P10b (optional dependency) displays as expected' , function ( ) {
138138 expectedMsg = 'Optional logger was not available.' ;
139139 expect ( element ( by . css ( '#p10b' ) ) . getText ( ) ) . toEqual ( expectedMsg ) ;
140- } )
140+ } )
141141 } ) ;
142-
142+
143143 describe ( 'User/Heroes:' , function ( ) {
144144 it ( 'User is Bob - unauthorized' , function ( ) {
145145 expectedMsg = / B o b , i s n o t a u t h o r i z e d / ;
146146 expect ( element ( by . css ( '#user' ) ) . getText ( ) ) . toMatch ( expectedMsg ) ;
147- } ) ;
148-
147+ } ) ;
148+
149149 it ( 'should have button' , function ( ) {
150150 expect ( element . all ( by . cssContainingText ( 'button' , 'Next User' ) )
151151 . get ( 0 ) . isDisplayed ( ) ) . toBe ( true , "'Next User' button should be displayed" ) ;
152152 } ) ;
153-
153+
154154 it ( 'unauthorized user should have multiple unauthorized heroes' , function ( ) {
155155 var heroes = element . all ( by . css ( '#unauthorized hero-list div' ) ) ;
156- expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
156+ expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
157157 } ) ;
158-
158+
159159 it ( 'unauthorized user should have no secret heroes' , function ( ) {
160160 var heroes = element . all ( by . css ( '#unauthorized hero-list div' ) ) ;
161161 expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
162-
162+
163163 heroes . filter ( function ( elem , index ) {
164164 return elem . getText ( ) . then ( function ( text ) {
165165 return / s e c r e t / . test ( text ) ;
166166 } ) ;
167167 } ) . then ( function ( filteredElements ) {
168168 //console.log("******Secret heroes count: "+filteredElements.length);
169169 expect ( filteredElements . length ) . toEqual ( 0 ) ;
170- } ) ;
171- } ) ;
172-
173- it ( 'unauthorized user should have no authorized heros listed' , function ( ) {
170+ } ) ;
171+ } ) ;
172+
173+ it ( 'unauthorized user should have no authorized heroes listed' , function ( ) {
174174 expect ( element . all ( by . css ( '#authorized hero-list div' ) ) . count ( ) ) . toEqual ( 0 ) ;
175175 } ) ;
176-
176+
177177 describe ( 'after button click' , function ( ) {
178-
178+
179179 beforeAll ( function ( done ) {
180180 var buttonEle = element . all ( by . cssContainingText ( 'button' , 'Next User' ) ) . get ( 0 ) ;
181181 buttonEle . click ( ) . then ( done , done ) ;
182182 } ) ;
183-
183+
184184 it ( 'User is Alice - authorized' , function ( ) {
185185 expectedMsg = / A l i c e , i s a u t h o r i z e d / ;
186186 expect ( element ( by . css ( '#user' ) ) . getText ( ) ) . toMatch ( expectedMsg ) ;
187187 } ) ;
188-
188+
189189 it ( 'authorized user should have multiple authorized heroes ' , function ( ) {
190190 var heroes = element . all ( by . css ( '#authorized hero-list div' ) ) ;
191- expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
191+ expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
192192 } ) ;
193-
193+
194194 it ( 'authorized user should have secret heroes' , function ( ) {
195195 var heroes = element . all ( by . css ( '#authorized hero-list div' ) ) ;
196- expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
197-
196+ expect ( heroes . count ( ) ) . toBeGreaterThan ( 0 ) ;
197+
198198 heroes . filter ( function ( elem , index ) {
199199 return elem . getText ( ) . then ( function ( text ) {
200200 return / s e c r e t / . test ( text ) ;
201201 } ) ;
202202 } ) . then ( function ( filteredElements ) {
203203 //console.log("******Secret heroes count: "+filteredElements.length);
204204 expect ( filteredElements . length ) . toBeGreaterThan ( 0 ) ;
205- } ) ;
206- } ) ;
207-
208- it ( 'authorized user should have no unauthorized heros listed' , function ( ) {
205+ } ) ;
206+ } ) ;
207+
208+ it ( 'authorized user should have no unauthorized heroes listed' , function ( ) {
209209 expect ( element . all ( by . css ( '#unauthorized hero-list div' ) ) . count ( ) ) . toEqual ( 0 ) ;
210- } ) ;
210+ } ) ;
211211 } ) ;
212- } ) ;
212+ } ) ;
213213} ) ;
0 commit comments