Questions tagged [capybara]

Capybara is a web application testing framework for Rack applications, such as Rails, Sinatra and Merb.

Capybara aims to simplify the process of integration testing Rack applications, such as Rails, Sinatra or Merb. Capybara simulates how a real user would interact with a web application. It is agnostic about the driver running your tests and currently comes bundled with rack-test, Culerity, Celerity and Selenium support built in.

A complete reference is available at rubydoc.info.
A great capybara cheat sheet is available here.

5916 questions
2
votes
1 answer

Capybara: Adding js: true to feature spec causes FrozenError: Can't modify frozen string

ruby '~> 2.6.1' rails 5.2.3 I have a feature spec that requires executing some javascript in order to populate a an alt field of a datepicker. the spec: require 'rails_helper' Capybara.default_driver = :selenium Capybara.javascript_driver =…
Mike Ray
  • 91
  • 2
  • 10
2
votes
0 answers

How to fix 'unable to connect to chromedriver'

I create one capybara test. It works on local machine but at bitbucket pipeline not. I set port Capybara.server_port = 9516 but then the capybara test tries to connect to 9516.  1) Visit back office The admin can sign in…
2
votes
0 answers

ActionController::InvalidAuthenticityToken on Capybara with RSpec test

One of my RSpec tests is throwing an ActionController::InvalidAuthenticityToken error when clicking on a button to send an email. I have tried adding: skip_before_action :verify_authenticity_token, only: [:email_expiration2] if Rails.env.test? in…
2
votes
2 answers

Capybara selenium_chrome going to example.com instead of localhost

I am setting up Cucumber tests in a Rails project. Everything works fine when I use the default driver; but, when I try to use the :selenium_chrome driver, the browser tries to load example.com instead of the local Rails server. Any idea what I'm…
Zack
  • 6,232
  • 8
  • 38
  • 68
2
votes
1 answer

Selenium::WebDriver::Error::ElementNotVisibleError: element not interactable jenkins

logs: Organization flow Successfull case Organization should be created successfully. Failure/Error: find('#submit_requirements_crawl_type_1', visible: false).click Selenium::WebDriver::Error::ElementNotVisibleError: element not…
2
votes
0 answers

How to test user features using Authlogic_RPX and Steak?

I'm trying to test features of my Rails 3 app for which a user should be signed in. I use authlogic_rpx for authenticating users through Facebook and Twitter, but I don't want to test that process. What I am looking for is to programmatically create…
martini-bonanza
  • 1,515
  • 3
  • 18
  • 33
2
votes
2 answers

Ruby - Capybara recording test execution videos

I am trying to record and save in a video format my execution tests using Capybara. My tests are passing however I'm getting several errors in my Mac terminal. Also the videos are not being recorded/saved. SPEC_HELPER.RB require 'capybara' require…
drkvader
  • 163
  • 2
  • 12
2
votes
0 answers

Capybara/Selenium/Cucumber is not running javascript on document ready

I'm trying to write some integration tests for my Rails app using Cucumber, with Capybara. The main page of my application, however,d oes not load with any data in it - as soon as the page is loaded, it triggers a javascript that retrieves the data…
jasonpgignac
  • 2,296
  • 2
  • 19
  • 26
2
votes
0 answers

How to correctly configure Rails system tests with Rspec + Capybara and a dockerized Selenium Standalone Chrome?

I'm setting up CI with a Gitlab Runner for a Rails App with Rspec + Capybara and a dockerized image of selenium/standalone-chrome:3.4.0. The tests pass locally, but once they hit CI system tests fail with the error…
2
votes
1 answer

Rspec and Capybara object matching

Using Rails 3.0.5, RSpec 2 and Capybara 0.4.1.2 and I'am trying to write a controller spec for my SessionsController#new action. it "assigns the empty session to a variable" do get :new assigns(:session).should ==…
Cimm
  • 4,653
  • 8
  • 40
  • 66
2
votes
3 answers

Rspec and Chrome/headless flag

I've got headless Chrome and Chrome working for my Rspec tests. I want a flag to switch between the two so I can see the tests happen when I want and hide them when I don't. How can I implement something like: rspec --headless Right now I just have…
t56k
  • 6,769
  • 9
  • 52
  • 115
2
votes
1 answer

What problems does Steak gem solve?

I have few integration tests in Capybara+RSpec for a Rails project. Today I encountered Steak gem that meant to be pure Ruby alternative to Cucumber. Though at first glance I don't see any value in either of them. For me it looks like Steak renames…
Alexey
  • 9,197
  • 5
  • 64
  • 76
2
votes
1 answer

Capybara expect *no* alert

Using Capybara, is there a way to expect there to be no alert on the page? I'm thinking something along the lines of: click_link('some link') expect(page).to have_no_alert Or something along those lines.
lobati
  • 9,284
  • 5
  • 40
  • 61
2
votes
0 answers

Capybara selecting root node rather than specified node

When running locally, the code works as expected, but when running on CI server (circle CI) it behaves strangely. I call the #find method passing in a css selector, this normally returns the specific DOM node or throws an error. card =…
Shiyason
  • 759
  • 7
  • 16
2
votes
1 answer

Akephalos: How to ignore SSL warnings?

I'm trying to set up Akephalos for use with Capybara. I ran into this message when trying to visit the page I am trying to test: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated (NativeException) (druby://127.0.0.1:35580)…
Andrew
  • 227,796
  • 193
  • 515
  • 708