chore: explicitly control actions with slow mo (#22445)

Fixes https://github.com/microsoft/playwright/issues/22273
This commit is contained in:
Pavel Feldman 2023-04-17 19:19:30 -04:00 committed by GitHub
parent 8d69fbacf7
commit 00df08b3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 202 additions and 143 deletions

View File

@ -16,6 +16,56 @@
// This file is generated by generate_channels.js, do not edit manually. // This file is generated by generate_channels.js, do not edit manually.
export const slowMoActions = new Set([
'Page.goBack',
'Page.goForward',
'Page.reload',
'Page.keyboardDown',
'Page.keyboardUp',
'Page.keyboardInsertText',
'Page.keyboardType',
'Page.keyboardPress',
'Page.mouseMove',
'Page.mouseDown',
'Page.mouseUp',
'Page.mouseClick',
'Page.mouseWheel',
'Page.touchscreenTap',
'Frame.blur',
'Frame.check',
'Frame.click',
'Frame.dragAndDrop',
'Frame.dblclick',
'Frame.dispatchEvent',
'Frame.fill',
'Frame.focus',
'Frame.goto',
'Frame.hover',
'Frame.press',
'Frame.selectOption',
'Frame.setInputFiles',
'Frame.setInputFilePaths',
'Frame.tap',
'Frame.type',
'Frame.uncheck',
'ElementHandle.check',
'ElementHandle.click',
'ElementHandle.dblclick',
'ElementHandle.dispatchEvent',
'ElementHandle.fill',
'ElementHandle.focus',
'ElementHandle.hover',
'ElementHandle.press',
'ElementHandle.scrollIntoViewIfNeeded',
'ElementHandle.selectOption',
'ElementHandle.selectText',
'ElementHandle.setInputFiles',
'ElementHandle.setInputFilePaths',
'ElementHandle.tap',
'ElementHandle.type',
'ElementHandle.uncheck'
]);
export const commandsWithTracingSnapshots = new Set([ export const commandsWithTracingSnapshots = new Set([
'EventTarget.waitForEventInfo', 'EventTarget.waitForEventInfo',
'BrowserContext.waitForEventInfo', 'BrowserContext.waitForEventInfo',

View File

@ -18,7 +18,7 @@ import { EventEmitter } from 'events';
import { debugMode, isUnderTest, monotonicTime } from '../utils'; import { debugMode, isUnderTest, monotonicTime } from '../utils';
import { BrowserContext } from './browserContext'; import { BrowserContext } from './browserContext';
import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation'; import type { CallMetadata, InstrumentationListener, SdkObject } from './instrumentation';
import { commandsWithTracingSnapshots, pausesBeforeInputActions } from '../protocol/debug'; import { commandsWithTracingSnapshots, pausesBeforeInputActions, slowMoActions } from '../protocol/debug';
const symbol = Symbol('Debugger'); const symbol = Symbol('Debugger');
@ -141,5 +141,5 @@ function shouldPauseBeforeStep(metadata: CallMetadata): boolean {
} }
export function shouldSlowMo(metadata: CallMetadata): boolean { export function shouldSlowMo(metadata: CallMetadata): boolean {
return commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method); return slowMoActions.has(metadata.type + '.' + metadata.method);
} }

View File

@ -987,7 +987,7 @@ EventTarget:
event: string? event: string?
message: string? message: string?
error: string? error: string?
tracing: flags:
snapshot: true snapshot: true
BrowserContext: BrowserContext:
@ -1270,7 +1270,7 @@ Page:
- active - active
- none - none
- no-override - no-override
tracing: flags:
snapshot: true snapshot: true
exposeBinding: exposeBinding:
@ -1284,7 +1284,8 @@ Page:
waitUntil: LifecycleEvent? waitUntil: LifecycleEvent?
returns: returns:
response: Response? response: Response?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
goForward: goForward:
@ -1293,7 +1294,8 @@ Page:
waitUntil: LifecycleEvent? waitUntil: LifecycleEvent?
returns: returns:
response: Response? response: Response?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
reload: reload:
@ -1302,7 +1304,8 @@ Page:
waitUntil: LifecycleEvent? waitUntil: LifecycleEvent?
returns: returns:
response: Response? response: Response?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
expectScreenshot: expectScreenshot:
@ -1336,7 +1339,7 @@ Page:
log: log:
type: array? type: array?
items: string items: string
tracing: flags:
snapshot: true snapshot: true
screenshot: screenshot:
@ -1353,7 +1356,7 @@ Page:
$mixin: CommonScreenshotOptions $mixin: CommonScreenshotOptions
returns: returns:
binary: binary binary: binary
tracing: flags:
snapshot: true snapshot: true
setExtraHTTPHeaders: setExtraHTTPHeaders:
@ -1380,39 +1383,44 @@ Page:
properties: properties:
width: number width: number
height: number height: number
tracing: flags:
snapshot: true snapshot: true
keyboardDown: keyboardDown:
parameters: parameters:
key: string key: string
tracing: flags:
slowMo: true
snapshot: true snapshot: true
keyboardUp: keyboardUp:
parameters: parameters:
key: string key: string
tracing: flags:
slowMo: true
snapshot: true snapshot: true
keyboardInsertText: keyboardInsertText:
parameters: parameters:
text: string text: string
tracing: flags:
slowMo: true
snapshot: true snapshot: true
keyboardType: keyboardType:
parameters: parameters:
text: string text: string
delay: number? delay: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
keyboardPress: keyboardPress:
parameters: parameters:
key: string key: string
delay: number? delay: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
mouseMove: mouseMove:
@ -1420,7 +1428,8 @@ Page:
x: number x: number
y: number y: number
steps: number? steps: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
mouseDown: mouseDown:
@ -1432,7 +1441,8 @@ Page:
- right - right
- middle - middle
clickCount: number? clickCount: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
mouseUp: mouseUp:
@ -1444,7 +1454,8 @@ Page:
- right - right
- middle - middle
clickCount: number? clickCount: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
mouseClick: mouseClick:
@ -1459,21 +1470,24 @@ Page:
- right - right
- middle - middle
clickCount: number? clickCount: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
mouseWheel: mouseWheel:
parameters: parameters:
deltaX: number deltaX: number
deltaY: number deltaY: number
tracing: flags:
slowMo: true
snapshot: true snapshot: true
touchscreenTap: touchscreenTap:
parameters: parameters:
x: number x: number
y: number y: number
tracing: flags:
slowMo: true
snapshot: true snapshot: true
accessibilitySnapshot: accessibilitySnapshot:
@ -1653,7 +1667,7 @@ Frame:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
evalOnSelectorAll: evalOnSelectorAll:
@ -1664,7 +1678,7 @@ Frame:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
addScriptTag: addScriptTag:
@ -1674,7 +1688,7 @@ Frame:
type: string? type: string?
returns: returns:
element: ElementHandle element: ElementHandle
tracing: flags:
snapshot: true snapshot: true
addStyleTag: addStyleTag:
@ -1683,7 +1697,7 @@ Frame:
content: string? content: string?
returns: returns:
element: ElementHandle element: ElementHandle
tracing: flags:
snapshot: true snapshot: true
blur: blur:
@ -1691,7 +1705,8 @@ Frame:
selector: string selector: string
strict: boolean? strict: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
check: check:
@ -1703,7 +1718,8 @@ Frame:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1733,7 +1749,8 @@ Frame:
clickCount: number? clickCount: number?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1752,7 +1769,8 @@ Frame:
sourcePosition: Point? sourcePosition: Point?
targetPosition: Point? targetPosition: Point?
strict: boolean? strict: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1781,7 +1799,8 @@ Frame:
- middle - middle
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1792,7 +1811,8 @@ Frame:
type: string type: string
eventInit: SerializedArgument eventInit: SerializedArgument
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
evaluateExpression: evaluateExpression:
@ -1803,7 +1823,7 @@ Frame:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
evaluateExpressionHandle: evaluateExpressionHandle:
@ -1813,7 +1833,7 @@ Frame:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
handle: JSHandle handle: JSHandle
tracing: flags:
snapshot: true snapshot: true
fill: fill:
@ -1824,7 +1844,8 @@ Frame:
force: boolean? force: boolean?
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1833,7 +1854,8 @@ Frame:
selector: string selector: string
strict: boolean? strict: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
frameElement: frameElement:
@ -1852,7 +1874,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: string? value: string?
tracing: flags:
snapshot: true snapshot: true
goto: goto:
@ -1863,7 +1885,8 @@ Frame:
referer: string? referer: string?
returns: returns:
response: Response? response: Response?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
hover: hover:
@ -1884,7 +1907,8 @@ Frame:
timeout: number? timeout: number?
trial: boolean? trial: boolean?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -1895,7 +1919,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
innerText: innerText:
@ -1905,7 +1929,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
inputValue: inputValue:
@ -1915,7 +1939,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
isChecked: isChecked:
@ -1925,7 +1949,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isDisabled: isDisabled:
@ -1935,7 +1959,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isEnabled: isEnabled:
@ -1945,7 +1969,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isHidden: isHidden:
@ -1954,7 +1978,7 @@ Frame:
strict: boolean? strict: boolean?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isVisible: isVisible:
@ -1963,7 +1987,7 @@ Frame:
strict: boolean? strict: boolean?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isEditable: isEditable:
@ -1973,7 +1997,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
press: press:
@ -1984,7 +2008,8 @@ Frame:
delay: number? delay: number?
noWaitAfter: boolean? noWaitAfter: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2032,7 +2057,8 @@ Frame:
values: values:
type: array type: array
items: string items: string
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2041,7 +2067,7 @@ Frame:
html: string html: string
timeout: number? timeout: number?
waitUntil: LifecycleEvent? waitUntil: LifecycleEvent?
tracing: flags:
snapshot: true snapshot: true
setInputFiles: setInputFiles:
@ -2058,7 +2084,8 @@ Frame:
buffer: binary buffer: binary
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2076,7 +2103,8 @@ Frame:
items: WritableStream items: WritableStream
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2098,7 +2126,8 @@ Frame:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2109,7 +2138,7 @@ Frame:
timeout: number? timeout: number?
returns: returns:
value: string? value: string?
tracing: flags:
snapshot: true snapshot: true
title: title:
@ -2124,7 +2153,8 @@ Frame:
delay: number? delay: number?
noWaitAfter: boolean? noWaitAfter: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2137,14 +2167,15 @@ Frame:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
waitForTimeout: waitForTimeout:
parameters: parameters:
timeout: number timeout: number
tracing: flags:
snapshot: true snapshot: true
waitForFunction: waitForFunction:
@ -2157,7 +2188,7 @@ Frame:
pollingInterval: number? pollingInterval: number?
returns: returns:
handle: JSHandle handle: JSHandle
tracing: flags:
snapshot: true snapshot: true
waitForSelector: waitForSelector:
@ -2175,7 +2206,7 @@ Frame:
omitReturnValue: boolean? omitReturnValue: boolean?
returns: returns:
element: ElementHandle? element: ElementHandle?
tracing: flags:
snapshot: true snapshot: true
expect: expect:
@ -2198,7 +2229,7 @@ Frame:
log: log:
type: array? type: array?
items: string items: string
tracing: flags:
snapshot: true snapshot: true
events: events:
@ -2266,7 +2297,7 @@ JSHandle:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
evaluateExpressionHandle: evaluateExpressionHandle:
@ -2276,7 +2307,7 @@ JSHandle:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
handle: JSHandle handle: JSHandle
tracing: flags:
snapshot: true snapshot: true
getPropertyList: getPropertyList:
@ -2327,7 +2358,7 @@ ElementHandle:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
evalOnSelectorAll: evalOnSelectorAll:
@ -2338,7 +2369,7 @@ ElementHandle:
arg: SerializedArgument arg: SerializedArgument
returns: returns:
value: SerializedValue value: SerializedValue
tracing: flags:
snapshot: true snapshot: true
boundingBox: boundingBox:
@ -2352,7 +2383,8 @@ ElementHandle:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2380,7 +2412,8 @@ ElementHandle:
clickCount: number? clickCount: number?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2411,7 +2444,8 @@ ElementHandle:
- middle - middle
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2419,7 +2453,8 @@ ElementHandle:
parameters: parameters:
type: string type: string
eventInit: SerializedArgument eventInit: SerializedArgument
tracing: flags:
slowMo: true
snapshot: true snapshot: true
fill: fill:
@ -2428,12 +2463,14 @@ ElementHandle:
force: boolean? force: boolean?
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
focus: focus:
tracing: flags:
slowMo: true
snapshot: true snapshot: true
getAttribute: getAttribute:
@ -2458,62 +2495,63 @@ ElementHandle:
timeout: number? timeout: number?
trial: boolean? trial: boolean?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
innerHTML: innerHTML:
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
innerText: innerText:
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
inputValue: inputValue:
returns: returns:
value: string value: string
tracing: flags:
snapshot: true snapshot: true
isChecked: isChecked:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isDisabled: isDisabled:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isEditable: isEditable:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isEnabled: isEnabled:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isHidden: isHidden:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
isVisible: isVisible:
returns: returns:
value: boolean value: boolean
tracing: flags:
snapshot: true snapshot: true
ownerFrame: ownerFrame:
@ -2526,7 +2564,8 @@ ElementHandle:
delay: number? delay: number?
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2557,13 +2596,14 @@ ElementHandle:
$mixin: CommonScreenshotOptions $mixin: CommonScreenshotOptions
returns: returns:
binary: binary binary: binary
tracing: flags:
snapshot: true snapshot: true
scrollIntoViewIfNeeded: scrollIntoViewIfNeeded:
parameters: parameters:
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
selectOption: selectOption:
@ -2587,7 +2627,8 @@ ElementHandle:
values: values:
type: array type: array
items: string items: string
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2595,7 +2636,8 @@ ElementHandle:
parameters: parameters:
force: boolean? force: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
setInputFiles: setInputFiles:
@ -2610,7 +2652,8 @@ ElementHandle:
buffer: binary buffer: binary
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2626,7 +2669,8 @@ ElementHandle:
items: WritableStream items: WritableStream
timeout: number? timeout: number?
noWaitAfter: boolean? noWaitAfter: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2646,14 +2690,15 @@ ElementHandle:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
textContent: textContent:
returns: returns:
value: string? value: string?
tracing: flags:
snapshot: true snapshot: true
type: type:
@ -2662,7 +2707,8 @@ ElementHandle:
delay: number? delay: number?
noWaitAfter: boolean? noWaitAfter: boolean?
timeout: number? timeout: number?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2673,7 +2719,8 @@ ElementHandle:
position: Point? position: Point?
timeout: number? timeout: number?
trial: boolean? trial: boolean?
tracing: flags:
slowMo: true
snapshot: true snapshot: true
pausesBeforeInput: true pausesBeforeInput: true
@ -2689,7 +2736,7 @@ ElementHandle:
- disabled - disabled
- editable - editable
timeout: number? timeout: number?
tracing: flags:
snapshot: true snapshot: true
waitForSelector: waitForSelector:
@ -2706,7 +2753,7 @@ ElementHandle:
- hidden - hidden
returns: returns:
element: ElementHandle? element: ElementHandle?
tracing: flags:
snapshot: true snapshot: true

View File

@ -50,12 +50,6 @@ async function checkPageSlowMo(toImpl, page, task) {
it.describe('slowMo', () => { it.describe('slowMo', () => {
it.skip(({ mode }) => mode !== 'default'); it.skip(({ mode }) => mode !== 'default');
it('Page SlowMo $$eval', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.$$eval('button', () => void 0));
});
it('Page SlowMo $eval', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.$eval('button', () => void 0));
});
it('Page SlowMo check', async ({ page, toImpl }) => { it('Page SlowMo check', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.check('.check')); await checkPageSlowMo(toImpl, page, () => page.check('.check'));
}); });
@ -68,15 +62,6 @@ it.describe('slowMo', () => {
it('Page SlowMo dispatchEvent', async ({ page, toImpl }) => { it('Page SlowMo dispatchEvent', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.dispatchEvent('button', 'click')); await checkPageSlowMo(toImpl, page, () => page.dispatchEvent('button', 'click'));
}); });
it('Page SlowMo emulateMedia', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.emulateMedia({ media: 'print' }));
});
it('Page SlowMo evaluate', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.evaluate(() => void 0));
});
it('Page SlowMo evaluateHandle', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.evaluateHandle(() => window));
});
it('Page SlowMo fill', async ({ page, toImpl }) => { it('Page SlowMo fill', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.fill('.fill', 'foo')); await checkPageSlowMo(toImpl, page, () => page.fill('.fill', 'foo'));
}); });
@ -95,30 +80,18 @@ it.describe('slowMo', () => {
it('Page SlowMo reload', async ({ page, toImpl }) => { it('Page SlowMo reload', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.reload()); await checkPageSlowMo(toImpl, page, () => page.reload());
}); });
it('Page SlowMo setContent', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.setContent('hello world'));
});
it('Page SlowMo selectOption', async ({ page, toImpl }) => { it('Page SlowMo selectOption', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.selectOption('select', 'foo')); await checkPageSlowMo(toImpl, page, () => page.selectOption('select', 'foo'));
}); });
it('Page SlowMo setInputFiles', async ({ page, toImpl }) => { it('Page SlowMo setInputFiles', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.setInputFiles('.file', [])); await checkPageSlowMo(toImpl, page, () => page.setInputFiles('.file', []));
}); });
it('Page SlowMo setViewportSize', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.setViewportSize({ height: 400, width: 400 }));
});
it('Page SlowMo type', async ({ page, toImpl }) => { it('Page SlowMo type', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.type('.fill', 'a')); await checkPageSlowMo(toImpl, page, () => page.type('.fill', 'a'));
}); });
it('Page SlowMo uncheck', async ({ page, toImpl }) => { it('Page SlowMo uncheck', async ({ page, toImpl }) => {
await checkPageSlowMo(toImpl, page, () => page.uncheck('.uncheck')); await checkPageSlowMo(toImpl, page, () => page.uncheck('.uncheck'));
}); });
it('Frame SlowMo $$eval', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.$$eval('button', () => void 0));
});
it('Frame SlowMo $eval', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.$eval('button', () => void 0));
});
it('Frame SlowMo check', async ({ page, server, toImpl }) => { it('Frame SlowMo check', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.check('.check')); await checkFrameSlowMo(toImpl, page, server, frame => frame.check('.check'));
}); });
@ -131,12 +104,6 @@ it.describe('slowMo', () => {
it('Frame SlowMo dispatchEvent', async ({ page, server, toImpl }) => { it('Frame SlowMo dispatchEvent', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.dispatchEvent('button', 'click')); await checkFrameSlowMo(toImpl, page, server, frame => frame.dispatchEvent('button', 'click'));
}); });
it('Frame SlowMo evaluate', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.evaluate(() => void 0));
});
it('Frame SlowMo evaluateHandle', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.evaluateHandle(() => window));
});
it('Frame SlowMo fill', async ({ page, server, toImpl }) => { it('Frame SlowMo fill', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.fill('.fill', 'foo')); await checkFrameSlowMo(toImpl, page, server, frame => frame.fill('.fill', 'foo'));
}); });
@ -152,9 +119,6 @@ it.describe('slowMo', () => {
it('Frame SlowMo press', async ({ page, server, toImpl }) => { it('Frame SlowMo press', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.press('button', 'Enter')); await checkFrameSlowMo(toImpl, page, server, frame => frame.press('button', 'Enter'));
}); });
it('Frame SlowMo setContent', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.setContent('hello world'));
});
it('Frame SlowMo selectOption', async ({ page, server, toImpl }) => { it('Frame SlowMo selectOption', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.selectOption('select', 'foo')); await checkFrameSlowMo(toImpl, page, server, frame => frame.selectOption('select', 'foo'));
}); });
@ -167,12 +131,6 @@ it.describe('slowMo', () => {
it('Frame SlowMo uncheck', async ({ page, server, toImpl }) => { it('Frame SlowMo uncheck', async ({ page, server, toImpl }) => {
await checkFrameSlowMo(toImpl, page, server, frame => frame.uncheck('.uncheck')); await checkFrameSlowMo(toImpl, page, server, frame => frame.uncheck('.uncheck'));
}); });
it('ElementHandle SlowMo $$eval', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, 'body', element => element.$$eval('button', () => void 0));
});
it('ElementHandle SlowMo $eval', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, 'body', element => element.$eval('button', () => void 0));
});
it('ElementHandle SlowMo check', async ({ page, toImpl }) => { it('ElementHandle SlowMo check', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, '.check', element => element.check()); await checkElementSlowMo(toImpl, page, '.check', element => element.check());
}); });
@ -185,12 +143,6 @@ it.describe('slowMo', () => {
it('ElementHandle SlowMo dispatchEvent', async ({ page, toImpl }) => { it('ElementHandle SlowMo dispatchEvent', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, 'button', element => element.dispatchEvent('click')); await checkElementSlowMo(toImpl, page, 'button', element => element.dispatchEvent('click'));
}); });
it('ElementHandle SlowMo evaluate', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, 'button', element => element.evaluate(() => void 0));
});
it('ElementHandle SlowMo evaluateHandle', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, 'button', element => element.evaluateHandle(() => void 0));
});
it('ElementHandle SlowMo fill', async ({ page, toImpl }) => { it('ElementHandle SlowMo fill', async ({ page, toImpl }) => {
await checkElementSlowMo(toImpl, page, '.fill', element => element.fill('foo')); await checkElementSlowMo(toImpl, page, '.fill', element => element.fill('foo'));
}); });

