cli icon indicating copy to clipboard operation
cli copied to clipboard

percy snapshot should offer a dump option for debugging

Open mbr-sn opened this issue 1 year ago • 2 comments

One of the challenges we are currently facing with dynamic (JS-based) changes to our page DOM, is that we don't really know exactly what kind of DOM state is frozen and uploaded to percy.io Even the debug log does not provide this. So we need a lot of trial-and-error playing around with timeout values, beforeSnapshot Javascripts hacks, etc.

Suggested new feature for percy snapshot command: What would be really helpful in that case, would be a --dump directory option for the percy snapshot command. This option should cause percy to write a copy of the frozen DOM tree as a file to that folder, also including all the assets it identified during asset discovery phase. In other words a full 1-1 as-is copy of everything that percy uploads to the cloud for the screenshots to be taken.

mbr-sn avatar Jul 25 '23 10:07 mbr-sn

Hey @mbr-sn This is a very nice suggestion!

currently, you may intercept these requests and store them till we have support for this. these are the network call that runs behind the scenes.

https://github.com/percy/cli/blob/eb03b7e3104755b827981c7c882c49d9c118d5e5/packages/client/src/client.js#L294-L345

https://github.com/percy/cli/blob/eb03b7e3104755b827981c7c882c49d9c118d5e5/packages/client/src/client.js#L265-L291

itsjwala avatar Jul 25 '23 12:07 itsjwala

Since there can be multiple items in the snapshot.yml, the --dump option should just take the "name:" value of each item, and create a subfolder underneath the main dump directory, and in that folder store the DOM file and all related assets. :-)

mbr-sn avatar Jul 25 '23 13:07 mbr-sn