playwright
playwright copied to clipboard
[Feature] More granular support of what Playwright trace file can gather
Currently seeing a problem with gathering a Playwright trace file for our tests.
We start our Playwright tracer with :
await this.playwrightWindow?.tracing.start({
screenshots: true,
snapshots: true,
sources: false,
});
and then ~4 minutes ( on average ) later we stop it
await tracingContext.stop({
path: traceDirectory,
}),
We are seeing that a lot of our tests are timing out from this, so we had to add a top level 45s timeout.
2023-02-01T19:19:34.1641975Z 🛑 Stopping Playwright UI Driver
2023-02-01T19:20:19.0624297Z 📩❌ Timed out trying to stop Playwright trace. (took longer than 45000ms)
2023-02-01T19:20:19.2285355Z 🛑 Stopped Playwright UI Driver
From my investigation, it looks like our product is VERY verbose in its console messages.

Anyway we can batch these? or report only the important console message events like Error?
It also looks like "JSHandle" is extremely verbose here :

@mastrzyz Are you using JSHandles? We recommend locators instead.
Anyway, this is a valid feature request, leaving it for prioritization.
@dgozman we very sparingly use JSHandles, that I know of.
the JSHandle looks to be from a console message? it looks like,


@mastrzyz Could you share the trace file with us?
Investigation notes: out of 16000 trace events, there are: 5000 Page.console events, 5000 ConsoleMessage.__create__ events and 5000 JSHandle.__create__ events, because each console message had a handle in it.
Ideally, we would compress the trace format and make it save faster, probably by batching events.
@dgozman Will this be funded work? ~50% of our tests are timing out from spending more than 60s on Playwright trace stopping.
Is there a workaround I can use?
Hey is there any workaround I can do for this while we wait for the mitigation?
The current problem we have is that stopping the playwright trace takes longer than 1 minute for some tests, I've seen it go upwards to 10 minutes.
We put a timeout on the stopTrace() method but doing that leads to unexpected results in the test ->
Error: ENOENT: no such file or directory, open 'D:\a\_work\1\a\test-results\.playwright-artifacts-0\traces\0f2e7512f19fc3d533830f0bceeaea45.trace'
Failed worker ran 10 tests:
Any idea how we can mitigate this?