Since Chrome canary builds aren't available on linux platforms, we'll either have to use a nightly Chromium PPA (which is basically the same, sans PDF/Flash/FFMpeg support) or wait for Chrome 59 to release (Chrome 57 is the latest stable version as of Apr 12, 2017)
Unfortunately it's not as simple as just telling Capybara "use Chrome now". It needs a driver, which AFAIK doesn't exist yet, but I'm sure is being worked on somewhere.
Yeah, I suggested possibly looking into the selenium driver in the issue description... Ideally though, somebody will develop something more tailored to Chrome.
There's this bug currently being worked on in the chromium issue tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=604324, which covers the use of drivers for selenium, so probably this work might lead to the much needed drivers for capybara?
It looks like selenium webdriver's chrome driver works with it I suppose it's in their interest to keep it compatible with chromedriver, but not sure if it actually uses chromedriver or what.
We need to transition from PhantomJS to headless Chrome with frontend performance monitoring too. I went with PhantomJS initially because headless Chrome was proving difficult to get working with Selenium. Maybe I need to look at that again. @mikegreiling Let me know if there's any way I can be helpful on this.
One thing to note is that this solution is indeed using Selenium. This means that it needs a chrome webdriver. Current version of chrome webdriver 2.29 does not support Chrome 59 yet (however it works quite well in GitLab QA case).
I suppose that it might be a good idea to wait for next version of chrome driver that will support more headless-things. Currently it still needs xvfb so it probably does not fully support headless browser and could be faster.
Can I use this with Selenium / WebDriver / ChromeDriver?
Right now, Selenium opens a full instance of Chrome. In other words, it's an automated solution but not completely headless. However, Selenium could use --headless in the future.
If you want to bleed on the edge, I recommend Running Selenium with Headless Chrome to set things up yourself.
Note: you may encounter bugs using ChromeDriver. At the time of writing, the latest release (2.29) only supports Chrome 58. Headless Chrome requires Chrome 59 or later.
Once Chrome 59 gets out of beta on June 6th we can add the latest stable version to our CI docker image and go from there. Hopefully the drivers will update quickly.
As I understand it, headless Chrome already works with Karma, so we should at least be able to start running our frontend tests with it out of the gate.
Also, to share the excitement that Chrome 59 is out so Headless Chrome is in stable.
Currently, we're looking closely at https://packagist.org/packages/dmore/chrome-mink-driver and at the present it appears that it is fundamentally different than the php-webdriver we were using. And that the current conventional wisdom is to try to figure out how to use selenium + Headless Chrome.
Most of the trigger('click') statements were workarounds for poor PhantomJS page rendering anyway, so reverting them to a simple .click will probably work in most cases.
It seems that the main problem right now is that most of our feature specs are failing (e.g. https://gitlab.com/gitlab-org/gitlab-ce/builds/18895708) because of the error unknown error: an X display is required for keycode conversions, consider using Xvfb.
For GitLab QA, I see that @grzesiek runs xvfb. Is this what we want to do?
that's a shame because avoiding a virtual frame buffer like xvfb is pretty much the whole point of the --headless feature. should we try compiling chromium in the dockerfile ourselves with that use_ozone flag? seems like a lot of hassle...
For GitLab QA, I see that @grzesiek runs xvfb. Is this what we want to do?
@stanhu In GitLab QA we use xvfb only because back when I was implementing this solution, there was no chrome driver with support for v59 headless chrome yet. It appears that it is now available, since a few days, so I would vote for not using xvfb.
that's a shame because avoiding a virtual frame buffer like xvfb is pretty much the whole point of the --headless feature
I'm inclined to try option 3 and see how it performs. If the performance or resource requirements are unacceptable we probably ought to wait for an official fix.
@mikegreiling I agree that we should try option 3, to see how it works. I guess that this limitation is going to be resolved soon by upstream maintainers, but we can benefit from knowing how it performs with xvfb right now.
@grzesiek The WebDriver sendKeys problem is related to lines like following:
page.find('.filtered-search').send_keys(:enter)
this will not work without xvfb for some reason, and we use this type of method to fill out form fields and trigger keyboard events in a lot of places in our test suite.
Hey Folks, you might also be interested in https://github.com/joelgriffith/navalia (I'm the maintainer) as it's heavily geared towards integration/functional testing. I'd be happy to help work through any issues you might encounter.