Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Use case for hideElements #52

Closed
nathasm opened this issue Dec 4, 2019 · 7 comments · Fixed by #56
Closed

Use case for hideElements #52

nathasm opened this issue Dec 4, 2019 · 7 comments · Fixed by #56
Assignees
Labels

Comments

@nathasm
Copy link

nathasm commented Dec 4, 2019

I have a page that contains the following snippet:

<div id="infoGraphics">....</div>

Using chrome devtools:

document.querySelectorAll('div#infoGraphics').length
-> 1

In writing my test I have a getter in my page object like:

get infoGraphic() { return $('div#infoGraphics'); }

And my test:

browser.saveScreen('LoginPage', { hideElements: [ LoginPage.infoGraphic ] });

Which fails with:

Cannot set property 'visibility' of undefined

However, if I use the following, my test will work:

get infoGraphic() { return $$('div#infoGraphics'); }

Is this expected? Or have I misused the API?

@wswebcreation wswebcreation self-assigned this Dec 8, 2019
@wswebcreation
Copy link
Owner

Hi @nathasm

That is strange, I'll take a look, but it should work. Let me get back to this

@wswebcreation
Copy link
Owner

wswebcreation commented Feb 26, 2020

Issue is in here

hideRemoveElements.hide.forEach(element => element.style.visibility = hideRemove ? 'hidden' : '');

Need to find some time and fix it

@wswebcreation
Copy link
Owner

@nathasm

I've release https://github.com/wswebcreation/wdio-image-comparison-service/releases/tag/v1.12.1, can you please check again?

@wswebcreation wswebcreation reopened this Mar 1, 2020
@wswebcreation
Copy link
Owner

@nathasm

Did you already had time to check it again? I think it might be fixed now.

@Christopher-Hayes
Copy link

I'm having the same issue with multiple classes $('.classA.classB'). I'm gonna try upgrading to v1.12.1 (v1.9.0 right now) and report back if that issue is fixed.

Somewhat related, could we make this fail gracefully by still taking the screenshot? I have elements that only exist on certain pages and the library not finding one of the remove elements causes the screenshot to never be taken. For now I create a removeElements array by first checking isDisplayed() before passing that to the saveFullPageScreen() function.

LMK if this ^ is a possibility, I can go ahead and make that into a separate ticket.

@wswebcreation
Copy link
Owner

@Christopher-Hayes

Good suggestion, please make a separate ticket for it

@wswebcreation
Copy link
Owner

Closing this issue because I believe it is fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants