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

Commit 51624ad

Browse files
committed
feat(rootEl): auto-detect the root element better
Closes #1742
1 parent e3ee71c commit 51624ad

File tree

6 files changed

+168
-90
lines changed

6 files changed

+168
-90
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

@@ -804,7 +801,9 @@ export class ProtractorBrowser extends Webdriver {
804801
}
805802

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

0 commit comments

Comments
 (0)