Headless protractor not sharding tests
Protractor headless testing on real Google Chrome browser is now possible since Chrome >= 57, Chromedriver >= 2.29 along some basic config:
capabilities: { browserName: 'chrome', chromeOptions: { args: ['headless', 'window-size=1920,1080'] }}
Another cool thing is that the window size is not limited to the current display. It is truly headless, meaning it can be as large as needed for the tests.
Some webdriver features won't work there. For instance:
browser.manage().window().setPosition();browser.manage().window().setSize();browser.manage().window().maximize();
You will have to identify and remove the unsupported features, other than that Google Chrome headless is working great for me.
It's important to note that for example sendKeys
might trigger this error:
Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb
If there was no real display or there was no Xvfb until this was fixed on the Chrome side. The X display required
error was fixed with ChromeDriver 2.31.