vaadin / testbench

Vaadin TestBench is a tool for automated user interface testing of Vaadin applications.
https://vaadin.com/testbench
Other
20 stars 22 forks source link

testbench screenCapture cmd captures part of image as black bar #404

Closed vaadin-bot closed 12 years ago

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


I am trying to use screenCapture cmd on Ubuntu linux 10.10 with Firefox 3.6.23. The testbench tests are running via a Hudson Job using the XVNC plugin. ( http://wiki.hudson-ci.org/display/HUDSON/Xvnc+Plugin ) and xvfb.

The total image size requested and captured by testbench is 1024x768. I'm noticing that the bottom 119 pixels of the image is a black bar, hiding the bottom part of the browser view port. The rest of the screen captures fine, including proper width of 1024.

I've configured Hudson xvnc plugin to use the following cmd : vncserver :$DISPLAY_NUMBER -geometry 1200x1024 -depth 24

I've tried a few smaller vncserver dimensions, and none seem to help.

Watching via a vncviewer when the tests are running reveals the browser opening and page loading as expected ( no black bar).

I've tried various testbench capture dimensions and all seem to have the same result, black bar on the bottom portion of the captured image.

I double-checked that the user-extensions.js was loaded properly in selenium-rc. I also looked in the selenium log at debug level. It appears the call to getDimensions returns the expected viewport and browser window sizes.

I'd really like to get rin of this black bar as there are important pieces of the screen I'd like to validate in that area.


Imported from https://dev.vaadin.com/ issue #7792

vaadin-bot commented 12 years ago

Originally by @Artur-


Could you attach an example screenshot that contains the black bar? Also make sure that the resolution is large enough so the full browser window is on screen and not covered by toolbars or other windows. Is the position of the window correct, i.e. upper left corner of the browser is captured and only the bottom part of the browser is captured as black?

vaadin-bot commented 12 years ago

Originally by @zch


I'm about to look into the problem and wanted to make sure that you've tested the newest TestBench custom build available at http://vaadin.com/custom-build

The latest custom build contains fixes for the browser measurements and might fix your problem, or at the very least provide more information as to what goes wrong.

vaadin-bot commented 12 years ago

Originally by @zch


Just to make sure: The screen shot contains nothing but the contents of the browser window along with a black bar at the bottom? The top left corner of the screen shot is exactly at the top left corner of the browser window? i.e. all contents are visible except for where the black bar is?

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Yes the screenshot contains only the browser viewport. The upper left corner matches the upper left corner of the real browser viewport as expected. I've already verified that the full browser window fits in the entire viewable desktop by monitoring the browser launching over vncviewer. The bottom 119 pixels are solid black.

I'm going to try the custom build shortly as you suggest. I was unaware of the 'custom-build' availability. I'll also see if I am allowed to attach a screenshot ( app under development ) if that doesn't work.

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Replying to Kronqvist:

I'm about to look into the problem and wanted to make sure that you've tested the newest TestBench custom build available at http://vaadin.com/custom-build

I get a 404 at http://vaadin.com/custom-build logged in with my pro account. How do I access it?

Update: Found it at https://vaadin.com/custom-builds

vaadin-bot commented 12 years ago

Originally by @zch


I'm having trouble reproducing the issue here… Could you provide a more detailed description of your setup? E.g. is everything (hudson, testbench hub, testbench rc) running on the same machine, or different machines, etc?

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Attachment added: selenium.log-testbench-2.4.2.custom.txt (131.6 KiB) 2.4.2.custom selenium.log

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


After trying 2.4.2.custom version from 20111012, now I do not even capture a screenshot. See the attached selenium log for exception:

21:45:05.205 ERROR [11] com.vaadin.testbench.commands.SetCanvasSizeCommand - Unable to detect browser dimensions
com.vaadin.testbench.commands.CanvasNotFoundException: Failed to find the correct coordinates of the canvas with dimensions 1024x768, an origin at -1,-1 was deemed incorrect
    at com.vaadin.testbench.commands.CommandUtil$CanvasPositionFinder.throwExceptionUnlessCorrect(CommandUtil.java:271)
    at com.vaadin.testbench.commands.CommandUtil$CanvasPositionFinder.find(CommandUtil.java:197)
    at com.vaadin.testbench.commands.CommandUtil.findCanvasPositionByScreenshot(CommandUtil.java:152)
    at com.vaadin.testbench.commands.CanvasSizeUtil.getBrowserDimensions(CanvasSizeUtil.java:34)
    at com.vaadin.testbench.commands.SetCanvasSizeCommand.execute(SetCanvasSizeCommand.java:76)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:452)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:412)
    at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:149)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
    at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

