oliyh / kamera

UI testing via image comparison and devcards
89 stars 7 forks source link

:resize-to-contents seems to have no effect #29

Closed jleonard-r7 closed 3 years ago

jleonard-r7 commented 3 years ago

I have the following settings in my config:

                            :resize-to-contents {:height? true :width? true}

yet the screenshots that exceed one page in size are all cutoff in the vertical direction.

jleonard-r7 commented 3 years ago

This seems to be the culprit: https://github.com/oliyh/kamera/blob/master/src/clj/kamera/core.clj#L170

It is always returning 1600x900 on my tests regardless of the size of the actual content.

oliyh commented 3 years ago

Hi,

Thanks for reporting this. If you run the equivalent JavaScript in your browser what dimensions does it give?

The resizing is really just a workaround because a screenshot will only capture the area determined by the dimensions of the browser, not of the page. The way it currently does it is the best I could come up with, so definitely open to trying to improve this if there is a more consistent way of discovering the true dimensions of what is on the screen (I wonder if it's possible to measure scroll height to the bottom of the page?)

jleonard-r7 commented 3 years ago

What would the equivalent JavaScript be? I wasn't able to find any mapping/bridge between Chrome Devtools Protocol and the actual Chrome Devtools Console.

oliyh commented 3 years ago

This is in 0.1.4-SNAPSHOT and I will do a release soon. Thanks for your contribution!