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
2 answers

Using Cucumber to test RubyCAS-Client

I have a very small freshly made Rails 3 application. I am using the RubyCAS-Client gem for Rails to authenticate against our CAS server. The CAS client is working as I am able to log into and out of my web application. Here is my Gemfile: source…
hernan43
  • 805
  • 1
  • 8
  • 18
2
votes
1 answer

Integration test losing signed in user after redirect

I'm using devise to handle the authentication process. I am now developing integration tests for my application, starting with the sign in process. RSpec.describe 'sign in', type: :feature, js: true do let!(:user) { create(:user)} scenario…
mauriciomta
  • 47
  • 1
  • 5
2
votes
1 answer

Rails test fails requests did not finish in 60 seconds

After upgrading rails from 4.2 to 5.2 my test gets stuck on a request while it is working in development server I'm getting following failure on running test suit. Failures: 1) cold end overview shows cold end stats Failure/Error:…
2
votes
3 answers

Capybara with Selenium and remote Chrome - how to attach file for upload?

My scenario is the clicking icon on the site opens file browser. Is it possible to attach image to that opened file browser window in spec. My config is Docker, Capybara, Selenium driver. I'm testing on both headless and non-headless browser…
Artur79
  • 12,705
  • 1
  • 22
  • 22
2
votes
1 answer

Capybara with Rails: how to find ONLY invisible elements

I am using Capybara(capybara 3.1.0) for system tests in Rails project(Rails 5.2.0). What is the way to ensure element is not visible. I was using the visible: false option until I just found it matches visible elements, too. For example I…
Jeni
  • 1,088
  • 12
  • 30
2
votes
2 answers

Capybara How to use within_frame for the only iframe in the page without id

I have an in the the page that I need to test with Cucumber and Capybara, the iframe does not have a class or id attribute but it's the only iframe on the DOM. How can I use the within_frame capybara method?
juliangonzalez
  • 4,231
  • 2
  • 37
  • 47
2
votes
0 answers

Undefined method `aasm_state' for model Order Did you mean? aasm_state=

Rspec-rails tests started to fail after adding Aasm gem. All basic set ups are done. Migration with adding aasm_state column. Adding state to the Order model. Test log: Searching book Visitor searches books by title Failure/Error: order =…
StanisLove Sid
  • 322
  • 3
  • 9
2
votes
1 answer

Rails project, while testing with capybara: ArgumentError: Unused parameters passed to Capybara::Queries::SelectorQuery : [4]

Test that the form has 4 inputs is not working, I am copy pasting the line from the documentation: assert_select "form input", 4 any ideas? require "application_system_test_case" class QuestionsTest < ApplicationSystemTestCase test "visiting…
AlbertMunichMar
  • 1,680
  • 5
  • 25
  • 49
2
votes
1 answer

Capybara and text-overflow: ellipsis

For an element I have "text-overflow:ellipsis" css property set. And I'd like to test that it works :) using Capybara. E.g. I'd like to check that the end of my long text is hidden. Example html:
Some long long long long long long…
Jeni
  • 1,088
  • 12
  • 30
2
votes
1 answer

How to ensure background jobs run in integration tests?

I've got a integration test that is run through capybara. It visits a webpage, creates an object, and renders the results. When the object is created, the controller enqueues several jobs that create some related objects. When I run my integration…
cgat
  • 3,689
  • 4
  • 24
  • 38
2
votes
3 answers

Switch off Capybara::ElementNotFound / avoid nested rescue

I've got an issue with a method shared across a wide number of integration tests. The problem is, I need to find one of two buttons, and have so far only come up with the following unwieldy syntax for avoiding Capybara's ElementNotFound…
SRack
  • 11,495
  • 5
  • 47
  • 60
2
votes
1 answer

Stubbing `session_id` in Rails Integration Tests

I have a question about Rails Integration Tests. I have this app that talks to this other internal app. The app makes a request to internal_app, and one of the params for that request involves the session_id, stored in the session cookie. For a…
mc92
  • 475
  • 5
  • 10
2
votes
1 answer

Stubbing a login for Google Oauth 2 with capybara automated testing

I am currently using Capybara to feature test an app in development at work. An issue I am running into is constantly logging in to the google oauth locks me out of my account for a while. Is there any way to stub a login to bypass the login process…
throwthedays
  • 149
  • 1
  • 9
2
votes
2 answers

Character encoding issue(broken characters) while getting screenshots on test automation

We have an automation project which is developed with selenium webdriver and ruby(capybara). We collect screenshots when test case fails. Screenshots are totally fine when we run cases on our local machines. But when we run them on remote machine,…
2
votes
0 answers

Rails + RSpec - Integration Testing (Recommendations)

I have a Vue app with a rails backend and I want to do some front-end/integration testing. I'm currently using vue-router and turbolinks on the front-end and RSpec for unit testing. I tried using Capybara but puma always give me a routing error…
jj008
  • 1,033
  • 3
  • 23
  • 48
1 2 3
99
100