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

Support Elements objects ($$) as members of hideElements and removeElements arrays #12

Closed
treyturner opened this issue May 1, 2019 · 6 comments · Fixed by #34
Closed
Assignees

Comments

@treyturner
Copy link

It doesn't seem possible to pass Elements objects ($$) as members of the hideElements array. The following error is produced:

javascript error: Cannot set property 'visibility' of undefined

I ended up coming up with a workaround, but it might be more intuitive to allow this.

The ES6 workaround I discovered:

let result = browser.checkElement(timeline.strip, "Timeline strip", {
  hideElements: [].concat(...[
    timeline.controls.panel,
    timeline.ticks, // $$ object
    timeline.labels // $$ object
  ])
});

Thanks for your work on this by the way, it's immediately immensely useful as I can now scrap the v4 fork of my suite I was keeping alive just for visual regression.

@wswebcreation
Copy link
Owner

Hi @treyturner

Thanks for this issue, I now only support single elements, no element arrays. I need to check that one. It's a bug and a feature 😉

@Wexx
Copy link

Wexx commented Aug 12, 2019

I'm running into a similar issue. I get the

Cannot set property 'visibility' of undefined

error when I'm running saveFullPageScreen and checkFullPageScreen. Assigning this array to hideElements when I'm calling these.

['footerFormButton']

and a stack trace:

[chrome  windows nt #0-0] javascript error: Cannot set property 'visibility' of undefined
  (Session info: chrome=75.0.3770.142)
[chrome  windows nt #0-0] javascript error: javascript error: Cannot set property 'visibility' of undefined
[chrome  windows nt #0-0]   (Session info: chrome=75.0.3770.142)
[chrome  windows nt #0-0]     at getErrorFromResponseBody ([LOCALDIR]\node_modules\webdriver\build\utils.js:371:10)
[chrome  windows nt #0-0]     at Request._callback ([LOCALDIR]node_modules\webdriver\build\request.js:122:64)
[chrome  windows nt #0-0]     at Request.self.callback ([LOCALDIR]node_modules\request\request.js:185:22)
[chrome  windows nt #0-0]     at Request.<anonymous> ([LOCALDIR]node_modules\request\request.js:1161:10)
[chrome  windows nt #0-0]     at IncomingMessage.<anonymous> ([LOCALDIR]node_modules\request\request.js:1083:12)
[chrome  windows nt #0-0]     at Browser.runCommand ([LOCALDIR]node_modules\@wdio\sync\build\wrapCommand.js:31:24)
[chrome  windows nt #0-0]     at Browser.<anonymous> ([LOCALDIR]node_modules\@wdio\sync\build\wrapCommand.js:53:31)
[chrome  windows nt #0-0]     at Browser.execute ([LOCALDIR]node_modules\@wdio\runner\node_modules\webdriverio\build\commands\browser\execute.js:64:15)
[chrome  windows nt #0-0]     at Browser.runCommand ([LOCALDIR]node_modules\@wdio\sync\build\wrapCommand.js:37:32)
[chrome  windows nt #0-0]     at Object.<anonymous> ([LOCALDIR]node_modules\webdriver-image-comparison\build\helpers\beforeScreenshot.js:79:32)
[chrome  windows nt #0-0]     at step ([LOCALDIR]node_modules\webdriver-image-comparison\build\helpers\beforeScreenshot.js:43:23)
[chrome  windows nt #0-0]     at Object.next ([LOCALDIR]node_modules\webdriver-image-comparison\build\helpers\beforeScreenshot.js:24:53)
[chrome  windows nt #0-0]     at fulfilled ([LOCALDIR]node_modules\webdriver-image-comparison\build\helpers\beforeScreenshot.js:15:58)
[chrome  windows nt #0-0]     at Browser.checkFullPageScreen ([LOCALDIR]node_modules\@wdio\sync\build\wrapCommand.js:53:31)
[chrome  windows nt #0-0]     at Browser.next [as checkFullPageScreen] ([LOCALDIR]node_modules\webdriver\build\monad.js:175:27)
[chrome  windows nt #0-0]     at Context.it ([LOCALDIR]test\specs\visualRegression.js:36:40)
[chrome  windows nt #0-0]     at Promise ([LOCALDIR]node_modules\@wdio\sync\build\index.js:65:22)
[chrome  windows nt #0-0]     at Context.executeSync ([LOCALDIR]node_modules\@wdio\sync\build\index.js:63:10)
[chrome  windows nt #0-0]     at [LOCALDIR]node_modules\@wdio\sync\build\index.js:209:70

@wswebcreation
Copy link
Owner

@treyturner and @Wexx

I created a PR for this but my TypeScript skills are not at a ninja level. Hopefully you can take a take a look at it, see #34

@wswebcreation
Copy link
Owner

I've released a new version called https://github.com/wswebcreation/webdriver-image-comparison/releases/tag/v0.9.0

@iamkenos
Copy link

iamkenos commented Oct 4, 2019

Hey Wim! Thanks for your hard work on this!! Is my understanding correct that the wdio image compare service has to be updated and a new version of that to be released for wdio users to benefit from this release?

@wswebcreation
Copy link
Owner

Hi @iamkenos

Yes, I've released a new version, see https://github.com/wswebcreation/wdio-image-comparison-service/releases/tag/v1.6.0

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

Successfully merging a pull request may close this issue.

4 participants