View File

@ -178,6 +178,7 @@ const debug_ts = [
// This file is generated by ${path.basename(__filename).split(path.sep).join(path.posix.sep)}, do not edit manually. // This file is generated by ${path.basename(__filename).split(path.sep).join(path.posix.sep)}, do not edit manually.
`]; `];
const slowMoActions = [];
const tracingSnapshots = []; const tracingSnapshots = [];
const pausesBeforeInputActions = []; const pausesBeforeInputActions = [];
@ -278,12 +279,17 @@ for (const [name, item] of Object.entries(protocol)) {
for (let [methodName, method] of Object.entries(item.commands || {})) { for (let [methodName, method] of Object.entries(item.commands || {})) {
if (method === null) if (method === null)
method = {}; method = {};
if (method.tracing && method.tracing.snapshot) { if (method.flags?.slowMo) {
slowMoActions.push(name + '.' + methodName);
for (const derived of derivedClasses.get(name) || [])
slowMoActions.push(derived + '.' + methodName);
}
if (method.flags?.snapshot) {
tracingSnapshots.push(name + '.' + methodName); tracingSnapshots.push(name + '.' + methodName);
for (const derived of derivedClasses.get(name) || []) for (const derived of derivedClasses.get(name) || [])
tracingSnapshots.push(derived + '.' + methodName); tracingSnapshots.push(derived + '.' + methodName);
} }
if (method.tracing && method.tracing.pausesBeforeInput) { if (method.flags?.pausesBeforeInput) {
pausesBeforeInputActions.push(name + '.' + methodName); pausesBeforeInputActions.push(name + '.' + methodName);
for (const derived of derivedClasses.get(name) || []) for (const derived of derivedClasses.get(name) || [])
pausesBeforeInputActions.push(derived + '.' + methodName); pausesBeforeInputActions.push(derived + '.' + methodName);
@ -329,6 +335,10 @@ for (const [name, item] of Object.entries(protocol)) {
} }
} }
debug_ts.push(`export const slowMoActions = new Set([
'${slowMoActions.join(`',\n '`)}'
]);`);
debug_ts.push('');
debug_ts.push(`export const commandsWithTracingSnapshots = new Set([ debug_ts.push(`export const commandsWithTracingSnapshots = new Set([
'${tracingSnapshots.join(`',\n '`)}' '${tracingSnapshots.join(`',\n '`)}'
]);`); ]);`);