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

chore(wdpromise): prefer wdpromise.when to wdpromise.fulfilled #4018

Merged
merged 1 commit into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {

let runWaitForAngularScript: () => wdpromise.Promise<any> = () => {
if (this.plugins_.skipAngularStability() || this.bpClient) {
return wdpromise.fulfilled();
return wdpromise.when(null);
} else {
return this.executeAsyncScript_(
clientSideScripts.waitForAngular, 'Protractor.waitForAngular()' + description,
Expand Down Expand Up @@ -671,7 +671,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
'return window.NG_PENDING_TIMEOUTS',
'Protractor.waitForAngular() - getting pending timeouts' + description);
} else {
pendingTimeoutsPromise = wdpromise.fulfilled({});
pendingTimeoutsPromise = wdpromise.when({});
}
let pendingHttpsPromise = this.executeScriptWithDescription(
clientSideScripts.getPendingHttpRequests,
Expand Down Expand Up @@ -1125,7 +1125,7 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
pause(opt_debugPort?: number): wdpromise.Promise<any> {
if (this.debugHelper.isAttached()) {
logger.info('Encountered browser.pause(), but debugger already attached.');
return wdpromise.fulfilled(true);
return wdpromise.when(true);
}
let debuggerClientPath = __dirname + '/debugger/clients/wddebugger.js';
let onStartFn = (firstTime: boolean) => {
Expand Down
4 changes: 2 additions & 2 deletions lib/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class DebugHelper {
res = 'Error while evaluating command: ' + e;
}
if (!wdpromise.isPromise(res)) {
res = wdpromise.fulfilled(res);
res = wdpromise.when(res);
}

return res.then((res: any) => {
Expand Down Expand Up @@ -237,7 +237,7 @@ export class DebugHelper {
*/
private validatePortAvailability_(port: number): wdpromise.Promise<boolean> {
if (this.debuggerValidated_) {
return wdpromise.fulfilled(false);
return wdpromise.when(false);
}

let doneDeferred = wdpromise.defer();
Expand Down
4 changes: 2 additions & 2 deletions lib/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export class ElementArrayFinder extends WebdriverWebElement {
* value of the accumulator.
*/
reduce(reduceFn: Function, initialValue: any): wdpromise.Promise<any> {
let valuePromise = wdpromise.fulfilled(initialValue);
let valuePromise = wdpromise.when(initialValue);
return this.asElementFinders_().then((arr: ElementFinder[]) => {
return arr.reduce((valuePromise: any, elementFinder: ElementFinder, index: number) => {
return valuePromise.then((value: any) => {
Expand Down Expand Up @@ -863,7 +863,7 @@ export class ElementFinder extends WebdriverWebElement {
static fromWebElement_(browser: ProtractorBrowser, webElem: WebElement, locator?: Locator):
ElementFinder {
let getWebElements = () => {
return wdpromise.fulfilled([webElem]);
return wdpromise.when([webElem]);
};
return new ElementArrayFinder(browser, getWebElements, locator).toElementFinder_();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class Runner extends EventEmitter {
});

browser_.getProcessedConfig = () => {
return wdpromise.fulfilled(config);
return wdpromise.when(config);
};

browser_.forkNewDriverInstance = (opt_useSameUrl: boolean, opt_copyMockModules: boolean) => {
Expand Down