Skip to content

Instantly share code, notes, and snippets.

@cuongld2
Last active January 30, 2023 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongld2/8128ff32f8cee02d25ac706c7c420282 to your computer and use it in GitHub Desktop.
Save cuongld2/8128ff32f8cee02d25ac706c7c420282 to your computer and use it in GitHub Desktop.
Example code playwright : wait for the request to finish
test(`check websocket available`, async({}) => {
await new Promise<void>(done => {
const ws = new WebSocket(`${endpoint.WEBSOCKET_HOST}/example/check`,{
headers: {
Cookie: `token=${accessToken}`
}
});
ws.on('open', function open(){
ws.send("say something")
ws.terminate()
done()
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment