Continuous Integration/Deployment for Rails on Gitlab
In this blog post, we will through the necessary steps to setup Gitlab in order
...
For further actions, you may consider blocking this person and/or reporting abuse
Since my Gemfile already had
gem "webdrivers"
for local running ofrails test:system
, I needed to change this to disable webdrivers so as to stop the "Failed to find Chrome binary" error:Hi Patrik,
When I print
/etc/hosts
inside a service and the main container, I get:So definitely, the
ip
of the main container is172.17.0.6
and it's referenced inside the service but with an other namecc27ba611b73
and it's the container ID. so I cannot find an easy way to fix your issue.May be you can create a issue in the repo,
gitlab
is opensource ;)The chrome is CPU intensive, using it side by side with rails server can make your system test flaky.
Have a good day
Hi, I followed this guide, but I am having problems with Chrome. When CI runs my tests, I get the following error:
Webdrivers::BrowserNotFound: Failed to find Chrome binary.
Any ideas why Chrome can't be found?
Hey,
I know that I have an issue with the latest selenium containers
Can you try with this one:
Hi,
I tried with that container version, but I'm still getting the same problem.
Are you sure that your system test is trying to connect with the remote chrome hosted inside the selenium container.
I think your issue is that the tests is trying to run in the local container and gets this error because there is no chrome installed in the build container.
Make sure that is used
My
application_system_test_case.rb
looks like this:And within the configure block of
config/environments/test.rb
I have:Hello Patrik, thankyou for your comment.
To solve your issue, I will proceed like this:
Find the hostname of the main container that run your rails app in gitlab CI, in the rest of this comment, I will refer to it as
[HOSTNAME]
setup a test domain with sub-domains using CNAME ( you can use route53 from aws for this) :
The result will be:
[HOSTNAME]
as the first result it will try to resolve[HOSTNAME]
a second time and will find theIP
because all services and the main container are linked together gitlab service aliasHope this help you
Merry Christmas
Hi, thanks for your post! It was very useful. However I'm struggling a bit to get the system tests running.
I don't know if I'm missing something, but I'm getting a lot of errors when initializing Chromedriver.
Did you include it in your docker image? Is there any script you're executing on the build phase to install chromedriver and it's dependencies?
Thanks again for a great post
Felipe
Hey Felipe,
I think the error that you are getting is when the system test is trying to connect to the chrome driver in the separated container and failed.
I think this can help you by updating this file
application_system_test_case.rb
Take attention to the code that fetch the
selenium_remote_url
from the env variableThanks! That did the trick.
Thank you for your comment, I updated the blog post.