I am trying to get travis to pass my feature specs, however with xvfb default settings, it runs with a smaller window. As the site uses responsive webdesign, it means it's viewing the page as if it were on mobile. My tests fail because of this.
I searched around and found various different ways to set up my .travis.yml
file, none of which work, but here is what I currently have:
.travis.yml
language: ruby
rvm:
- 2.3.0
addons:
postgresql: "9.4"
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
- "sleep 3"
before_script:
- cp config/database.yml.travis config/database.yml
- cp config/application.yml.example config/application.yml
- psql -c 'create database db_test;' -U postgres
script:
- bundle exec rake db:migrate
- bundle exec rake
Sample view code that has the responsive bit (in haml):
_view.haml
.row
.col-xs-12
%label
%span.visible-lg-inline Line {{question + 1}}:
%b
As you can see, the visible-lg
thing is what is borking things. The entire app uses visible-lg
/hidden-lg
classes in different spots so changing this isn't an option. Also it's bootstrapped.
Associated Travis error:
Failure/Error: expect(page).to have_content("Line 1: #{question}")
My specs pass locally, since Firefox loads up a standard sized window vs mobile-sized/small window. How do I change my .travis.yml
file to get it to respect the larger screen resolution I've set?
Another example Travis error:
Failure/Error: click_on 'Preview'
Capybara::ElementNotFound:
Unable to find link or button "Preview"
('Preview' exists but not in mobile mode)
I am using Ruby 2.3, Rails 4.2.5, and AngularJS