capybara-webkit

instantiate capybara browser and set a proxy

十年热恋 提交于 2019-12-02 12:36:50
问题 Following this documentation I'm trying to instantiate a capybara browser and set a proxy b = Capybara::Driver::Webkit::Browser.new b.set_proxy :host => 'localhost', :port => 8888 Unfortunately the documentation is out of date and I can't find the new right way to do it. I get: NameError: uninitialized constant Capybara::Driver::Webkit::Browser 回答1: page.driver.browser.set_proxy :host => 'localhost', :port => 8888 来源: https://stackoverflow.com/questions/13339993/instantiate-capybara-browser

Why Capypara + Rspect tests still pass even though I delete application.js file?

馋奶兔 提交于 2019-12-02 05:39:17
问题 I have rails app and have some ajax call in application.js file. O have rspec, capybara, webkit, factorygirl and databasecleaner for testing. I wrote feature tests which all pass. Then accidentally delete application.js file and run the tests, they still pass. Please help me to find out why. Thanks so much. PS: if you downvote my question, please at least tell me why. I have been searching for answers but couldn't find one. 回答1: Try with rake assets:clobber This will remove compiled assets

Capybara integration tests with jquery.selectize

徘徊边缘 提交于 2019-12-01 16:53:39
How can I write a capybara integration test with a form using jquery.selectize ? I'd like to test a user entering a couple of values. I created a helper that I mix in to my capybara feature specs: module PageSteps def fill_in_selectized(key, *values) values.flatten.each do |value| page.execute_script(%{ $('.#{key} .selectize-input input').val('#{value}'); $('##{key}').selectize()[0].selectize.createItem(); }) end end end And here's an example of how it is used: # Single value fill_in_selectized('candidate_offices', 'Santa Monica') # Multiple values fill_in_selectized('candidate_offices', ['San

Error while building native extensions for capybara-webkit

不羁岁月 提交于 2019-12-01 07:08:16
I'm trying to install the webkit driver for capybara on Windows, and I'm getting the following error: $ gem install capybara-webkit-0.12.1.gem Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing capybara-webkit-0.12.1.gem: ERROR: Failed to build gem native extension. c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/capybara-webkit-0.12.1 for inspection. Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems

Trouble interacting with Bootstrap modals via Capybara (v2)

对着背影说爱祢 提交于 2019-11-30 17:33:52
In a Rails application I'm trying to test a Bootstrap modal with a jQuery TokenInput field in Rspec using Capybara with the capybara-webkit driver. The portion in question is as follows: click_link 'Create Team Modal' sleep 1 within('div#modal_popup') do fill_in 'input#token-input-team_name', with: 'Fancy team name' sleep 1 fill_in 'input#token-input-team_name', with: '\t' sleep 1 click_button 'Create Team' end page.should have_content('Fancy team name') Click button to get modal Fill in TokenInput with a team name Simulate a Tab key-press to get it selected Create the team Verify the name

Find elements by data attributes

浪尽此生 提交于 2019-11-30 17:17:57
I'm improving my tests with RSpec and capybara-webkit , trying to delete all the css and xpath selectors like find('#edit_user > div:nth-child(7) > div > div > button').click and I'm looking for the best option to replace them. I was going to use the css class of the elements but some "pro" capybara tester said this is not the best option. So my question is: can I use the data attributes in my tests? If I have an element <button name="button" type="submit" class="button last" data-test="edit.update">Update/button> will I be able to do find('edit.update').click ? And do you think it is a good

Can I delete some folders of nokogiri and capybara-webkit inside of my rvm gemset?

爷,独闯天下 提交于 2019-11-30 16:17:09
问题 I was using a disk analyzer and I noticed in my .rvm folder two gems, nokogiri and capybara-webkit , bigger than the usual: Checking inside of them I found that for nokogiri there is a temp folder and for capybara-webkit a source folder. My question is: Is it safe to delete these folders?(Yeah, I'm a greedy disk space saver) and why nokogiri is creating that temporary folder? Because I have another gemset (with a lower version of ruby and nokogiri) and there isn't creating that folder. 回答1:

Can I delete some folders of nokogiri and capybara-webkit inside of my rvm gemset?

99封情书 提交于 2019-11-30 15:55:47
I was using a disk analyzer and I noticed in my .rvm folder two gems, nokogiri and capybara-webkit , bigger than the usual: Checking inside of them I found that for nokogiri there is a temp folder and for capybara-webkit a source folder. My question is: Is it safe to delete these folders?(Yeah, I'm a greedy disk space saver) and why nokogiri is creating that temporary folder? Because I have another gemset (with a lower version of ruby and nokogiri) and there isn't creating that folder. Yes, you can remove the tmp directory. If you don't have a new-enough version of libxml2 or libxslt nokogiri

Deprecation warning from Capybara

喜夏-厌秋 提交于 2019-11-30 09:14:17
I am upgrading from rails 3.2.19 to rails 4.1.5, using rspec-rails 2.14.0.rc1 and capybara 2.4.1. All tests pass, and I only have one deprecation warning left: [DEPRECATION] Capybara::Webkit::Driver#accept_js_confirms! is deprecated. Please use Capybara::Session#accept_confirm instead. The line of code that is causing this is page.driver.accept_js_confirms! How do I change this line in order to eliminate the deprecation warning? Given that the exception says: Please use Capybara::Session#accept_confirm instead. You probably want: page.accept_confirm Note that accept_confirm is being run

Trouble interacting with Bootstrap modals via Capybara (v2)

拥有回忆 提交于 2019-11-30 01:19:13
问题 In a Rails application I'm trying to test a Bootstrap modal with a jQuery TokenInput field in Rspec using Capybara with the capybara-webkit driver. The portion in question is as follows: click_link 'Create Team Modal' sleep 1 within('div#modal_popup') do fill_in 'input#token-input-team_name', with: 'Fancy team name' sleep 1 fill_in 'input#token-input-team_name', with: '\t' sleep 1 click_button 'Create Team' end page.should have_content('Fancy team name') Click button to get modal Fill in