I’ve been extending an automation suite that will be used to run UI tests on the platform in several environments to help us verify the build and highlight any breaking changes early.
Running these tests will also free us up to concentrate on tests that weren’t covered by automation and exploratory tests.
This particular suite is written in Ruby with Capybara and RSpec. This was a the first time that I had used Ruby to write an automation framework so it took a bit of time to get used to. Some of the issues that I was coming up against were annoying as I knew they were easily solvable in Selenium using C# but I persisted and eventually overcame them.
I had most of the high priority tests passing apart from one. When Googling the answer, the only thing that I was coming up with was that the window size wasn’t big enough. This was annoying me because I had passed the Chrome Options parameter of “start-maximized” and, when not running in headless mode, the Chrome window was indeed maximised.
After a long day of searching and testing alternatives, I finally came across this post. So in fact, the issue was only occurring in headless mode because when running tests in this mode, despite setting the browser to start maximized using the Chrome Options, it defaults to 800×600. So, I then set the Chrome Options window-size parameter to “1980,1080” to override this. And voila! The test passed in headless mode.
So, I would suggest if you want to run your tests in headless mode that you also pass in a specific size for the window so you don’t get caught by this too.