chore: ignore noWaitAfter option in press()

This commit is contained in:
Dmitry Gozman 2024-09-18 14:33:18 +01:00
parent 4460c98710
commit 8d9e9e2c9e
10 changed files with 21 additions and 39 deletions

View file

@ -710,7 +710,7 @@ Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
### option: ElementHandle.press.noWaitAfter = %%-input-no-wait-after-%% ### option: ElementHandle.press.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8 * since: v1.8
### option: ElementHandle.press.timeout = %%-input-timeout-%% ### option: ElementHandle.press.timeout = %%-input-timeout-%%

View file

@ -1417,7 +1417,7 @@ Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
### option: Frame.press.noWaitAfter = %%-input-no-wait-after-%% ### option: Frame.press.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8 * since: v1.8
### option: Frame.press.strict = %%-input-strict-%% ### option: Frame.press.strict = %%-input-strict-%%

View file

@ -1782,7 +1782,7 @@ Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
### option: Locator.press.noWaitAfter = %%-input-no-wait-after-%% ### option: Locator.press.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.14 * since: v1.14
### option: Locator.press.timeout = %%-input-timeout-%% ### option: Locator.press.timeout = %%-input-timeout-%%

View file

@ -3032,7 +3032,7 @@ Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
### option: Page.press.noWaitAfter = %%-input-no-wait-after-%% ### option: Page.press.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8 * since: v1.8
### option: Page.press.strict = %%-input-strict-%% ### option: Page.press.strict = %%-input-strict-%%

View file

