mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00: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 { monotonicTime } from '../utils/utils';
|
||||||
import { ElementHandle } from './elementHandle';
|
import { ElementHandle } from './elementHandle';
|
||||||
import { Frame } from './frame';
|
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';
|
import { parseResult, serializeArgument } from './jsHandle';
|
||||||
|
|
||||||
export class Locator implements api.Locator {
|
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) => {
|
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)
|
if (options.expectedValue)
|
||||||
params.expectedValue = serializeArgument(options.expectedValue);
|
params.expectedValue = serializeArgument(options.expectedValue);
|
||||||
const result = (await channel.expect(params));
|
const result = (await channel.expect(params));
|
||||||
|
@ -118,3 +118,5 @@ export type SelectorEngine = {
|
|||||||
|
|
||||||
export type RemoteAddr = channels.RemoteAddr;
|
export type RemoteAddr = channels.RemoteAddr;
|
||||||
export type SecurityDetails = channels.SecurityDetails;
|
export type SecurityDetails = channels.SecurityDetails;
|
||||||
|
|
||||||
|
export type FrameExpectOptions = channels.FrameExpectOptions & { isNot?: boolean };
|
||||||
|
@ -2221,7 +2221,7 @@ export type FrameExpectParams = {
|
|||||||
expectedNumber?: number,
|
expectedNumber?: number,
|
||||||
expectedValue?: SerializedArgument,
|
expectedValue?: SerializedArgument,
|
||||||
useInnerText?: boolean,
|
useInnerText?: boolean,
|
||||||
isNot?: boolean,
|
isNot: boolean,
|
||||||
timeout?: number,
|
timeout?: number,
|
||||||
};
|
};
|
||||||
export type FrameExpectOptions = {
|
export type FrameExpectOptions = {
|
||||||
@ -2230,7 +2230,6 @@ export type FrameExpectOptions = {
|
|||||||
expectedNumber?: number,
|
expectedNumber?: number,
|
||||||
expectedValue?: SerializedArgument,
|
expectedValue?: SerializedArgument,
|
||||||
useInnerText?: boolean,
|
useInnerText?: boolean,
|
||||||
isNot?: boolean,
|
|
||||||
timeout?: number,
|
timeout?: number,
|
||||||
};
|
};
|
||||||
export type FrameExpectResult = {
|
export type FrameExpectResult = {
|
||||||
|
@ -1799,7 +1799,7 @@ Frame:
|
|||||||
expectedNumber: number?
|
expectedNumber: number?
|
||||||
expectedValue: SerializedArgument?
|
expectedValue: SerializedArgument?
|
||||||
useInnerText: boolean?
|
useInnerText: boolean?
|
||||||
isNot: boolean?
|
isNot: boolean
|
||||||
timeout: number?
|
timeout: number?
|
||||||
returns:
|
returns:
|
||||||
pass: boolean
|
pass: boolean
|
||||||
|
@ -908,7 +908,7 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
|
|||||||
expectedNumber: tOptional(tNumber),
|
expectedNumber: tOptional(tNumber),
|
||||||
expectedValue: tOptional(tType('SerializedArgument')),
|
expectedValue: tOptional(tType('SerializedArgument')),
|
||||||
useInnerText: tOptional(tBoolean),
|
useInnerText: tOptional(tBoolean),
|
||||||
isNot: tOptional(tBoolean),
|
isNot: tBoolean,
|
||||||
timeout: tOptional(tNumber),
|
timeout: tOptional(tNumber),
|
||||||
});
|
});
|
||||||
scheme.WorkerEvaluateExpressionParams = tObject({
|
scheme.WorkerEvaluateExpressionParams = tObject({
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as channels from 'playwright-core/src/protocol/channels';
|
|
||||||
import { Locator, Page } from 'playwright-core';
|
import { Locator, Page } from 'playwright-core';
|
||||||
|
import { FrameExpectOptions } from 'playwright-core/src/client/types';
|
||||||
import { constructURLBasedOnBaseURL } from 'playwright-core/src/utils/utils';
|
import { constructURLBasedOnBaseURL } from 'playwright-core/src/utils/utils';
|
||||||
import type { Expect } from '../types';
|
import type { Expect } from '../types';
|
||||||
import { toBeTruthy } from './toBeTruthy';
|
import { toBeTruthy } from './toBeTruthy';
|
||||||
@ -23,7 +23,7 @@ import { toEqual } from './toEqual';
|
|||||||
import { toExpectedTextValues, toMatchText } from './toMatchText';
|
import { toExpectedTextValues, toMatchText } from './toMatchText';
|
||||||
|
|
||||||
interface LocatorEx extends Locator {
|
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(
|
export function toBeChecked(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user