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

Commit 330ec6f

Browse files
committed
feat(rootEl): auto-detect the root element better
Closes #1742
1 parent ef2fe60 commit 330ec6f

File tree

6 files changed

+168
-91
lines changed

6 files changed

+168
-91
lines changed

lib/browser.ts

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

@@ -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)