Questions tagged [capybara]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Rails Capybara Minitest with selenium — session not persisted within test

I'm trying to get Capybara working with selenium-webdriver for the first time, with a legacy app. We have Capybara tests working that use rack_driver, but trying to implement Selenium has not worked ...
nimmolo's user avatar
  • 311
1 vote
0 answers
23 views

No route matches [GET] error in feature spec for update button routed to PUT

I'm writing a feature test for a Rails 7 application. I'm using RSpec, Capybara, and Capybara-Webkit. The feature I'm testing archives a record(a developer app) when the user clicks an 'Archive' ...
abron's user avatar
  • 25
0 votes
1 answer
18 views

cucumber spec test fail rails application

Below error got while execute cucumber spec in rails 5 application ReferenceError: jQuery is not defined (Selenium::WebDriver::Error::JavascriptError) @http://127.0.0.1:4000/:2:7 @http://127.0.0....
Uday Magdum's user avatar
1 vote
2 answers
169 views

Rails 7 / Capybara with Selenium-Webdrivers fails (unknown keyword: :capabilities)

I am struggling with updating selenium / webdrivers for my rails rspec system tests. I used to have the webdriver gem, now it's telling me I need to use selenium-webdriver. I have installed that gem, ...
tkhobbes's user avatar
  • 400
0 votes
1 answer
36 views

How to select an invisible radio button

I have the following erb <%= form_with model: @car, remote: true do |form| %> <%= form.radio_button :color, "red", style: "visibility: hidden" %> <% end %> I ...
Sig's user avatar
  • 5,544
0 votes
1 answer
31 views

How to test browser automation code with rspec

I'm working on a project that requires a lot of browser automation to retrieve data, populate forms, etc. I've used capybara and selenium in the past to do automated testing of websites, but I've ...
jerhinesmith's user avatar
  • 15.2k
0 votes
1 answer
35 views

How do I perform these actions with Capybara?

If possible, please let me know the different variations of how to do these two things, I would much appreciate it. I have tried FOR DAYS to do these things. edit - it is an hobby 2017 rails project i'...
daveasdf's user avatar
  • 115
1 vote
1 answer
109 views

Selenium::WebDriver::Error::WebDriverError: no sessionId in returned payload

Tests suite with Rspec and Capybara was successful until now, but I suddendly got that error message without writing any new spec : ` Failure/Error: visit root_path Webdrivers::VersionError: ...
Sibylle Courcel's user avatar
0 votes
1 answer
32 views

Can't find text with Capybara

Good morning, I'm trying to find specific text in an (Devise email) view that uses bootstrap. My capybara version is 3.6. The css selector is: body > table > tbody > tr > td > table >...
daveasdf's user avatar
  • 115
0 votes
1 answer
49 views

How to select dropdown autocomplete with Capybara?

I've got this form input: <%= f.input :location, input_html: {id: "autocomplete", placeholder: ""}, required: true, hint: 'HINT.' %> where matching addresses are shown in ...
daveasdf's user avatar
  • 115
0 votes
1 answer
18 views

How do I specifiy specific element with Capybara?

I'm testing if the Google Maps api works and loads, so upon loading I would like to confirm specific elements inside the map to make sure it loaded. My code so far: # ... prob put a sleep 1 here maybe ...
daveasdf's user avatar
  • 115
0 votes
1 answer
103 views

Chromedriver getting rejected by test database

Have 2017 Rails project I'm trying to write Rspec tests for. It uses Capybara, FactoryBot and Devise. I'm using Chromedriver, which fails to sign in the user during the first Rspec system test - the ...
daveasdf's user avatar
  • 115
0 votes
1 answer
50 views

How to set up system tests for a modal, using Rspec, Capybara, and Chromedriver

I am novice, and it is my current understanding that you can't mix javascript with Rspec tests (?). For my first Rspec/Capybara system test, I would like the user to sign in, then click on a modal ...
daveasdf's user avatar
  • 115
0 votes
0 answers
41 views

How to RSpec system test an Active Storage image?

I'm writing RSpec system specs to test the presence in pages of Active Storage-powered images. Capybara, Selenium & Co. with a real (non-headless) browser are used. Actually in my spec file I'm ...
Backo's user avatar
  • 18.3k
0 votes
1 answer
30 views

Setting the request host for one specific example in rspec system test using capybara

Capybara's request.host is "www.example.com", but I want to change it to "www.example.2.com" for just one specific test in a system rspec. gem 'rspec-rails', '~> 3.5.0' gem '...
daveasdf's user avatar
  • 115
0 votes
1 answer
49 views

How to send in a random variable from Rails Rspec test to application controller? (devise, factorybot, capybara)

I need a way to Rspec various redirects to specific pages based on the ip/location of people coming to the splash page. scenario "User from asdf sees ASDF page" do create_user_from_asdf ...
daveasdf's user avatar
  • 115
1 vote
1 answer
15 views

Not seeing much difference between let! and before :each

'let' I get, it's only used if called from an example (an example being 'it' or 'scenario' with capybara). 'before' is essentially 'before :each', as per this post, which is essentially let!, as far ...
daveasdf's user avatar
  • 115
0 votes
0 answers
15 views

Capybara::Ambiguous: Ambiguous match, found 2 elements matching visible xpath "/html"

I'm writing my first rspec test ever for a 2017 project that uses capybara, rspec, devise, bootstrap and rails scenario "invalid with unregistered account" do within('#myNavbar') ...
daveasdf's user avatar
  • 115
0 votes
1 answer
58 views

Rspec not loading instance variable

I had this working previous, now it mysteriously does not. ruby 2.4.1, rails 5.0.1.rc2, capybara 3.6, rspec_rails 3.5, factorygirl 4.7 (2017 project) The page controller (root_path) needs ...
daveasdf's user avatar
  • 115
1 vote
1 answer
28 views

Capybara Rspec has content twice

I'm a novice hobbyist, trying to write my first rspec ever for a 2017 rails project that use capybara 2.10.1 and rspec. I got launchy, did save_and_open_page, ctrl-shift-c, right-clicked a link to ...
daveasdf's user avatar
  • 115
0 votes
1 answer
26 views

FactoryGirl Rspec Rails user has a different name

I'm a hobby developer, no education. I two questions relating to a 2017 rails project I want to write 50 feature specs for (feature specs because it's rails 5.0.1.rc2, system specs came in 5.1). in ...
daveasdf's user avatar
  • 115
0 votes
2 answers
33 views

Database data not appearing in Capyara/RSpec system tests

This is my spec/system/group_index_spec.rb file. require_relative '../rails_helper' RSpec.describe 'Group Index', type: :system do let(:user) { User.create(name: 'First User', email: '[email protected]'...
shasherazi's user avatar
0 votes
0 answers
245 views

Selenium WebDriver failing on Github Actions

I'm trying run system specs on GithubActions but I keep getting this error error Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally. ...
Antarr Byrd's user avatar
0 votes
0 answers
70 views

Capybara and Selenium Web Driver returns `InvalidArgumentError when I try to attach a file

