Playwright does NOT have the ability to intercept and change websockets (there is an open issue though), you can spy on messages but not change them "look but don't touch"
mock service workers does have beta support for websockets I'm a little over using beta code though haha.
We could add a tiny bit of logic into engineConnection that knows to change a healthy export response to an unhealthy one when the right env-var is set. It means polluting our prod code with a single if statement for testing, but it would mean one less dependency and would be flexible for us.
as a part of fixing https://github.com/KittyCAD/modeling-app/issues/3203
I had to use a branch of engine that sent an error on every export websocket command: https://github.com/KittyCAD/engine/tree/jess/engine-fail-every-export-for-testing
we likely want websocket mocks to trigger this from javascript tests
will leave that to someone else, but hopefully this gets done before we break it again, le sigh
pr that had fix: https://github.com/KittyCAD/modeling-app/pull/3256