playwright
playwright copied to clipboard
[BUG] Playwright sometimes generates trace files that can't be opened
Playwright seems to generate some corrupted trace files at times that can't be opened in the Trace Viewer.
I can't quite figure out the pattern but have noticed at times the first failure trace can't be opened but later retry traces can be opened. Also it seems it may possibly be more related to flaky tests but not sure without more time.
System info
- Playwright Version: 1.33.0
- Operating System: Ubuntu 20
- Browser: Chromium
Sample Bad Trace Files
1a2ae58c7387c65d4f4f5519ddedf24fc201ed5e.zip
Steps
- Run tests via CI/CD
- Inspect traces of failed tests
Expected
Can open trace at https://trace.playwright.dev/
Actual
Could not load trace from 1a2ae58c7387c65d4f4f5519ddedf24fc201ed5e.zip. Make sure to upload a valid Playwright trace.
@thnk2wn These traces are indeed corrupted. Unfortunately, we are not sure how this happened, so any repro would be very helpful. Even if it only reproduces sometimes.
@dgozman This is an internal app and a private repo so I can't share them directly. Copying and redacting and setting up in new public repo(s) would likely be a lot of work but could consider that later.
In the mean time are there certain details I could provide that might help?
@thnk2wn Could you please try upgrading to @playwright/[email protected]
? There have been tracing changes between 1.33 and 1.34, so it might be that the issue has been already fixed?
@dgozman Thanks. Done. We're not getting any failing tests at the moment so I don't have any traces to look at. I can look at turning on trace for success later and testing but out on vacation for 10 days now.
Same Issue, I see this, updating playwright did not work
@17Amir17 Any chance you could share a repro that produces corrupted traces?
Closing as part of the triage process since it seemed stale. Please create a new issue with a detailed reproducible or feature request if you still face issues.
unable to open traces.zip file in playwright 1.39. my file is: data/a6c572a0814a8ad11aea084ffd7f3306eaf0c55d.zip.
Still getting this with version 1.40, is this a known issue? I try to upload the trace file and get the above error. I tried unzipping the trace file and same occurs
FYI but the trace file is generated by the Playwright lib (not playwright test):
await context.tracing.start({ screenshots: true, snapshots: true });
await context.tracing.stop({ path: 'test-results/traces/trace_'+scenarioName+'_'+timeStamp+'.zip' });
I was also getting corrupted trace zip files that couldn't be extracted and wouldn't load into the Playwright Trace viewer. It would only create valid zip files when debugging, likely because stepping through the code gave it time to write correctly.
It turned out I was incorrectly using the following NUnit TearDown
method without await
:
[TearDown]
public Task TearDown()
{
Context.Tracing.StopAsync(new TracingStopOptions
{
Path = $"traces/{DateTime.Now:yyyyMMdd_HHmmss.fff}.zip",
});
}
When I changed it to async, it works every time even when not debugging:
[TearDown]
public async Task TearDownAsync()
{
await Context.Tracing.StopAsync(new TracingStopOptions
{
Path = $"traces/{DateTime.Now:yyyyMMdd_HHmmss.fff}.zip",
});
}