I am working on a Ruby on Rails project that requires multiple file uploads, and I am using the dropzone npm package to achieve this on the client side. The big issue is this: In my feature tests, I ...
codepantha's user avatar
0 votes
1 answer
20 views

Rspec/Capybara expects example.com but gets localhost. What am I doing wrong?

This is the output of my spec expected: "http://www.example.com:3000/admin/biblebooks/1" got: "http://127.0.0.1:61574/admin/biblebooks/1" I already tried all sorts of things, like ...
andreheijstek's user avatar
0 votes
1 answer
199 views

What is the correct way to use a headless chrome browser for running Rails system tests in Heroku pipeline

I have my pipeline setup such that a push to main on my GitHub repository triggers Heroku to pull the latest commit and build a system for test. The test setup succeeds but the system tests fail ...
Kevin W.'s user avatar
  • 130
0 votes
3 answers
66 views

Why in Capybara test user logs out after any redirect?

I am trying to test feature of editing the question by the user with js: true, and it fails because user is not signed in during the test (even though there should be user session). I use Devise for ...
dfx's user avatar
  • 3
1 vote
0 answers
87 views

Rails testing with Capybara

I am currently following a Rails tutorial from freeCodeCamp(https://www.freecodecamp.org/news/lets-create-an-intermediate-level-ruby-on-rails-application-d7c6e997c63f/) and am having some issues with ...
Darcy's user avatar
  • 11
1 vote
2 answers
69 views

Instantiating and associating Ahoy::Visit for RSpec System Testing

Env Rails 7.0.4 Capybara 3.39.1 Rspec 3.12.2 Rspec Rails 6.0.2 AhoyMatey 4.2.1 General Context We have an app that uses current_visit as a stand-in user model when a user is not authenticated. We ...
crespire's user avatar
0 votes
1 answer
93 views

Minitest's assert_difference not working with Hotwire's Turbo in a Rails 7 app

I'm upgrading a Rails App in order to use Hotwire but tests like the following, since I enabled Turbo, are now failing: class UserApprovalTest < ApplicationSystemTestCase driven_by :...
Darme's user avatar
  • 6,984
0 votes
0 answers
69 views

Why do I get ERR_ACCESS_DENIED when submitting a form that includes an uploaded file using Capybara with Selenium's Chrome driver?

I have feature tests for a Rails app that currently work when the driver is set to Poltergeist. I'm trying to switch from Poltergeist to Selenium (using Chrome as the browser) but get an error when ...
Ollie H-M's user avatar
  • 485
1 vote
1 answer
25 views

Rails Cucumber Tests Getting Green on Red

I have a rather trivial set of Cucumber tests for a basic Rails application that will pass, despite the fact that I expect them to fail. The tests simply navigate to a static page and test for the ...
Keegan's user avatar
  • 13
1 vote
0 answers
49 views

Having problem testing a form submission with attached file with Rspec and Capybara

Ruby in Rails. I have a form where can upload an image in a file type input field along with other 3 text fields. Everything works like a charm in production, development and so. BUT when I run a test ...
AlanMendicutti's user avatar
0 votes
1 answer
31 views

Capybara with Minitest: how to make a regular assertion within a Session

I'm working on a test with multiple sessions: an admin, an editor, a writer and a lurker. For convenience I want to be able to mix assertions about the UI that would only be true inside the session, ...
nimmolo's user avatar
  • 311
2 votes
1 answer
76 views

WARN Selenium [DEPRECATION] Manager#logs is deprecated. Use Chrome::Driver#logs instead

I get the above warning when executing this line: logs = page.driver.browser.manage.logs.get(:browser) its not clear from the deprecation notice how to fix this This is happening on Selenium 4.1.0
Mitch VanDuyn's user avatar
0 votes
0 answers
70 views

Need to take a screenshot of the full browser window (non-headless) with Capybara

We're currently using capybara's save_screenshot to save objective evidence of test results. Works good in most scenarios. However we have some complex tests that involve switching browser tabs and ...
Jer's user avatar
  • 13
0 votes
1 answer
127 views

Strange problem when running system tests as a whole with RSpec and Capybara/Selenium

I've regular RSpec Rails system tests using Capybara/Selenium, like this: RSpec.describe "Model", type: :system do context "update model info1" do # ... end context &...
Backo's user avatar
  • 18.3k
0 votes
1 answer
62 views

Matching text having HTML tags with RSpec and Capybara

I'm using RSpec and Capybara to expect text containing HTML tags, like this: expect(page).to have_css('#dom_id', :text => "Text with <b>HTML tags</b>", :visible => true, :...
Backo's user avatar
  • 18.3k
0 votes
1 answer
98 views

How to set an attribute value with Capybara, Selenium and the like?

I've a <textarea> field (a Rails model attribute) for which I've to test that the allowed max length error message is displayed. I've to make that using a system spec with Capybara, Selenium and ...
Backo's user avatar
  • 18.3k
1 vote
0 answers
72 views

what causes Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally

• Rails 6 • Minitest with Capybara In this spec I'm debugging, I am seeing my specs pass if I run each one individually (using : and the line number of the spec) However, if I run them all, I ...
Jason FB's user avatar
  • 4,812
0 votes
1 answer
37 views

Find scope outside of a within block

From within a within block I would like to access the page scope. Details being that the code in the within block activates some javascript that generates some html outside that scope. within("...
kwerle's user avatar
  • 2,255
0 votes
2 answers
182 views

rspec long example with multiple expectations

I am testing a registration flow in one of my specs. It is a long example, testing a multiple step wizard, with over 20 expect(page).to. When one of my early expectation is failing, chances are that ...
Quentin Gaultier's user avatar
2 votes
1 answer
465 views

ArgumentError when running Capybara tests on Ruby 3.0

I am really stuck. I am upgrading my Rails app to Ruby 3 (from 2.7). When running tests, I always run into this issue when I visit a path: state = "new" visit status_path(state: “state")...
I. Khan's user avatar
  • 179
0 votes
1 answer
38 views

simple_form how to find out with capybara if form is valid?

Using capybara, I would like to assess if my simple_form is valid, i.e. if the previous submission was processed without errors. Today, I am using : expect(page).not_to have_selector("....
Quentin Gaultier's user avatar
0 votes
2 answers
787 views

Issue with Selenium WebDrive with Docker image and Cucumber.io

Im trying to follow along with the following tutorial. https://www.youtube.com/watch?v=cPF3GKkBHHY I was getting the following error. sh: 1: /sbin/ip: not found But I managed to resolve that doing apt ...
XmalevolentX's user avatar
1 vote
2 answers
165 views

Is there a way I can force a record to not be destroyed when running a feature test in RSpec? (Rails 6)

For context, I have a controller method called delete_cars. Inside of the method, I call destroy_all on an ActiveRecord::Collection of Cars. Below the destroy_all, I call another method, ...
JoshingYou's user avatar
0 votes
0 answers
33 views

Initiate appium driver for android using ruby capybara

How can I initiate appium driver for android using ruby capybara framework def register_cloud_mobile_driver Capybara.register_driver :cloud_mobile do |app| opts = Selenium::WebDriver::Remote::...
Namitha J's user avatar
0 votes
0 answers
305 views

Google Chrome not running when Chromedriver tries to access it - EC2 instance

I've looked at so many suggested solutions to this issue, and yet none apply or have worked for me. I'm trying to test updating chromedriver and google-chrome on our staging server and having no luck. ...
Magpie's user avatar
  • 9
2 votes
1 answer
213 views

Javascript action not triggering in Capybara test

I have an instant search-as-you-type implemented with Turbo and a Stimulus controller, as outlined in this post. Relevant JavaScript, in app/javascript/controllers/form_submission_controller.js: ...
vinnydiehl's user avatar
  • 1,654
0 votes
1 answer
145 views

Cucumber/Capybara saves only .html screenshots without .png

I'm trying to get .png or .jpg image screenshots after test failing. Unfortunately it saves only .html file. Rails 7.0.4 Ruby 3.2.0. gem 'cucumber', '~> 8.0'. gem 'capybara-screenshot', '~> 1.0',...
bart_oz's user avatar

1
2 3 4 5
119