mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-12 20:03:03 +03:00
fix(matchers): make isNot required in protocol (#9436)
This commit is contained in:
parent
ded1e718b5
commit
82ff85b106
@ -21,7 +21,7 @@ import * as util from 'util';
|
||||
import { monotonicTime } from '../utils/utils';
|
||||
import { ElementHandle } from './elementHandle';
|
||||
import { Frame } from './frame';
|
||||
import { FilePayload, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
||||
import { FilePayload, FrameExpectOptions, Rect, SelectOption, SelectOptionOptions, TimeoutOptions } from './types';
|
||||
import { parseResult, serializeArgument } from './jsHandle';
|
||||
|
||||
export class Locator implements api.Locator {
|
||||
@ -221,9 +221,9 @@ export class Locator implements api.Locator {
|
||||
});
|
||||
}
|
||||
|
||||
async _expect(expression: string, options: channels.FrameExpectOptions): Promise<{ pass: boolean, received?: any, log?: string[] }> {
|
||||
async _expect(expression: string, options: FrameExpectOptions): Promise<{ pass: boolean, received?: any, log?: string[] }> {
|
||||
return this._frame._wrapApiCall(async (channel: channels.FrameChannel) => {
|
||||
const params: any = { selector: this._selector, expression, ...options };
|
||||
const params: channels.FrameExpectParams = { selector: this._selector, expression, ...options, isNot: !!options.isNot };
|
||||
if (options.expectedValue)
|
||||
params.expectedValue = serializeArgument(options.expectedValue);
|
||||
const result = (await channel.expect(params));
|
||||
|
@ -118,3 +118,5 @@ export type SelectorEngine = {
|
||||
|
||||
export type RemoteAddr = channels.RemoteAddr;
|
||||
export type SecurityDetails = channels.SecurityDetails;
|
||||
|
||||
export type FrameExpectOptions = channels.FrameExpectOptions & { isNot?: boolean };
|
||||
|
@ -2221,7 +2221,7 @@ export type FrameExpectParams = {
|
||||
expectedNumber?: number,
|
||||
expectedValue?: SerializedArgument,
|
||||
useInnerText?: boolean,
|
||||
isNot?: boolean,
|
||||
isNot: boolean,
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameExpectOptions = {
|
||||
@ -2230,7 +2230,6 @@ export type FrameExpectOptions = {
|
||||
expectedNumber?: number,
|
||||
expectedValue?: SerializedArgument,
|
||||
useInnerText?: boolean,
|
||||
isNot?: boolean,
|
||||
timeout?: number,
|
||||
};
|
||||
export type FrameExpectResult = {
|
||||
|
@ -1799,7 +1799,7 @@ Frame:
|
||||
expectedNumber: number?
|
||||
expectedValue: SerializedArgument?
|
||||
useInnerText: boolean?
|
||||
isNot: boolean?
|
||||
isNot: boolean
|
||||
timeout: number?
|
||||
returns:
|
||||
pass: boolean
|
||||
|
@ -908,7 +908,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
||||
expectedNumber: tOptional(tNumber),
|
||||
expectedValue: tOptional(tType('SerializedArgument')),
|
||||
useInnerText: tOptional(tBoolean),
|
||||
isNot: tOptional(tBoolean),
|
||||
isNot: tBoolean,
|
||||
timeout: tOptional(tNumber),
|
||||
});
|
||||
scheme.WorkerEvaluateExpressionParams = tObject({
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as channels from 'playwright-core/src/protocol/channels';
|
||||
import { Locator, Page } from 'playwright-core';
|
||||
import { FrameExpectOptions } from 'playwright-core/src/client/types';
|
||||
import { constructURLBasedOnBaseURL } from 'playwright-core/src/utils/utils';
|
||||
import type { Expect } from '../types';
|
||||
import { toBeTruthy } from './toBeTruthy';
|
||||
@ -23,7 +23,7 @@ import { toEqual } from './toEqual';
|
||||
import { toExpectedTextValues, toMatchText } from './toMatchText';
|
||||
|
||||
interface LocatorEx extends Locator {
|
||||
_expect(expression: string, options: channels.FrameExpectOptions): Promise<{ pass: boolean, received?: any, log?: string[] }>;
|
||||
_expect(expression: string, options: FrameExpectOptions): Promise<{ pass: boolean, received?: any, log?: string[] }>;
|
||||
}
|
||||
|
||||
export function toBeChecked(
|
||||
|
Loading…
Reference in New Issue
Block a user