Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rpc): clear the page test spec #2736

Merged
merged 1 commit into from
Jun 27, 2020

Conversation

pavelfeldman
Copy link
Member

No description provided.

@@ -162,7 +165,8 @@ export class BrowserContext extends ChannelOwner<BrowserContextChannel, BrowserC
}

async waitForEvent(event: string, optionsOrPredicate?: Function | (types.TimeoutOptions & { predicate?: Function })): Promise<any> {
return waitForEvent(this, event, optionsOrPredicate);
const hasTimeout = optionsOrPredicate && !(optionsOrPredicate instanceof Function);
return waitForEvent(this, event, optionsOrPredicate, this._timeoutSettings.timeout(hasTimeout ? optionsOrPredicate as any : {}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we do _pendingWaitForEvents here as well?

return result;
return Promise.race([
result,
new Promise((f, r) => setTimeout(() => r(new TimeoutError('Timeout while waiting for event')), timeout))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to clearTimeout.

@pavelfeldman pavelfeldman merged commit db12dde into microsoft:master Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants