webdrivercss icon indicating copy to clipboard operation
webdrivercss copied to clipboard

1 mocha test fails due to wrong image height

Open brettle opened this issue 10 years ago • 3 comments

I'm trying to locally run the tests that accompany webdrivercss. So far I've done:

git clone [email protected]:webdriverio/webdrivercss.git
cd webdrivercss
npm install
npm install http-server
cd test/site
bower install
cd ../..
http-server -p 8080 &
mocha

All tests pass except one:

...
  65 passing (1m)
  1 failing

  1) WebdriverCSS captures desired parts of a website as screenshot with specific dimension should do a screenshot of a whole website if nothing specified should have the size of browser dimension:

      Uncaught AssertionError: expected 967 to equal 947
      + expected - actual

      +947
      -967

      at gm.<anonymous> (/home/brettle/git/webdrivercss/test/spec/imageCapturing.js:44:39)
      at gm.emit (events.js:98:17)
      at gm.<anonymous> (/home/brettle/git/webdrivercss/node_modules/gm/lib/getters.js:82:14)
      at cb (/home/brettle/git/webdrivercss/node_modules/gm/lib/command.js:301:16)
      at ChildProcess._spawn.proc.on.onExit (/home/brettle/git/webdrivercss/node_modules/gm/lib/command.js:283:9)
      at ChildProcess.emit (events.js:98:17)
      at maybeClose (child_process.js:766:16)
      at Socket.<anonymous> (child_process.js:979:11)
      at Socket.emit (events.js:95:17)
      at Pipe.close (net.js:466:12)

When I look at the test/spec/imageCapturing.js:44, I see:

                size.height.should.be.equal(documentHeight - 20);

where size.height is the height of the captured image. Why should that height be 20 pixels less than the document height? When I run the test as above it appears to be exactly equal to the document height, which is what I would naively expect. Thoughts?

FWIW, I'm running on Fedora 21.

brettle avatar May 18 '15 05:05 brettle

yeah this one is weird. The document height is not always the same for some reasons. I tried to fix it by applying that dirty - 20px hack but it didn't work out. I don't think it is a webdrivercss related problem and more one of my test setup. Therefor I gonna fix it next time I work on this project. Thanks for pointing that out. Will keep this issue as reminder.

christian-bromann avatar May 18 '15 10:05 christian-bromann

Could this be also related to the scrollbar issue in #93?

amitaibu avatar Jul 23 '15 14:07 amitaibu

probably yeah this one was weird. It passed on my machine (mac) but failed in travis.

christian-bromann avatar Jul 23 '15 15:07 christian-bromann