This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
browser.restart
should return a promise which resolves when the new browser is ready #3899
Closed
Description
Proposed implementation:
browser_.restart = () => {
let quitPromise = this.driverprovider_.quitDriver(browser_.driver);
function forkAndOverwrite() { ... }
if (wdpromise.USE_PROMISE_MANAGER !== false) {
forkAndOverwrite();
} else {
quitPromise = quitPromise.then(forkAndOverwrite);
}
return quitPromise.then(() => {
return browser_.ready();
});
};
I know this is messy but:
-
Should the control flow be on, the fork/overwrite needs to be synchronous to support code like:
browser.restart(); browser.get('http://www.google.com'); // Must go to new instance
-
Should the control flow be off, we shouldn't do the fork/overwrite until after we've quit, or else we'll briefly have two browser instances floating around. Also, it'd just be weird and unexpected for the global browser instance to change synchronously when you're used to nothing happening until you
await
it.