Skip to content

Commit

Permalink
chore: remove noWaitAfter from selectOption (#32283)
Browse files Browse the repository at this point in the history
This follows removing this option from other methods in v1.46. The two
methods still supporting `noWaitAfter` are `click` and `press`.
  • Loading branch information
dgozman committed Aug 23, 2024
1 parent 9d86bc5 commit abe6c04
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/src/api/class-elementhandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ await handle.SelectOptionAsync(new[] {
### option: ElementHandle.selectOption.force = %%-input-force-%%
* since: v1.13

### option: ElementHandle.selectOption.noWaitAfter = %%-input-no-wait-after-%%
### option: ElementHandle.selectOption.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8

### option: ElementHandle.selectOption.timeout = %%-input-timeout-%%
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/class-frame.md
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ await frame.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" })
### option: Frame.selectOption.force = %%-input-force-%%
* since: v1.13

### option: Frame.selectOption.noWaitAfter = %%-input-no-wait-after-%%
### option: Frame.selectOption.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8

### option: Frame.selectOption.strict = %%-input-strict-%%
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/class-locator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ await element.SelectOptionAsync(new[] { "red", "green", "blue" });
### option: Locator.selectOption.force = %%-input-force-%%
* since: v1.14

### option: Locator.selectOption.noWaitAfter = %%-input-no-wait-after-%%
### option: Locator.selectOption.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.14

### option: Locator.selectOption.timeout = %%-input-timeout-%%
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/class-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -3742,7 +3742,7 @@ await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" });
### option: Page.selectOption.force = %%-input-force-%%
* since: v1.13
### option: Page.selectOption.noWaitAfter = %%-input-no-wait-after-%%
### option: Page.selectOption.noWaitAfter = %%-input-no-wait-after-removed-%%
* since: v1.8
### option: Page.selectOption.strict = %%-input-strict-%%
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type WaitForEventOptions = Function | { predicate?: Function, timeout?: n
export type WaitForFunctionOptions = { timeout?: number, polling?: 'raf' | number };

export type SelectOption = { value?: string, label?: string, index?: number, valueOrLabel?: string };
export type SelectOptionOptions = { force?: boolean, timeout?: number, noWaitAfter?: boolean };
export type SelectOptionOptions = { force?: boolean, timeout?: number };
export type FilePayload = { name: string, mimeType: string, buffer: Buffer };
export type StorageState = {
cookies: channels.NetworkCookie[],
Expand Down
2 changes: 0 additions & 2 deletions packages/playwright-core/src/protocol/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,6 @@ scheme.FrameSelectOptionParams = tObject({
}))),
force: tOptional(tBoolean),
timeout: tOptional(tNumber),
noWaitAfter: tOptional(tBoolean),
});
scheme.FrameSelectOptionResult = tObject({
values: tArray(tString),
Expand Down Expand Up @@ -2001,7 +2000,6 @@ scheme.ElementHandleSelectOptionParams = tObject({
}))),
force: tOptional(tBoolean),
timeout: tOptional(tNumber),
noWaitAfter: tOptional(tBoolean),
});
scheme.ElementHandleSelectOptionResult = tObject({
values: tArray(tString),
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/server/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,15 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
return this._retryPointerAction(progress, 'tap', true /* waitForEnabled */, point => this._page.touchscreen.tap(point.x, point.y), { ...options, waitAfter: 'disabled' });
}

async selectOption(metadata: CallMetadata, elements: ElementHandle[], values: types.SelectOption[], options: { noWaitAfter?: boolean } & types.CommonActionOptions): Promise<string[]> {
async selectOption(metadata: CallMetadata, elements: ElementHandle[], values: types.SelectOption[], options: types.CommonActionOptions): Promise<string[]> {
const controller = new ProgressController(metadata, this);
return controller.run(async progress => {
const result = await this._selectOption(progress, elements, values, options);
return throwRetargetableDOMError(result);
}, this._page._timeoutSettings.timeout(options));
}

async _selectOption(progress: Progress, elements: ElementHandle[], values: types.SelectOption[], options: { noWaitAfter?: boolean } & types.CommonActionOptions): Promise<string[] | 'error:notconnected'> {
async _selectOption(progress: Progress, elements: ElementHandle[], values: types.SelectOption[], options: types.CommonActionOptions): Promise<string[] | 'error:notconnected'> {
let resultingOptions: string[] = [];
await this._retryAction(progress, 'select option', async () => {
await progress.beforeInputAction(this);
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright-core/src/server/frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ export class Frame extends SdkObject {
}, this._page._timeoutSettings.timeout(options));
}

async selectOption(metadata: CallMetadata, selector: string, elements: dom.ElementHandle[], values: types.SelectOption[], options: { noWaitAfter?: boolean } & types.CommonActionOptions = {}): Promise<string[]> {
async selectOption(metadata: CallMetadata, selector: string, elements: dom.ElementHandle[], values: types.SelectOption[], options: types.CommonActionOptions = {}): Promise<string[]> {
const controller = new ProgressController(metadata, this);
return controller.run(async progress => {
return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, !options.force /* performLocatorHandlersCheckpoint */, handle => handle._selectOption(progress, elements, values, options));
Expand Down
24 changes: 8 additions & 16 deletions packages/playwright-core/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3897,10 +3897,8 @@ export interface Page {
force?: boolean;

/**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
* This option has no effect.
* @deprecated This option has no effect.
*/
noWaitAfter?: boolean;

Expand Down Expand Up @@ -7023,10 +7021,8 @@ export interface Frame {
force?: boolean;

/**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
* This option has no effect.
* @deprecated This option has no effect.
*/
noWaitAfter?: boolean;

Expand Down Expand Up @@ -11136,10 +11132,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
force?: boolean;

/**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
* This option has no effect.
* @deprecated This option has no effect.
*/
noWaitAfter?: boolean;

Expand Down Expand Up @@ -13331,10 +13325,8 @@ export interface Locator {
force?: boolean;

/**
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
* can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
* navigating to inaccessible pages. Defaults to `false`.
* @deprecated This option will default to `true` in the future.
* This option has no effect.
* @deprecated This option has no effect.
*/
noWaitAfter?: boolean;

Expand Down
4 changes: 0 additions & 4 deletions packages/protocol/src/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2939,7 +2939,6 @@ export type FrameSelectOptionParams = {
}[],
force?: boolean,
timeout?: number,
noWaitAfter?: boolean,
};
export type FrameSelectOptionOptions = {
strict?: boolean,
Expand All @@ -2952,7 +2951,6 @@ export type FrameSelectOptionOptions = {
}[],
force?: boolean,
timeout?: number,
noWaitAfter?: boolean,
};
export type FrameSelectOptionResult = {
values: string[],
Expand Down Expand Up @@ -3555,7 +3553,6 @@ export type ElementHandleSelectOptionParams = {
}[],
force?: boolean,
timeout?: number,
noWaitAfter?: boolean,
};
export type ElementHandleSelectOptionOptions = {
elements?: ElementHandleChannel[],
Expand All @@ -3567,7 +3564,6 @@ export type ElementHandleSelectOptionOptions = {
}[],
force?: boolean,
timeout?: number,
noWaitAfter?: boolean,
};
export type ElementHandleSelectOptionResult = {
values: string[],
Expand Down
2 changes: 0 additions & 2 deletions packages/protocol/src/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,6 @@ Frame:
index: number?
force: boolean?
timeout: number?
noWaitAfter: boolean?
returns:
values:
type: array
Expand Down Expand Up @@ -2741,7 +2740,6 @@ ElementHandle:
index: number?
force: boolean?
timeout: number?
noWaitAfter: boolean?
returns:
values:
type: array
Expand Down

0 comments on commit abe6c04

Please sign in to comment.