Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
156307e3
Unverified
Commit
156307e3
authored
Mar 13, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Mar 13, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Show decoded binary WebSocket messages in traces (#91308)
parent
236a76dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
playwright.ts
test/lib/browsers/playwright.ts
+9
-7
No files found.
test/lib/browsers/playwright.ts
View file @
156307e3
...
@@ -318,15 +318,17 @@ export class Playwright<TCurrent = undefined> {
...
@@ -318,15 +318,17 @@ export class Playwright<TCurrent = undefined> {
}
}
page
.
on
(
'websocket'
,
(
ws
)
=>
{
page
.
on
(
'websocket'
,
(
ws
)
=>
{
const
decoder
=
tracePlaywright
?
new
TextDecoder
()
:
null
if
(
tracePlaywright
)
{
if
(
tracePlaywright
)
{
page
// We're just evaluating a string here so that it appears in Playwright
.
evaluate
(
`console.log('connected to ws at
${
ws
.
url
()}
')`
)
// traces.
.
catch
(()
=>
{})
// console.log spams CI logs. If you already have a browser open, you can
// see WebSocket messages in the network tab of dev tools.
// TODO: Revisit once https://github.com/microsoft/playwright/issues/10996 is resolved.
page
.
evaluate
(
`'connected to ws at
${
ws
.
url
()}
'`
).
catch
(()
=>
{})
ws
.
on
(
'close'
,
()
=>
ws
.
on
(
'close'
,
()
=>
page
page
.
evaluate
(
`'closed websocket
${
ws
.
url
()}
'`
).
catch
(()
=>
{})
.
evaluate
(
`console.log('closed websocket
${
ws
.
url
()}
')`
)
.
catch
(()
=>
{})
)
)
}
}
ws
.
on
(
'framereceived'
,
(
frame
)
=>
{
ws
.
on
(
'framereceived'
,
(
frame
)
=>
{
...
@@ -337,7 +339,7 @@ export class Playwright<TCurrent = undefined> {
...
@@ -337,7 +339,7 @@ export class Playwright<TCurrent = undefined> {
page
page
// Note that passing the payload as a an argument is 2 orders of magnitude more expensive in Playwright.
// Note that passing the payload as a an argument is 2 orders of magnitude more expensive in Playwright.
.
evaluate
(
.
evaluate
(
`
console.log('received ws message
${
JSON
.
stringify
(
payload
)}
')
`
`
'received ws message
${
JSON
.
stringify
(
typeof
payload
===
'string'
?
payload
:
decoder
!
.
decode
(
payload
))}
'
`
)
)
.
catch
(()
=>
{})
.
catch
(()
=>
{})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment