Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker + Rspec + Capybara - arguments[0] is undefined

I'm trying to get my specs working headlessly in docker - They run fine locally on my mac but when I run them inside the docker container I get this error (repeated multiple times)

Selenium::WebDriver::Error::JavascriptError:
   arguments[0] is undefined
 # [remote server] https://foobar.com/ line 68 > Function:1:1:in `anonymous'
 # [remote server] https://foobar.com/:68:20:in `handleEvaluateEvent'
 # ./spec/features/foo_spec.rb:15:in `block (2 levels) in <top (required)>

Xvfb is running: Xvfb :99.0 -screen 0 1366x768x16

I've also tried doing a xvfb-run rspec and got the same errors.

spec_helper.rb:

Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium

What's going on that this can't run inside docker?

like image 461
Josh Avatar asked Dec 06 '14 18:12

Josh


People also ask

Is it possible to set default ARGs in dockerfile only?

having a default for ARGs being defined in Dockerfile only (which would be the apt place as it allows one to use Dockerfiles without compose and keep defaults behavior consistent) The workaround given by @idetoile does not work for ARGs.

How to override ARG foo=1 from the dockerfile with empty string?

FOO= and FOO are not the same thing, if you want to override ARG FOO=1 from the Dockerfile with empty string, you can either put args: [ FOO= ] in the docker-compose.yml, or in the .env, so I don't see any issue here.

Does--build-ARG Foo= work with Docker engine?

However, your 3rd point is valid: indeed, docker engine treats --build-arg FOO as --build-arg FOO= if FOO is not defined in the docker build process environment. I understand your point about keeping the same behavior on both engine and compose. I'll open an issue in docker engine for that.


1 Answers

The reason for this error is this:

>> webdriver.execute_script("return typeof arguments[0]", "foo")
=> "undefined"

Apparently this is a bug with Firefox 35 and webdriver. There is an issue open for it - https://code.google.com/p/selenium/issues/detail?id=8390.

like image 150
Mathias Eurich Avatar answered Oct 14 '22 05:10

Mathias Eurich