I'm running a Watir test using Ruby and Watir-Webdriver and the Headless gem.
Here is the code that sets up the Headless environment:
headless = Headless.new(dimensions: "1600x900x24")
If a test crashes, our test environment automatically captures a screen shot. I expected to see screen shots that were 1600x900, yet the images are about 1050 x 818 (+/- a few pixels), and the web pages themselves are scaled to fit in this area.
I changed the headless dimensions to 3200x1800x24, and my screen shot was 1585 x 1718. I changed the headless dimensions to 50x90x24 and the screen shot was 187 x 8, and in this case the entire web page was not visible.
Any explanation for this behavior? How do I set my headless screen to be 1600 x 900? I'm wondering if this is an issue with Xvfb, or the way Headless works with Xvfb, but I don't know much about how that works and the reading I did on Xvfb today didn't illuminate things for me.
It's less the screen shots that I care about and more the scaling of the page to fit the reduced dimensions of 1050 x 818. At that size, certain page elements for a test I am writing are wrapped on the screen and not clickable, which is causing the test to crash in the first place.