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

Commit 731c26e

Browse files
committed
feat(rootEl): auto-detect the root element better
Closes #1742
1 parent 7fc1861 commit 731c26e

File tree

5 files changed

+166
-89
lines changed

5 files changed

+166
-89
lines changed

lib/browser.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export class ProtractorBrowser extends Webdriver {
324324
this.$ = build$(this.element, By);
325325
this.$$ = build$$(this.element, By);
326326
this.baseUrl = opt_baseUrl || '';
327-
this.rootEl = opt_rootElement || 'body';
327+
this.rootEl = opt_rootElement || '';
328328
this.ignoreSynchronization = false;
329329
this.getPageTimeout = DEFAULT_GET_PAGE_TIMEOUT;
330330
this.params = {};
@@ -492,13 +492,10 @@ export class ProtractorBrowser extends Webdriver {
492492
let runWaitForAngularScript: () => wdpromise.Promise<any> = () => {
493493
if (this.plugins_.skipAngularStability() || this.bpClient) {
494494
return wdpromise.fulfilled();
495-
} else if (this.rootEl) {
496-
return this.executeAsyncScript_(
497-
clientSideScripts.waitForAngular, 'Protractor.waitForAngular()' + description,
498-
this.rootEl, this.ng12Hybrid);
499495
} else {
500496
return this.executeAsyncScript_(
501-
clientSideScripts.waitForAllAngular2, 'Protractor.waitForAngular()' + description);
497+
clientSideScripts.waitForAngular, 'Protractor.waitForAngular()' + description,
498+
this.rootEl);
502499
}
503500
};
504501

@@ -805,7 +802,9 @@ export class ProtractorBrowser extends Webdriver {
805802
}
806803

807804
self.executeScriptWithDescription(
808-
'angular.resumeBootstrap(arguments[0]);', msg('resume bootstrap'), moduleNames)
805+
'window.__TESTABILITY__NG1_APP_ROOT_INJECTOR__ = ' +
806+
'angular.resumeBootstrap(arguments[0]);',
807+
msg('resume bootstrap'), moduleNames)
809808
.then(null, deferred.reject);
810809
} else {
811810
// TODO: support mock modules in Angular2. For now, error if someone

0 commit comments

Comments
 (0)