I'm trying to put the free software where I'm one of the collaborators to run the acceptance tests on Travis. Everything went very well except for the acceptance tests with selenium.
And this is a difficult issue because the software uses only the gem versions avaiable on Debian 6. So, everything is really outdated.
Being more specific, just the steps where I'm looking for some text on the screen, with the step:
page.should have_content(text)
I've already tried to:
to add some waiting since it could be looking for the element before it was rendered;
update the xpath;
remove the webrat, because I've read that it could be conclicting with capybara;
run the tests locally with xvfb;
create a VM with Ubuntu Server 12.04 32 bits (Travis version), install everything and run the tests on xvfb;
update Capybara from 1.1.1 to 1.1.4.
But the problem persists:
# features/step_definitions/web_steps.rb:107
Unable to find xpath "/html" (Capybara::ElementNotFound)
(eval):2:in `send'
(eval):2:in `text'
./features/step_definitions/web_steps.rb:110
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:108:in `/^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/'
plugins/mezuro/features/repository.feature:101:in `And I should see "My Name"'
Here is the link for the build:
https://travis-ci.org/rafamanzo/mezuro-travis/builds/6231714
Anyone have any idea? I'm afraid that it is related with the gem versions and I'll not be able to fix it by any means.
Here are links for what I was able to find about it on Google:
https://groups.google.com/forum/#!msg/ruby-capybara/PDr7sZ124Vw/qLXqHXs0XdMJ
https://github.com/rspec/rspec-rails/issues/406
Thank you very much!
Related
I have a Ruby on Rails app that runs feature tests using Capybara, Poltergeist and PhantomJS.
Version 2.0.0 of PhantomJS has a rather significant bug that breaks a lot of tests (https://github.com/ariya/phantomjs/issues/12506) so I'd like to force the app to use a different version of PhantomJS when running the tests.
Is this possible from within Poltergeist's configuration, to raise an error or a warning if this buggy version is used, or is my best bet simply putting a note in the app's readme saying 'don't use version 2.0.0 due to this bug'?
at the moment my Capybara/Poltergeist configuration is very basic:
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, :timeout => 90)
end
As #pguardiario commented, you can just do something like
if `phantomjs -v`.start_with? '2'
#output whatever kind of warning you want
end
however the Poltergeist master branch has a fix for that particular issue so you could just try using that instead
I'm using capybara webkit on Ubuntu (14.04 LTS) and I'm getting the following error when trying to use it:
Capybara::Webkit::ConnectionError: /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/bin/webkit_server failed to start.
from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:75:in `parse_port'
from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:81:in `discover_port'
from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:62:in `start_server'
from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:25:in `initialize'
from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/driver.rb:17:in `new'
I installed QT using:
sudo apt-get install libqt4-dev libqtwebkit-dev libqt5webkit5-dev
Using gem versions: capybara (2.4.4) and capybara-webkit (1.3.1)
The same program works fine on mac (qt installed using homebrew)
Thanks
It has been a long time since this question was asked, but I had the same problem even though I used much more ancient versions of anything. It turned out that webkit needs to be able to connect to some X-Server and this is its reaction if it fails. I ended up installing xvfb and using
xvfb-run --auto-servernum bundle exec rake test
(aliased of course) when running my tests. This is probably less than optimal, but it was good enough for me. Maybe this helps the next person who stumbles across this error.
I beat my head against this all morning. Turns out I had omitted this code from rails_helper.rb :
if ENV['HEADLESS']
require 'headless'
headless = Headless.new
headless.start
at_exit { headless.stop }
end
We use the HEADLESS environment variable to trigger this. Not sure if that's typical or a local convention. Regardless, I needed to add export HEADLESS=1 to .env to fire that off.
I also had to add gem 'headless', '~> 1.0.2' in Gemfile.
I'm trying out casperJS to run some automated tests. On windows. I followed this installation guide but am stuck.
when I try to run a simple test from the command line like this:
casperjs.bat smoketest.js
I get the following error:
Error: Cannot find module 'C:/code/base/main/Shared/casperjs\modules\cli.js'
I checked, and the file cli.js does exist under the specified path.
I thought the problem could be the mixture of forward and backward slashes in the path, but I edited the bootstrap.js casper code to hard code the path and it made no difference - it still the cannot find module.
I'm have tried this using phantomJS version 1.9.0, and 1.8.2.
Anyone know what I am doing wrong?
Has anyone had success running casper on Windows?
This is due to a bug in PhantomJS 1.9.0 that does not allow for absolute path loading in Windows. Afaik, this should only be apparent if you are using a master build of CasperJS (v1.1).
This bug has been fixed, but is not yet in the Windows binary. You can compile it yourself if you'd like, but that can take quite a bit of time.
I was using the master build of casper. With the latest released version, 1.0.2, it works fine.
I've downloaded the executable and created a simlink to /usr/local/bin.
I'm under Mac OSX 10.7
When I then try to run a script that requires some module i.e.
var page = require('webpage').create();
I got an error
undefined:0 ReferenceError: Can't find variable: require
as if 'require' is not seen as a reserved word but interpreted as a variable symbol.
(As an aside, whenever I lunch phantomjs a Sencha Touch icon appears in my Dock)
Your copy of PhantomJS is from an older version. Always get the latest one from http://phantomjs.org.
I had this issue too, and the problem was my version of mocha -- going back to 1.9.0 fixed it.
SenchaTouch 2.0 installs PhantomJS 1.1 somewhere depending on the OS. Under *NIX check where with 'which phantomjs'.
Just modify your bash or whatever configuration file accordingly to remove the Phantomjs included with SenshaTouch from your PATH.
I have following gems in my Gemfile
gem 'steak'
gem 'capybara', '~>0.4.1'
When I run a test for single file there seems to be no problem however, if I run all the tests at once, I am getting Timeout::Error. Before timing out, the test hangs so I manually clicked a button and the error was Element not found in the cache. Is this some caching problem? I am also getting Selenium::WebDriver::Element#value is deprecated, please use Selenium::WebDriver::Element#attribute('value') warning when I run some of the tests. I hope the question is clear, if anything is required for answering please let me know.
Note: I had set up steak through steak-because-cucumber-is-for-vegerarians
yeah I found this, seems like selenium does not support firefox 4. seleniumhq.org I really hope this issue gets solved soon...