playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] More granular support of what Playwright trace file can gather

Open mastrzyz opened this issue 2 years ago • 10 comments
trafficstars

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.

image

Anyway we can batch these? or report only the important console message events like Error?

It also looks like "JSHandle" is extremely verbose here :

image

mastrzyz avatar Feb 04 '23 00:02 mastrzyz

@mastrzyz Are you using JSHandles? We recommend locators instead.

Anyway, this is a valid feature request, leaving it for prioritization.

dgozman avatar Feb 04 '23 00:02 dgozman

@dgozman we very sparingly use JSHandles, that I know of.

the JSHandle looks to be from a console message? it looks like, image

mastrzyz avatar Feb 04 '23 00:02 mastrzyz

image

mastrzyz avatar Feb 04 '23 00:02 mastrzyz

@mastrzyz Could you share the trace file with us?

dgozman avatar Feb 06 '23 17:02 dgozman

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.

dgozman avatar Feb 06 '23 20:02 dgozman

Ideally, we would compress the trace format and make it save faster, probably by batching events.

dgozman avatar Feb 08 '23 17:02 dgozman

@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?

mastrzyz avatar Mar 06 '23 18:03 mastrzyz

Hey is there any workaround I can do for this while we wait for the mitigation?

mastrzyz avatar Apr 28 '23 17:04 mastrzyz

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:

mastrzyz avatar Apr 28 '23 23:04 mastrzyz

Any idea how we can mitigate this?

mastrzyz avatar May 12 '23 16:05 mastrzyz