@@ -189,9 +189,39 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
189
189
* 'body' but if your ng-app is on a subsection of the page it may be
190
190
* a subelement.
191
191
*
192
+ * This property is deprecated - please use setAngularAppRoot() instead.
193
+ *
194
+ * @deprecated
192
195
* @type {string }
193
196
*/
194
- rootEl : string ;
197
+ set rootEl ( value : string ) {
198
+ this . driver . controlFlow ( ) . execute ( ( ) => {
199
+ if ( this . bpClient ) {
200
+ this . bpClient . setWaitParams ( value ) ;
201
+ }
202
+ this . internalRootEl = value ;
203
+ } , `Set angular root selector to ${ value } ` ) ;
204
+ }
205
+
206
+ get rootEl ( ) {
207
+ return this . internalRootEl ;
208
+ }
209
+
210
+ private internalRootEl : string ;
211
+
212
+ /**
213
+ * Set the css selector for an element on which to find Angular. This is usually
214
+ * 'body' but if your ng-app is on a subsection of the page it may be
215
+ * a subelement.
216
+ *
217
+ * The change will be made within WebDriver's control flow, so that commands after
218
+ * this method is called use the new app root.
219
+ *
220
+ * @param {string } The new selector.
221
+ */
222
+ setAngularAppRoot ( value : string ) {
223
+ this . rootEl = value ;
224
+ }
195
225
196
226
/**
197
227
* If true, Protractor will not attempt to synchronize with the page before
@@ -209,7 +239,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
209
239
this . driver . controlFlow ( ) . execute ( ( ) => {
210
240
if ( this . bpClient ) {
211
241
logger . debug ( 'Setting waitForAngular' + value ) ;
212
- this . bpClient . setSynchronization ( ! value ) ;
242
+ this . bpClient . setWaitEnabled ( ! value ) ;
213
243
}
214
244
} , `Set proxy synchronization to ${ value } ` ) ;
215
245
this . internalIgnoreSynchronization = value ;
@@ -219,7 +249,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
219
249
return this . internalIgnoreSynchronization ;
220
250
}
221
251
222
- internalIgnoreSynchronization : boolean ;
252
+ private internalIgnoreSynchronization : boolean ;
223
253
224
254
/**
225
255
* Timeout in milliseconds to wait for pages to load when calling `get`.
@@ -524,9 +554,12 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
524
554
if ( this . plugins_ . skipAngularStability ( ) || this . bpClient ) {
525
555
return wdpromise . fulfilled ( ) ;
526
556
} else {
527
- return this . executeAsyncScript_ (
528
- clientSideScripts . waitForAngular , 'Protractor.waitForAngular()' + description ,
529
- this . rootEl ) ;
557
+ // Need to wrap this so that we read rootEl in the control flow, not synchronously.
558
+ return this . driver . controlFlow ( ) . execute ( ( ) => {
559
+ return this . executeAsyncScript_ (
560
+ clientSideScripts . waitForAngular , 'Protractor.waitForAngular()' + description ,
561
+ this . rootEl ) ;
562
+ } ) ;
530
563
}
531
564
} ;
532
565
@@ -748,7 +781,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
748
781
749
782
if ( this . bpClient ) {
750
783
this . driver . controlFlow ( ) . execute ( ( ) => {
751
- return this . bpClient . setSynchronization ( false ) ;
784
+ return this . bpClient . setWaitEnabled ( false ) ;
752
785
} ) ;
753
786
}
754
787
@@ -856,7 +889,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
856
889
857
890
if ( this . bpClient ) {
858
891
this . driver . controlFlow ( ) . execute ( ( ) => {
859
- return this . bpClient . setSynchronization ( ! this . internalIgnoreSynchronization ) ;
892
+ return this . bpClient . setWaitEnabled ( ! this . internalIgnoreSynchronization ) ;
860
893
} ) ;
861
894
}
862
895
0 commit comments