eWert-Online / OSnap

OSnap is a snapshot testing tool, which mainly focuses on speed and ease of use.

Home Page:https://ewert-online.github.io/OSnap/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignore selector doesn't work when element is outside of standard viewport (fullscreen = true)

kevin-j-morse opened this issue · comments

If fullScreen mode is turned on and there is an element outside the standard viewport (example: at the bottom of a long page) then the ignore based on selector feature does not seem to work.

After moving the same element to the top of the page (within the standard viewport size) the ignore by selector works.

I think the problem must be with DOM.getContentQuads

If I am correct, you could use Runtime.evaluate to call the JavaScript function getBoundingClientRect which seems to handle elements outside the viewport without issue.

Thank you for reporting this 🙂

If I am correct, you could use Runtime.evaluate to call the JavaScript function getBoundingClientRect which seems to handle elements outside the viewport without issue.

This sounds reasonable. Another option would be to scroll the element into view first. (https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-scrollIntoViewIfNeeded)
My guess is, that this would be faster, as we don't have to invoke a JS function.

If you want (and feel able to) you could submit a PR for this.

Would scrolling into view screw up the reported position at all? I guess the easiest option is just to try it.

Re: Opening a PR, I had never heard of Reason until yesterday but I'll see what I can do... I'm an old school Apache, PHP, MySQL kinda guy...

@kevin-j-morse
I tried to reproduce the issue, but I couldn't.
I am testing the cypress.io site, which has a slider on the bottom of the page, listing some users.

Ignoring seems to work fine:

Ignored Section

screenshot

Complete Diff

cypress_320x180

Are you sure, that you are not ignoring the wrong element on the page?
The way the selectors work is, that only the first matching element is ignored. So if you are ignoring a class, it would only ignore the first element it finds in the DOM with that class.

I am closing this for now. Feel free to reopen, if you have more info 🙂