Closed skitterm closed 3 months ago
Coverage variation | Diff coverage |
---|---|
:white_check_mark: -0.94% (target: -1.00%) | :white_check_mark: 92.00% (target: 80.00%) |
:rocket: Don’t miss a bit, follow what’s new on Codacy.
Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more
@tevanoff this is ready for your QA now! I'm just writing up a few more tests in the meantime, then it'll be ready for your re-review as well.
@tevanoff I've simplified the takeSnapshot
tests to take in a mocked page
, and it's much smaller now. I may try to put in a couple more tests tomorrow morning in makeTest
(just making sure we're still deleting chromaticSnapshots
entries if the test fails or throws errors, for example), but those should just be following the pattern of the tests already here!
Issue: #AP-4453
What Changed
We now use our custom object (instead of Playwright's
testInfo.attachments
) to store the snapshotted DOM. This is so this DOM won't be captured in reporters, which has caused out-of-memory issues in the JSON reporter, for example.Before
When
takeSnapshot()
was called (either automatically at the end of the test, or manually by the user in their spec file), we'd call Playwright'stestInfo.attach()
to store the DOM snapshot as an attachment. This way we were able to access the snapshots later when writing them to disk.However, this meant that the DOM snapshots (typically very large in size) were now being included in Playwright's reporters. For the JSON reporter, this ballooned the size of the reporter's output file to the point where Playwright was unable to generated the report file (Playwright still finished running the tests).
Now
Instead of putting the DOM snapshots on Playwright's
testInfo
object as attachments, we write them to our own in-memory object (chromaticSnapshots
), with each test's snapshot(s) being written based on the test's ID. We then read fromchromaticSnapshots
to get the DOM snapshots to write to disk.We also delete the snapshots off the
chromaticSnapshots
object after the test has completed to avoid that object getting massive.This avoids the DOM snapshots getting written to the Playwright reporters.
How to test
UI Tests: playwright-e2e
PR status check) are unchanged