The browser window disappears very quickly now when resized to requested width. I will note that using 2.4.2.custom on my Mac OSX with same version of firefox, screen is captured correctly, as was 2.4.1, as long as I make sure my desktop is clear of all other application windows during the testrun.

Here are the contents of ~/.vnc/xstartup on the linux box:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

Also here is the log output from the vncserver session:


Xvnc Free Edition 4.1.1 - built Apr  9 2010 18:47:36
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc

Mon Oct 17 21:33:57 2011
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5911
 vncext:      created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
/home/gridslave/.vnc/xstartup: 12: x-window-manager: not found
vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Replying to Kronqvist:

I'm having trouble reproducing the issue here… Could you provide a more detailed description of your setup? E.g. is everything (hudson, testbench hub, testbench rc) running on the same machine, or different machines, etc?

The entire test execution runs on a hudson slave - where standalone testbench rc is launched, vncserver is launched ( via hudson xvnc plugin), browser is invoked ( firefox 3.6.23) , and tests are run, all within a single build job. No testbench hub, rather just standalone rc launched with ant like so ( where vaadin-testbench-internal-version was 2.4.2.custom):

<java className="org.openqa.selenium.server.SeleniumServer" dir="${project.build.directory}/testbench-rc"
   fork="true" spawn="true" maxmemory="400m" >
   <arg value="-port"/>
   <arg value="${selenium.rc.port}"/>
   <arg value="-log"/>
   <arg value="${project.build.directory}/testbench-rc/selenium.log"/>
   <arg value="-ensureCleanSession"/>
   <!--<arg value="-browserSideLog"/> -->
   <arg value="-userExtensions"/>
   <arg value="${project.build.directory}/testbench-rc/vaadin-testbench-${vaadin-testbench-internal-version}/grid/remote-control/user-extensions.js"/>
   <classpath>
   <pathelement path="${project.build.directory}/testbench-rc/vaadin-testbench-${vaadin-testbench-internal-version}/grid/remote-control/lib/selenium-grid-remote-control-standalone-vaadin-testbench-${vaadin-testbench-internal-version}.jar"/>
   <pathelement path="${project.build.directory}/testbench-rc/vaadin-testbench-${vaadin-testbench-internal-version}/grid/remote-control/lib/selenium-server-1.0.1.jar"/>
   </classpath>
   </java>
vaadin-bot commented 12 years ago

Originally by @zch


Replying to peter@…:

After trying 2.4.2.custom version from 20111012, now I do not even capture a screenshot. See the attached selenium log for exception:

Ok, if in any way at all possible, could you please send the screenshot that was generated in the errors directory when this error occurred? If you do not feel comfortable attaching it here, you can e-mail it to me at jonatan at vaadin.com. It should be a screen shot of the entire desktop with a white window, so I hope that doesn't contain any confidential information (and any such info you can censor before sending). The screen shot will allow me to fix that problem.

I'll try to reproduce the black-bar problem with the information you provided.

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Attachment added: AdminLoginLogout_failure__firefox.png (30.0 KiB) AdminLoginLogout_failure__firefox.png https://trac-attachments.vaadin.com/trac/7792/AdminLoginLogout_failure__firefox.png onfail screenshot when 2.4.2.custom was used

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


Attachment added: testbench-screenshot-black-bar-sample.png (63.8 KiB) testbench-screenshot-black-bar-sample.png https://trac-attachments.vaadin.com/trac/7792/testbench-screenshot-black-bar-sample.png sanitized black bar on bottom screenCapture sample using 2.4.1

vaadin-bot commented 12 years ago

Originally by @zch


There should be a new build on the custom builds page that fixes the window not found issue. Could you please try the new build?

vaadin-bot commented 12 years ago

Originally by peter@peterlynch.ca


The 2.4.2.custom build from 20111019 seems to fix all of my screenCapture issues - no more black bar and screen is captured as expected.

Thanks.