mirror of
https://github.com/microsoft/playwright.git
synced 2026-11-22 22:05:11 -05:00
chore: split protocol.yml (#40645)
This commit is contained in:
@@ -8,7 +8,7 @@ on:
|
||||
- 'packages/playwright-core/src/client/**/*'
|
||||
- 'packages/isomorphic/**/*'
|
||||
- 'packages/playwright/src/matchers/matchers.ts'
|
||||
- 'packages/protocol/src/protocol.yml'
|
||||
- 'packages/protocol/spec/**/*.yml'
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
APIRequestContext:
|
||||
type: interface
|
||||
|
||||
initializer:
|
||||
tracing: Tracing
|
||||
|
||||
commands:
|
||||
|
||||
fetch:
|
||||
title: '{method} "{url}"'
|
||||
parameters:
|
||||
url: string
|
||||
encodedParams: string?
|
||||
params:
|
||||
type: array?
|
||||
items: NameValue
|
||||
method: string?
|
||||
headers:
|
||||
type: array?
|
||||
items: NameValue
|
||||
postData: binary?
|
||||
jsonData: string?
|
||||
formData:
|
||||
type: array?
|
||||
items: NameValue
|
||||
multipartData:
|
||||
type: array?
|
||||
items: FormField
|
||||
timeout: float
|
||||
failOnStatusCode: boolean?
|
||||
ignoreHTTPSErrors: boolean?
|
||||
maxRedirects: int?
|
||||
maxRetries: int?
|
||||
returns:
|
||||
response: APIResponse
|
||||
|
||||
fetchResponseBody:
|
||||
title: Get response body
|
||||
group: getter
|
||||
parameters:
|
||||
fetchUid: string
|
||||
returns:
|
||||
binary: binary?
|
||||
|
||||
fetchLog:
|
||||
internal: true
|
||||
parameters:
|
||||
fetchUid: string
|
||||
returns:
|
||||
log:
|
||||
type: array
|
||||
items: string
|
||||
|
||||
storageState:
|
||||
title: Get storage state
|
||||
group: configuration
|
||||
parameters:
|
||||
indexedDB: boolean?
|
||||
returns:
|
||||
cookies:
|
||||
type: array
|
||||
items: NetworkCookie
|
||||
origins:
|
||||
type: array
|
||||
items: OriginStorage
|
||||
|
||||
disposeAPIResponse:
|
||||
internal: true
|
||||
parameters:
|
||||
fetchUid: string
|
||||
|
||||
dispose:
|
||||
internal: true
|
||||
parameters:
|
||||
reason: string?
|
||||
|
||||
APIResponse:
|
||||
type: object
|
||||
properties:
|
||||
fetchUid: string
|
||||
url: string
|
||||
status: int
|
||||
statusText: string
|
||||
headers:
|
||||
type: array
|
||||
items: NameValue
|
||||
@@ -0,0 +1,82 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Artifact:
|
||||
type: interface
|
||||
|
||||
initializer:
|
||||
absolutePath: string
|
||||
|
||||
commands:
|
||||
|
||||
pathAfterFinished:
|
||||
internal: true
|
||||
returns:
|
||||
value: string
|
||||
|
||||
# Blocks path/failure/delete/context.close until saved to the local |path|.
|
||||
saveAs:
|
||||
internal: true
|
||||
parameters:
|
||||
path: string
|
||||
|
||||
# Blocks path/failure/delete/context.close until the stream is closed.
|
||||
saveAsStream:
|
||||
internal: true
|
||||
returns:
|
||||
stream: Stream
|
||||
|
||||
failure:
|
||||
internal: true
|
||||
returns:
|
||||
error: string?
|
||||
|
||||
stream:
|
||||
internal: true
|
||||
returns:
|
||||
stream: Stream
|
||||
|
||||
cancel:
|
||||
internal: true
|
||||
|
||||
delete:
|
||||
internal: true
|
||||
|
||||
Stream:
|
||||
type: interface
|
||||
|
||||
commands:
|
||||
|
||||
read:
|
||||
internal: true
|
||||
parameters:
|
||||
size: int?
|
||||
returns:
|
||||
binary: binary
|
||||
|
||||
close:
|
||||
internal: true
|
||||
|
||||
WritableStream:
|
||||
type: interface
|
||||
|
||||
commands:
|
||||
|
||||
write:
|
||||
internal: true
|
||||
parameters:
|
||||
binary: binary
|
||||
|
||||
close:
|
||||
internal: true
|
||||
@@ -0,0 +1,138 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Browser:
|
||||
type: interface
|
||||
|
||||
initializer:
|
||||
version: string
|
||||
name: string
|
||||
browserName:
|
||||
type: enum
|
||||
literals:
|
||||
- chromium
|
||||
- firefox
|
||||
- webkit
|
||||
|
||||
commands:
|
||||
|
||||
startServer:
|
||||
title: Start server
|
||||
parameters:
|
||||
title: string
|
||||
workspaceDir: string?
|
||||
metadata: json?
|
||||
host: string?
|
||||
port: int?
|
||||
returns:
|
||||
endpoint: string
|
||||
|
||||
stopServer:
|
||||
title: Stop server
|
||||
|
||||
close:
|
||||
title: Close browser
|
||||
parameters:
|
||||
reason: string?
|
||||
flags:
|
||||
pause: true
|
||||
|
||||
killForTests:
|
||||
internal: true
|
||||
|
||||
defaultUserAgentForTest:
|
||||
internal: true
|
||||
returns:
|
||||
userAgent: string
|
||||
|
||||
newContext:
|
||||
title: Create context
|
||||
parameters:
|
||||
$mixin: ContextOptions
|
||||
proxy:
|
||||
type: object?
|
||||
properties:
|
||||
server: string
|
||||
bypass: string?
|
||||
username: string?
|
||||
password: string?
|
||||
storageState:
|
||||
type: object?
|
||||
properties:
|
||||
cookies:
|
||||
type: array?
|
||||
items: SetNetworkCookie
|
||||
origins:
|
||||
type: array?
|
||||
items: SetOriginStorage
|
||||
returns:
|
||||
context: BrowserContext
|
||||
|
||||
newContextForReuse:
|
||||
internal: true
|
||||
parameters:
|
||||
$mixin: ContextOptions
|
||||
proxy:
|
||||
type: object?
|
||||
properties:
|
||||
server: string
|
||||
bypass: string?
|
||||
username: string?
|
||||
password: string?
|
||||
storageState:
|
||||
type: object?
|
||||
properties:
|
||||
cookies:
|
||||
type: array?
|
||||
items: SetNetworkCookie
|
||||
origins:
|
||||
type: array?
|
||||
items: SetOriginStorage
|
||||
returns:
|
||||
context: BrowserContext
|
||||
|
||||
disconnectFromReusedContext:
|
||||
internal: true
|
||||
parameters:
|
||||
reason: string
|
||||
|
||||
newBrowserCDPSession:
|
||||
title: Create CDP session
|
||||
group: configuration
|
||||
returns:
|
||||
session: CDPSession
|
||||
|
||||
startTracing:
|
||||
title: Start browser tracing
|
||||
group: configuration
|
||||
parameters:
|
||||
page: Page?
|
||||
screenshots: boolean?
|
||||
categories:
|
||||
type: array?
|
||||
items: string
|
||||
|
||||
stopTracing:
|
||||
title: Stop browser tracing
|
||||
group: configuration
|
||||
returns:
|
||||
artifact: Artifact
|
||||
|
||||
events:
|
||||
|
||||
context:
|
||||
parameters:
|
||||
context: BrowserContext
|
||||
|
||||
close:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
BrowserType:
|
||||
type: interface
|
||||
|
||||
initializer:
|
||||
executablePath: string
|
||||
name: string
|
||||
|
||||
commands:
|
||||
|
||||
launch:
|
||||
title: Launch browser
|
||||
parameters:
|
||||
$mixin: LaunchOptions
|
||||
slowMo: float?
|
||||
returns:
|
||||
browser: Browser
|
||||
|
||||
launchPersistentContext:
|
||||
title: Launch persistent context
|
||||
parameters:
|
||||
$mixin1: LaunchOptions
|
||||
$mixin2: ContextOptions
|
||||
userDataDir: string
|
||||
slowMo: float?
|
||||
returns:
|
||||
browser: Browser
|
||||
context: BrowserContext
|
||||
|
||||
connectOverCDP:
|
||||
title: Connect over CDP
|
||||
parameters:
|
||||
endpointURL: string
|
||||
headers:
|
||||
type: array?
|
||||
items: NameValue
|
||||
slowMo: float?
|
||||
timeout: float
|
||||
isLocal: boolean?
|
||||
noDefaults: boolean?
|
||||
returns:
|
||||
browser: Browser
|
||||
defaultContext: BrowserContext?
|
||||
|
||||
connectToWorker:
|
||||
title: Connect to worker
|
||||
parameters:
|
||||
endpoint: string
|
||||
timeout: float
|
||||
returns:
|
||||
worker: Worker
|
||||
@@ -0,0 +1,74 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Metadata:
|
||||
type: object
|
||||
properties:
|
||||
location:
|
||||
type: object?
|
||||
properties:
|
||||
file: string
|
||||
line: int?
|
||||
column: int?
|
||||
title: string?
|
||||
internal: boolean?
|
||||
# Test runner step id.
|
||||
stepId: string?
|
||||
|
||||
ClientSideCallMetadata:
|
||||
type: object
|
||||
properties:
|
||||
id: int
|
||||
stack:
|
||||
type: array?
|
||||
items: StackFrame
|
||||
|
||||
SDKLanguage:
|
||||
type: enum
|
||||
literals:
|
||||
- javascript
|
||||
- python
|
||||
- java
|
||||
- csharp
|
||||
|
||||
Disposable:
|
||||
type: interface
|
||||
|
||||
commands:
|
||||
|
||||
dispose:
|
||||
internal: true
|
||||
|
||||
EventTarget:
|
||||
type: interface
|
||||
|
||||
commands:
|
||||
waitForEventInfo:
|
||||
title: Wait for event "{info.event}"
|
||||
parameters:
|
||||
info:
|
||||
type: object
|
||||
properties:
|
||||
waitId: string
|
||||
phase:
|
||||
type: enum
|
||||
literals:
|
||||
- before
|
||||
- after
|
||||
- log
|
||||
event: string?
|
||||
message: string?
|
||||
error: string?
|
||||
flags:
|
||||
snapshot: true
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,157 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LocalUtils:
|
||||
type: interface
|
||||
|
||||
initializer:
|
||||
deviceDescriptors:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name: string
|
||||
descriptor:
|
||||
type: object
|
||||
properties:
|
||||
userAgent: string
|
||||
viewport:
|
||||
type: object
|
||||
properties:
|
||||
width: int
|
||||
height: int
|
||||
screen:
|
||||
type: object?
|
||||
properties:
|
||||
width: int
|
||||
height: int
|
||||
deviceScaleFactor: float
|
||||
isMobile: boolean
|
||||
hasTouch: boolean
|
||||
defaultBrowserType:
|
||||
type: enum
|
||||
literals:
|
||||
- chromium
|
||||
- firefox
|
||||
- webkit
|
||||
|
||||
commands:
|
||||
|
||||
zip:
|
||||
internal: true
|
||||
parameters:
|
||||
zipFile: string
|
||||
entries:
|
||||
type: array
|
||||
items: NameValue
|
||||
stacksId: string?
|
||||
mode:
|
||||
type: enum
|
||||
literals:
|
||||
- write
|
||||
- append
|
||||
includeSources: boolean
|
||||
additionalSources:
|
||||
type: array?
|
||||
items: string
|
||||
|
||||
harOpen:
|
||||
internal: true
|
||||
parameters:
|
||||
file: string
|
||||
returns:
|
||||
harId: string?
|
||||
error: string?
|
||||
|
||||
harLookup:
|
||||
internal: true
|
||||
parameters:
|
||||
harId: string
|
||||
url: string
|
||||
method: string
|
||||
headers:
|
||||
type: array
|
||||
items: NameValue
|
||||
postData: binary?
|
||||
isNavigationRequest: boolean
|
||||
returns:
|
||||
action:
|
||||
type: enum
|
||||
literals:
|
||||
- error
|
||||
- redirect
|
||||
- fulfill
|
||||
- noentry
|
||||
message: string?
|
||||
redirectURL: string?
|
||||
status: int?
|
||||
headers:
|
||||
type: array?
|
||||
items: NameValue
|
||||
body: binary?
|
||||
|
||||
harClose:
|
||||
internal: true
|
||||
parameters:
|
||||
harId: string
|
||||
|
||||
harUnzip:
|
||||
internal: true
|
||||
parameters:
|
||||
zipFile: string
|
||||
harFile: string
|
||||
resourcesDir: string?
|
||||
|
||||
connect:
|
||||
internal: true
|
||||
parameters:
|
||||
endpoint: string
|
||||
headers: json?
|
||||
exposeNetwork: string?
|
||||
slowMo: float?
|
||||
timeout: float
|
||||
socksProxyRedirectPortForTest: int?
|
||||
returns:
|
||||
pipe: JsonPipe
|
||||
headers:
|
||||
type: array
|
||||
items: NameValue
|
||||
|
||||
tracingStarted:
|
||||
internal: true
|
||||
parameters:
|
||||
tracesDir: string?
|
||||
traceName: string
|
||||
live: boolean?
|
||||
returns:
|
||||
stacksId: string
|
||||
|
||||
addStackToTracingNoReply:
|
||||
internal: true
|
||||
parameters:
|
||||
callData: ClientSideCallMetadata
|
||||
|
||||
traceDiscarded:
|
||||
internal: true
|
||||
parameters:
|
||||
stacksId: string
|
||||
|
||||
globToRegex:
|
||||
internal: true
|
||||
parameters:
|
||||
glob: string
|
||||
baseURL: string?
|
||||
webSocketUrl: boolean?
|
||||
returns:
|
||||
regex: string
|
||||
@@ -0,0 +1,220 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
ShowActionsOptions:
|
||||
type: mixin
|
||||
properties:
|
||||
duration: float?
|
||||
position:
|
||||
type: enum?
|
||||
literals:
|
||||
- top-left
|
||||
- top
|
||||
- top-right
|
||||
- bottom-left
|
||||
- bottom
|
||||
- bottom-right
|
||||
fontSize: int?
|
||||
|
||||
CommonScreenshotOptions:
|
||||
type: mixin
|
||||
properties:
|
||||
omitBackground: boolean?
|
||||
caret:
|
||||
type: enum?
|
||||
literals:
|
||||
- hide
|
||||
- initial
|
||||
animations:
|
||||
type: enum?
|
||||
literals:
|
||||
- disabled
|
||||
- allow
|
||||
scale:
|
||||
type: enum?
|
||||
literals:
|
||||
- css
|
||||
- device
|
||||
mask:
|
||||
type: array?
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
frame: Frame
|
||||
selector: string
|
||||
maskColor: string?
|
||||
style: string?
|
||||
|
||||
LaunchOptions:
|
||||
type: mixin
|
||||
properties:
|
||||
channel: string?
|
||||
executablePath: string?
|
||||
args:
|
||||
type: array?
|
||||
items: string
|
||||
ignoreAllDefaultArgs: boolean?
|
||||
ignoreDefaultArgs:
|
||||
type: array?
|
||||
items: string
|
||||
handleSIGINT: boolean?
|
||||
handleSIGTERM: boolean?
|
||||
handleSIGHUP: boolean?
|
||||
timeout: float
|
||||
env:
|
||||
type: array?
|
||||
items: NameValue
|
||||
headless: boolean?
|
||||
proxy:
|
||||
type: object?
|
||||
properties:
|
||||
server: string
|
||||
bypass: string?
|
||||
username: string?
|
||||
password: string?
|
||||
downloadsPath: string?
|
||||
tracesDir: string?
|
||||
artifactsDir: string?
|
||||
chromiumSandbox: boolean?
|
||||
firefoxUserPrefs: json?
|
||||
cdpPort: int?
|
||||
|
||||
ContextOptions:
|
||||
type: mixin
|
||||
properties:
|
||||
noDefaultViewport: boolean?
|
||||
viewport:
|
||||
type: object?
|
||||
properties:
|
||||
width: int
|
||||
height: int
|
||||
screen:
|
||||
type: object?
|
||||
properties:
|
||||
width: int
|
||||
height: int
|
||||
ignoreHTTPSErrors: boolean?
|
||||
clientCertificates:
|
||||
type: array?
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
origin: string
|
||||
cert: binary?
|
||||
key: binary?
|
||||
passphrase: string?
|
||||
pfx: binary?
|
||||
javaScriptEnabled: boolean?
|
||||
bypassCSP: boolean?
|
||||
userAgent: string?
|
||||
locale: string?
|
||||
timezoneId: string?
|
||||
geolocation:
|
||||
type: object?
|
||||
properties:
|
||||
longitude: float
|
||||
latitude: float
|
||||
accuracy: float?
|
||||
permissions:
|
||||
type: array?
|
||||
items: string
|
||||
extraHTTPHeaders:
|
||||
type: array?
|
||||
items: NameValue
|
||||
offline: boolean?
|
||||
httpCredentials:
|
||||
type: object?
|
||||
properties:
|
||||
username: string
|
||||
password: string
|
||||
origin: string?
|
||||
send:
|
||||
type: enum?
|
||||
literals:
|
||||
- always
|
||||
- unauthorized
|
||||
deviceScaleFactor: float?
|
||||
isMobile: boolean?
|
||||
hasTouch: boolean?
|
||||
colorScheme:
|
||||
type: enum?
|
||||
literals:
|
||||
- dark
|
||||
- light
|
||||
- no-preference
|
||||
- no-override
|
||||
reducedMotion:
|
||||
type: enum?
|
||||
literals:
|
||||
- reduce
|
||||
- no-preference
|
||||
- no-override
|
||||
forcedColors:
|
||||
type: enum?
|
||||
literals:
|
||||
- active
|
||||
- none
|
||||
- no-override
|
||||
acceptDownloads:
|
||||
type: enum?
|
||||
literals:
|
||||
- accept
|
||||
- deny
|
||||
- internal-browser-default
|
||||
contrast:
|
||||
type: enum?
|
||||
literals:
|
||||
- no-preference
|
||||
- more
|
||||
- no-override
|
||||
baseURL: string?
|
||||
recordVideo:
|
||||
type: object?
|
||||
properties:
|
||||
dir: string?
|
||||
size:
|
||||
type: object?
|
||||
properties:
|
||||
width: int
|
||||
height: int
|
||||
showActions:
|
||||
type: object?
|
||||
properties:
|
||||
$mixin: ShowActionsOptions
|
||||
strictSelectors: boolean?
|
||||
serviceWorkers:
|
||||
type: enum?
|
||||
literals:
|
||||
- allow
|
||||
- block
|
||||
selectorEngines:
|
||||
type: array?
|
||||
items: SelectorEngine
|
||||
testIdAttributeName: string?
|
||||
|
||||
ConsoleMessage:
|
||||
type: mixin
|
||||
properties:
|
||||
type: string
|
||||
text: string
|
||||
args:
|
||||
type: array
|
||||
items: JSHandle
|
||||
location:
|
||||
type: object
|
||||
properties:
|
||||
url: string
|
||||
lineNumber: int
|
||||
columnNumber: int
|
||||
timestamp: float
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,104 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
SerializedValue:
|
||||
type: object
|
||||
# Exactly one of the properties must be present.
|
||||
properties:
|
||||
n: float?
|
||||
b: boolean?
|
||||
s: string?
|
||||
v:
|
||||
type: enum?
|
||||
literals:
|
||||
- null
|
||||
- undefined
|
||||
- NaN
|
||||
- Infinity
|
||||
- -Infinity
|
||||
- "-0"
|
||||
# String representation of the Date.
|
||||
d: string?
|
||||
# String representation of the URL.
|
||||
u: string?
|
||||
# String representation of BigInt.
|
||||
bi: string?
|
||||
# Typed array.
|
||||
ta:
|
||||
type: object?
|
||||
properties:
|
||||
b: binary
|
||||
k:
|
||||
type: enum
|
||||
literals:
|
||||
- i8
|
||||
- ui8
|
||||
- ui8c
|
||||
- i16
|
||||
- ui16
|
||||
- i32
|
||||
- ui32
|
||||
- f32
|
||||
- f64
|
||||
- bi64
|
||||
- bui64
|
||||
# Serialized Error object.
|
||||
e:
|
||||
type: object?
|
||||
properties:
|
||||
m: string
|
||||
n: string
|
||||
s: string
|
||||
# Regular expression pattern and flags.
|
||||
r:
|
||||
type: object?
|
||||
properties:
|
||||
p: string
|
||||
f: string
|
||||
a:
|
||||
type: array?
|
||||
items: SerializedValue
|
||||
# Object with keys and values.
|
||||
o:
|
||||
type: array?
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
k: string
|
||||
v: SerializedValue
|
||||
# An index in the handles array from SerializedArgument.
|
||||
h: int?
|
||||
# Index of the object in value-type for circular reference resolution.
|
||||
id: int?
|
||||
# Ref to the object in value-type for circular reference resolution.
|
||||
ref: int?
|
||||
|
||||
SerializedArgument:
|
||||
type: object
|
||||
properties:
|
||||
value: SerializedValue
|
||||
handles:
|
||||
type: array
|
||||
items: Channel
|
||||
|
||||
SerializedError:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: object?
|
||||
properties:
|
||||
message: string
|
||||
name: string
|
||||
stack: string?
|
||||
value: SerializedValue?
|
||||
@@ -0,0 +1,53 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
StackFrame:
|
||||
type: object
|
||||
properties:
|
||||
file: string
|
||||
line: int
|
||||
column: int
|
||||
function: string?
|
||||
|
||||
Point:
|
||||
type: object
|
||||
properties:
|
||||
x: float
|
||||
y: float
|
||||
|
||||
Rect:
|
||||
type: object
|
||||
properties:
|
||||
x: float
|
||||
y: float
|
||||
width: float
|
||||
height: float
|
||||
|
||||
URLPattern:
|
||||
type: object
|
||||
properties:
|
||||
hash: string
|
||||
hostname: string
|
||||
password: string
|
||||
pathname: string
|
||||
port: string
|
||||
protocol: string
|
||||
search: string
|
||||
username: string
|
||||
|
||||
NameValue:
|
||||
type: object
|
||||
properties:
|
||||
name: string
|
||||
value: string
|
||||
@@ -0,0 +1,98 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Tracing:
|
||||
type: interface
|
||||
|
||||
commands:
|
||||
|
||||
tracingStart:
|
||||
title: Start tracing
|
||||
group: configuration
|
||||
parameters:
|
||||
name: string?
|
||||
snapshots: boolean?
|
||||
screenshots: boolean?
|
||||
live: boolean?
|
||||
|
||||
tracingStartChunk:
|
||||
title: Start tracing
|
||||
group: configuration
|
||||
parameters:
|
||||
name: string?
|
||||
title: string?
|
||||
returns:
|
||||
traceName: string
|
||||
|
||||
tracingGroup:
|
||||
title: Trace "{name}"
|
||||
parameters:
|
||||
name: string
|
||||
location:
|
||||
type: object?
|
||||
properties:
|
||||
file: string
|
||||
line: int?
|
||||
column: int?
|
||||
|
||||
tracingGroupEnd:
|
||||
title: Group end
|
||||
|
||||
tracingStopChunk:
|
||||
title: Stop tracing
|
||||
group: configuration
|
||||
parameters:
|
||||
mode:
|
||||
type: enum
|
||||
literals:
|
||||
- archive
|
||||
- discard
|
||||
- entries
|
||||
returns:
|
||||
# The artifact may be missing if the browser closes while tracing is being stopped.
|
||||
# Or it can be missing if client-side compression is taking place.
|
||||
artifact: Artifact?
|
||||
# For local mode, these are all entries.
|
||||
entries:
|
||||
type: array?
|
||||
items: NameValue
|
||||
|
||||
tracingStop:
|
||||
title: Stop tracing
|
||||
group: configuration
|
||||
|
||||
harStart:
|
||||
internal: true
|
||||
parameters:
|
||||
page: Page?
|
||||
options: RecordHarOptions
|
||||
returns:
|
||||
harId: string
|
||||
|
||||
harExport:
|
||||
internal: true
|
||||
parameters:
|
||||
harId: string?
|
||||
mode:
|
||||
type: enum
|
||||
literals:
|
||||
- archive
|
||||
- entries
|
||||
returns:
|
||||
# Present when mode is 'archive'.
|
||||
artifact: Artifact?
|
||||
# Present when mode is 'entries'.
|
||||
entries:
|
||||
type: array?
|
||||
items: NameValue
|
||||
@@ -0,0 +1,65 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Worker:
|
||||
type: interface
|
||||
|
||||
extends: EventTarget
|
||||
|
||||
initializer:
|
||||
url: string
|
||||
|
||||
commands:
|
||||
|
||||
disconnect:
|
||||
title: Disconnect from worker
|
||||
parameters:
|
||||
reason: string?
|
||||
flags:
|
||||
pausesBeforeAction: true
|
||||
|
||||
evaluateExpression:
|
||||
title: Evaluate
|
||||
parameters:
|
||||
expression: string
|
||||
isFunction: boolean?
|
||||
arg: SerializedArgument
|
||||
returns:
|
||||
value: SerializedValue
|
||||
|
||||
evaluateExpressionHandle:
|
||||
title: Evaluate
|
||||
parameters:
|
||||
expression: string
|
||||
isFunction: boolean?
|
||||
arg: SerializedArgument
|
||||
returns:
|
||||
handle: JSHandle
|
||||
|
||||
updateSubscription:
|
||||
internal: true
|
||||
parameters:
|
||||
event:
|
||||
type: enum
|
||||
literals:
|
||||
- console
|
||||
enabled: boolean
|
||||
|
||||
events:
|
||||
|
||||
console:
|
||||
parameters:
|
||||
$mixin: ConsoleMessage
|
||||
|
||||
close:
|
||||
Vendored
+2388
-2388
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ node ../../utils/pack_package.js playwright-core ./output/playwright-core.tgz
|
||||
|
||||
echo "Building api.json and protocol.yml"
|
||||
API_JSON_MODE=1 node ../../utils/doclint/generateApiJson.js > ./output/api.json
|
||||
cp ../../packages/protocol/src/protocol.yml ./output/
|
||||
node ../../utils/protocol_spec.js > ./output/protocol.yml
|
||||
|
||||
function build {
|
||||
NODE_DIR=$1
|
||||
|
||||
@@ -952,7 +952,7 @@ onChanges.push({
|
||||
// Generate channels.
|
||||
onChanges.push({
|
||||
inputs: [
|
||||
'packages/protocol/src/protocol.yml'
|
||||
'packages/protocol/spec/'
|
||||
],
|
||||
script: 'utils/generate_channels.js',
|
||||
});
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const yaml = require('yaml');
|
||||
|
||||
const channels = new Map();
|
||||
const mixins = new Map();
|
||||
@@ -184,8 +183,7 @@ const metainfo_ts = [
|
||||
|
||||
const methodMetainfo = [];
|
||||
|
||||
const yml = fs.readFileSync(path.join(__dirname, '..', 'packages', 'protocol', 'src', 'protocol.yml'), 'utf-8');
|
||||
const protocol = yaml.parse(yml);
|
||||
const protocol = require('./protocol_spec').loadProtocol();
|
||||
|
||||
function addScheme(name, s) {
|
||||
validator_ts.push(`scheme.${name} = ${s};`);
|
||||
@@ -210,9 +208,28 @@ for (const [name, item] of Object.entries(protocol)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Trait-cascade order: each `T extends FooChannel ?` must be tested before any
|
||||
// of its ancestors via `extends`. Sort interfaces children-first so the cascade
|
||||
// is correct regardless of how the spec files are ordered on disk.
|
||||
const interfaceEntries = Object.entries(protocol).filter(([, v]) => v.type === 'interface');
|
||||
const interfaceDepth = new Map();
|
||||
function depthOf(name) {
|
||||
if (interfaceDepth.has(name)) return interfaceDepth.get(name);
|
||||
const ancestor = protocol[name] && protocol[name].extends;
|
||||
const d = ancestor && protocol[ancestor] && protocol[ancestor].type === 'interface'
|
||||
? depthOf(ancestor) + 1 : 0;
|
||||
interfaceDepth.set(name, d);
|
||||
return d;
|
||||
}
|
||||
for (const [name] of interfaceEntries) depthOf(name);
|
||||
// Stable sort by descending depth — children before ancestors.
|
||||
const entriesInReverse = interfaceEntries
|
||||
.map((e, i) => ({ e, i }))
|
||||
.sort((a, b) => depthOf(b.e[0]) - depthOf(a.e[0]) || a.i - b.i)
|
||||
.map(x => x.e);
|
||||
|
||||
channels_ts.push(`// ----------- Initializer Traits -----------`);
|
||||
channels_ts.push(`export type InitializerTraits<T> =`);
|
||||
const entriesInReverse = Object.entries(protocol).reverse();
|
||||
for (const [name, item] of entriesInReverse) {
|
||||
if (item.type !== 'interface')
|
||||
continue;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const yaml = require('yaml');
|
||||
|
||||
const channels = new Set();
|
||||
const inherits = new Map();
|
||||
@@ -163,8 +162,7 @@ function objectType(props, indent, onlyOptional = false, parentName = '') {
|
||||
return { ts: `${indent}{${inner.ts}\n${indent}}`, scheme: `tObject({\n${inner.scheme}\n${indent}})` };
|
||||
}
|
||||
|
||||
const yml = fs.readFileSync(path.join(__dirname, '..', 'packages', 'protocol', 'src', 'protocol.yml'), 'utf-8');
|
||||
const protocol = yaml.parse(yml);
|
||||
const protocol = require('./protocol_spec').loadProtocol();
|
||||
|
||||
for (const [name, value] of Object.entries(protocol)) {
|
||||
if (value.type === 'interface') {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const yaml = require('yaml');
|
||||
|
||||
const specDir = path.join(__dirname, '..', 'packages', 'protocol', 'spec');
|
||||
|
||||
function loadSpecFiles() {
|
||||
return fs.readdirSync(specDir).filter(f => f.endsWith('.yml')).sort();
|
||||
}
|
||||
|
||||
function loadProtocol() {
|
||||
const files = loadSpecFiles();
|
||||
const protocol = {};
|
||||
for (const file of files) {
|
||||
const text = fs.readFileSync(path.join(specDir, file), 'utf-8');
|
||||
const doc = yaml.parse(text);
|
||||
if (!doc || typeof doc !== 'object')
|
||||
throw new Error(`packages/protocol/spec/${file} is empty or not a YAML map`);
|
||||
for (const [name, value] of Object.entries(doc)) {
|
||||
if (name in protocol)
|
||||
throw new Error(`Duplicate top-level definition "${name}" in packages/protocol/spec/${file}`);
|
||||
protocol[name] = value;
|
||||
}
|
||||
}
|
||||
return protocol;
|
||||
}
|
||||
|
||||
function loadProtocolYaml() {
|
||||
const files = loadSpecFiles();
|
||||
const parts = [];
|
||||
for (const file of files) {
|
||||
let text = fs.readFileSync(path.join(specDir, file), 'utf-8');
|
||||
if (!text.endsWith('\n'))
|
||||
text += '\n';
|
||||
parts.push(text);
|
||||
}
|
||||
return parts.join('\n');
|
||||
}
|
||||
|
||||
module.exports = { loadProtocol, loadProtocolYaml };
|
||||
|
||||
if (require.main === module) {
|
||||
process.stdout.write(loadProtocolYaml());
|
||||
}
|
||||
Reference in New Issue
Block a user