Локально все тесты проходят гладко, только на Travis my Capybara не может найти никаких css или ссылок. У кого-нибудь когда-нибудь была такая проблема?
Я играл с travis.yml, изменил тайм-аут капибары, но ничто не имело никакого эффекта. Тесты моделей без капибары проходят на Travis.
Журналы Travis:
Capybara starting Puma...
* Version 4.3.3 , codename: Mysterious Traveller
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:39031
F HTML screenshot: /home/travis/build/xenos-ra/demomap/tmp/capybara/screenshot_2020-04-02-09-44-15.827.html
Image screenshot: /home/travis/build/xenos-ra/demomap/tmp/capybara/screenshot_2020-04-02-09-44-15.827.png
F HTML screenshot: /home/travis/build/xenos-ra/demomap/tmp/capybara/screenshot_2020-04-02-09-44-18.810.html
Failures:
1) User looks at map they click on a demo and see the show page returns share buttons
Failure/Error: assert_selector('.social-share-button')
Capybara::ExpectationNotMet:
expected to find css ".social-share-button" but there were no matches
.travis.yml
cache:
bundler: true
yarn: true
services:
- redis
before_install:
- sudo apt-get update
- sudo apt-get install google-chrome-stable
addons:
postgresql: '9.6'
before_script:
- psql -c 'create database demomap_test;' -U postgres
script:
- bundle exec rails db:migrate RAILS_ENV=test
- bundle exec rspec spec/models
Настройки капибары в rails_helper
options = Selenium::WebDriver::Chrome::Options.new(args: %w[no-sandbox headless disable-gpu window-size=1400,900])
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
Capybara::Screenshot.register_driver(:headless_chrome) do |driver, path|
driver.browser.save_screenshot(path)
end
Capybara.save_path = Rails.root.join('tmp/capybara')
Capybara.current_driver = :headless_chrome
Capybara.javascript_driver = :headless_chrome
Capybara::Screenshot.autosave_on_failure = true
Capybara.default_max_wait_time = 15