@ -1606,7 +1606,6 @@ scheme.FramePressParams = tObject({
strict: tOptional(tBoolean), strict: tOptional(tBoolean),
key: tString, key: tString,
delay: tOptional(tNumber), delay: tOptional(tNumber),
noWaitAfter: tOptional(tBoolean),
timeout: tOptional(tNumber), timeout: tOptional(tNumber),
}); });
scheme.FramePressResult = tOptional(tObject({})); scheme.FramePressResult = tOptional(tObject({}));
@ -1956,7 +1955,6 @@ scheme.ElementHandlePressParams = tObject({
key: tString, key: tString,
delay: tOptional(tNumber), delay: tOptional(tNumber),
timeout: tOptional(tNumber), timeout: tOptional(tNumber),
noWaitAfter: tOptional(tBoolean),
}); });
scheme.ElementHandlePressResult = tOptional(tObject({})); scheme.ElementHandlePressResult = tOptional(tObject({}));
scheme.ElementHandleQuerySelectorParams = tObject({ scheme.ElementHandleQuerySelectorParams = tObject({

View file

@ -711,7 +711,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
return 'done'; return 'done';
} }
async press(metadata: CallMetadata, key: string, options: { delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions & types.StrictOptions): Promise<void> { async press(metadata: CallMetadata, key: string, options: { delay?: number } & types.TimeoutOptions & types.StrictOptions): Promise<void> {
const controller = new ProgressController(metadata, this); const controller = new ProgressController(metadata, this);
return controller.run(async progress => { return controller.run(async progress => {
const result = await this._press(progress, key, options); const result = await this._press(progress, key, options);
@ -719,17 +719,15 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
}, this._page._timeoutSettings.timeout(options)); }, this._page._timeoutSettings.timeout(options));
} }
async _press(progress: Progress, key: string, options: { delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions & types.StrictOptions): Promise<'error:notconnected' | 'done'> { async _press(progress: Progress, key: string, options: { delay?: number } & types.TimeoutOptions & types.StrictOptions): Promise<'error:notconnected' | 'done'> {
progress.log(`elementHandle.press("${key}")`); progress.log(`elementHandle.press("${key}")`);
await progress.beforeInputAction(this); await progress.beforeInputAction(this);
return this._page._frameManager.waitForSignalsCreatedBy(progress, !options.noWaitAfter, async () => {
const result = await this._focus(progress, true /* resetSelectionIfNotFocused */); const result = await this._focus(progress, true /* resetSelectionIfNotFocused */);
if (result !== 'done') if (result !== 'done')
return result; return result;
progress.throwIfAborted(); // Avoid action that has side-effects. progress.throwIfAborted(); // Avoid action that has side-effects.
await this._page.keyboard.press(key, options); await this._page.keyboard.press(key, options);
return 'done'; return 'done';
});
} }
async check(metadata: CallMetadata, options: { position?: types.Point } & types.PointerActionWaitOptions) { async check(metadata: CallMetadata, options: { position?: types.Point } & types.PointerActionWaitOptions) {

View file

@ -1365,7 +1365,7 @@ export class Frame extends SdkObject {
}, this._page._timeoutSettings.timeout(options)); }, this._page._timeoutSettings.timeout(options));
} }
async press(metadata: CallMetadata, selector: string, key: string, options: { delay?: number, noWaitAfter?: boolean } & types.TimeoutOptions & types.StrictOptions = {}) { async press(metadata: CallMetadata, selector: string, key: string, options: { delay?: number } & types.TimeoutOptions & types.StrictOptions = {}) {
const controller = new ProgressController(metadata, this); const controller = new ProgressController(metadata, this);
return controller.run(async progress => { return controller.run(async progress => {
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._press(progress, key, options))); return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, true /* performLocatorHandlersCheckpoint */, handle => handle._press(progress, key, options)));

View file

@ -3647,10 +3647,8 @@ export interface Page {
delay?: number; delay?: number;
/** /**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You * This option has no effect.
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as * @deprecated This option has no effect.
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
*/ */
noWaitAfter?: boolean; noWaitAfter?: boolean;
@ -6936,10 +6934,8 @@ export interface Frame {
delay?: number; delay?: number;
/** /**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You * This option has no effect.
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as * @deprecated This option has no effect.
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
*/ */
noWaitAfter?: boolean; noWaitAfter?: boolean;
@ -10923,10 +10919,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
delay?: number; delay?: number;
/** /**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You * This option has no effect.
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as * @deprecated This option has no effect.
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
*/ */
noWaitAfter?: boolean; noWaitAfter?: boolean;
@ -13130,10 +13124,8 @@ export interface Locator {
delay?: number; delay?: number;
/** /**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You * This option has no effect.
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as * @deprecated This option has no effect.
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
*/ */
noWaitAfter?: boolean; noWaitAfter?: boolean;

View file

@ -2895,13 +2895,11 @@ export type FramePressParams = {
strict?: boolean, strict?: boolean,
key: string, key: string,
delay?: number, delay?: number,
noWaitAfter?: boolean,
timeout?: number, timeout?: number,
}; };
export type FramePressOptions = { export type FramePressOptions = {
strict?: boolean, strict?: boolean,
delay?: number, delay?: number,
noWaitAfter?: boolean,
timeout?: number, timeout?: number,
}; };
export type FramePressResult = void; export type FramePressResult = void;
@ -3482,12 +3480,10 @@ export type ElementHandlePressParams = {
key: string, key: string,
delay?: number, delay?: number,
timeout?: number, timeout?: number,
noWaitAfter?: boolean,
}; };
export type ElementHandlePressOptions = { export type ElementHandlePressOptions = {
delay?: number, delay?: number,
timeout?: number, timeout?: number,
noWaitAfter?: boolean,
}; };
export type ElementHandlePressResult = void; export type ElementHandlePressResult = void;
export type ElementHandleQuerySelectorParams = { export type ElementHandleQuerySelectorParams = {

View file

@ -2143,7 +2143,6 @@ Frame:
strict: boolean? strict: boolean?
key: string key: string
delay: number? delay: number?
noWaitAfter: boolean?
timeout: number? timeout: number?
flags: flags:
slowMo: true slowMo: true
@ -2685,7 +2684,6 @@ ElementHandle:
key: string key: string
delay: number? delay: number?
timeout: number? timeout: number?
noWaitAfter: boolean?
flags: flags:
slowMo: true slowMo: true
snapshot: true snapshot: true