jest-playwright: Performance issue and websocket error
I just upgraded to version 1.0.0 and immediately noticed that my test suite takes much longer to run, now about 18 seconds when it finished in about 10 seconds before. My guess is there is something slow going on during startup because the first test result takes much longer to show up as done.
Even worse, every other time or so that I run my tests I get the following error during startup:
C:\path_to_project\node_modules\playwright-chromium\lib\server\chromium.js:211
session.queue.push(parsedMessage);
^
TypeError: Cannot read property 'push' of undefined
at WebSocket.<anonymous> (C:\path_to_project\node_modules\playwright-chromium\lib\server\chromium.js:211:27)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\path_to_project\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (C:\path_to_project\node_modules\ws\lib\receiver.js:422:14)
at Receiver.getData (C:\path_to_project\node_modules\ws\lib\receiver.js:352:17)
at Receiver.startLoop (C:\path_to_project\node_modules\ws\lib\receiver.js:138:22)
at Receiver._write (C:\path_to_project\node_modules\ws\lib\receiver.js:74:10)
at writeOrBuffer (_stream_writable.js:352:12)
at Receiver.Writable.write (_stream_writable.js:303:10)
This is not an error that I have seen before and when I revert to version 0.2.5 these issues go away.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (14 by maintainers)
@mmarkelov I can verify that the next version of jest-playwright-preset (currently 1.3.0-rc1) together with next version of playwright-chromium (1.2.0-next.1594082323189) solves the performance issue that @DavidZidar reported above (#158) as long as you use
launchType: 'LAUNCH'
. Also, the crash issue appears to be gone. When I run my tests (8 test suites / 58 tests) withlaunchType: 'PERSISTENT'
the behaviour is erratic. Only one of 5+ testruns finished successfully. The others were either hanging after the last testrun or crashing with the message A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown.. When I triedlaunchType: 'PERSISTENT'
with v1.2.1 I didn’t have any of these problems. Running withlaunchType: 'SERVER'
works fine but is very slow. BTW, I’m a colleague of @DavidZidar.Just tried upgrading to
playwright-chromium@next
and I can confirm the crashing issues I’ve had are gone! Great success.It is still running much slower than before though, but that’s not as bad as outright crashing.
@DavidZidar could you try to use the
@next
versions of Playwright? These are the bleeding edge versions, it seems like it’s already fixed upstream. So justyarn add playwright-chromium@next
in the case with the reproducible.Before with 1.1.1: 3/5 runs failed After with
@next
0/5 runs failedYes, that’s right. I have a harder time reproducing it on my home workstation though, but these are all the classic smells of a race condition.
You may be right. To be clear though the error doesn’t happen every time, I tried it again and had to run it four times in a row before the error happened this time.
@DavidZidar can you try 1.0.0-rc1 version? @mxschmitt if the issue will be reproduced in 1.0.0-rc1, that seems like something is wrong with reusing browser