capybara-webkit

How to wait till an element appears after an AJAX call using capybara-webkit?

笑着哭i 提交于 2019-12-10 15:45:40
问题 The capybara method, wait_until doesn't seems to work for capybara-webkit. Is there any alternate solution for that, or any Javascript implementations? Intentionally need some replacement for sleep , e.g. sleep 2 . 回答1: You can take a look at this solution wrapped up by Thoughtbot: here I found it very useful. 回答2: If your AJAX call results in a change to the DOM, Capybara will wait for it if you do page.should have_selector?("some selector") It is an intentional Capybara feature that it

Capybara webkit doesn't pass params from angular

ぃ、小莉子 提交于 2019-12-10 15:22:31
问题 I am trying to port a selenium test suite to capybara-webkit. The Rails app has an angular app embedded in the rails views and is not behaving as expected with webkit . A test like this: require 'spec_helper' feature 'Editing company profiles' do before do @user = create(:employee) @company = Company.find(@user.employer.id) sign_in_as! @user end scenario 'successfully', js: true do click_link 'Dashboard' click_link @company.name click_button 'Edit' fill_in 'company_name', with: 'new name'

Test Alert Dialog Text Using Capybara Webkit 1.3.1

懵懂的女人 提交于 2019-12-10 10:45:02
问题 I'm looking to test the text in an alert dialog using Capybara Webkit. I'm aware of the accept_js_confirms and reject_js_confirms methods, but I'm looking to evaluate the contents of the dialog prior to performing an action. In Selenium for example, the following works: alert = page.driver.browser.switch_to.alert expect(alert.text).to eq t('report_periods.edit.delete_confirmation') alert.accept I'm currently using expect(page.driver.confirm_messages).to include t('report_periods.edit.delete

deadlock detected with capybara-webkit

大兔子大兔子 提交于 2019-12-09 06:22:43
问题 I'm trying to pass this spec : scenario "Edit a service", js: true do service = create_service_for(provider, title: "First service") fill_edit_service_form(service) expect(page).to have_css('#price', text: '10,00 $') end This is a standard rails spec using capybara. I am using capybara-webkit for all scenario with javascript. When I'm trying to pass it, sometimes it works, sometimes it mark than there is a missing record in the database and sometime I have this error : Run options: include {

Problems installing capybara-webkit 1.0.0 in Rails 3.2.10 on Ubuntu 10.04

耗尽温柔 提交于 2019-12-08 09:48:43
问题 Issue I am unable to get Capybara-webkit 1.0.0 to install into my Rails 3.2.10 project. When I run bundle install I get the following errors. Also when I roll capybara-webkit back to version 0.12.1 (May 30, 2012) it installs fine. Note: I am having this same problem on both OSX 10.8 and Ubuntu 10.04 Errors An error occurred while installing capybara-webkit (1.0.0) with bundler Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. Thoughts It seems to be related to

Capybara Webkit Capybara::Webkit::ConnectionError failed to start

☆樱花仙子☆ 提交于 2019-12-07 04:29:23
问题 I'm using capybara webkit on Ubuntu (14.04 LTS) and I'm getting the following error when trying to use it: Capybara::Webkit::ConnectionError: /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/bin/webkit_server failed to start. from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:75:in `parse_port' from /srv/www/app/shared/bundle/ruby/2.1.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:81:in `discover_port' from

How can I run headless browser system tests in Rails 5.1?

本小妞迷上赌 提交于 2019-12-05 22:12:21
问题 The documentation for Rails 5.1 system tests is a bit sparse. I'm unable to get headless tests that execute javascript running. I think one approach entails installing and running xvf. But this is more manual setup than I'm used to when running capybara in other versions of rails. What's the most straightforward way to achieve this? 回答1: In Rails 5.1 system tests the driver used is set by the driven_by call in ApplicationSystemTestCase (test/application_system_test_case.rb). Assuming you have

Does Capybara require sleep to work?

六眼飞鱼酱① 提交于 2019-12-05 22:06:27
问题 Apparently, sleep or wait_until are not valid using recent versions of Capybara, according to the webpage updates. However, I have a set of tests that only work on fast machines if I add a sleep(1) call to the test. That is, a test that looks like: describe "dosimeters page" do before do click_link("Dosimeter Read History", :match=>:first) end ... becomes describe "dosimeters page" do before do unix_wait click_link("Dosimeter Read History", :match=>:first) end ... where I've defined unix_wait

RSpec+Capybara request specs w/ JS not working

99封情书 提交于 2019-12-05 17:47:45
I cannot get request specs working when using Javascript. My specs pass if I run them without Javascript (the page is built to work with or without JS). Specifically, the specs fail when I do assertions like Post.should have(1).record . Capybara just doesn't pick up the records from the DB, and the database is not cleaned between runs. I've tried using DatabaseCleaner with transactional fixtures disabled - the common approach to this, I guess. No dice. I've also tried (and, would ideally prefer) running without DatabaseCleaner, using transactional fixtures and forcing AR to share the same

Click overlay marker in Google Maps with capybara-webkit

大憨熊 提交于 2019-12-05 10:00:35
问题 Is there a way to click a Google Maps overlay with capybara-webkit? What about Capybara using Selenium? I want to test the content of the info window once the marker is selected. I also want to test that there are n markers on the page. 回答1: To test that there are n markers on the page: expect(find('.gmap_container')['data-markers'].split('},{').count).to eq(n) 回答2: This can be done, but requires a change to how you create your markers. You must instruct them to render as images rather than