标签: capybara-webkit

rails bundle error - capybara-webkit - 无法构建本机扩展

试图运行bundle(现有应用程序,运行Ubuntu 12.04的新机器).

Installing capybara-webkit (0.12.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/durrantm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 


Gem files will remain installed in /home/durrantm/.rvm/gems/ruby-1.9.3-p194@dmstaffing/gems/capybara-webkit-0.12.1 for inspection.
Results logged to /home/durrantm/.rvm/gems/ruby-1.9.3-p194@dmstaffing/gems/capybara-webkit-0.12.1/./gem_make.out
An error occurred while installing capybara-webkit (0.12.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '0.12.1'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

ubuntu ruby-on-rails bundler capybara capybara-webkit

4
推荐指数
1
解决办法
2396
查看次数

Capybara webkit不会从有角度传递params

我正在尝试将selenium测试套件移植到capybara-webkit.Rails应用程序在rails视图中嵌入了一个角度应用程序,其行为与预期不符webkit.

像这样的测试:

需要'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'
    click_button 'Save'

    expect(page).to have_content "Your company profile has been updated!"
  end
end
Run Code Online (Sandbox Code Playgroud)

会在selenium中没有问题,但是webkit我得到了错误

 Failure/Error: Unable to find matching line from backtrace
 ActionController::ParameterMissing:
   param is missing or the value is empty: company
 # ./app/controllers/api/v1/companies_controller.rb:23:in `company_params'
 # ./app/controllers/api/v1/companies_controller.rb:10:in `update'
Run Code Online (Sandbox Code Playgroud)

缺少痕迹,可能是因为它来自有角度的土地,但错误是报告没有来自客户端的参数.我已经尝试了capybara-angular宝石,但它没有帮助.我也尝试用capybara保存页面,没有什么看起来不合适,有没有办法访问PATCH …

ruby-on-rails capybara-webkit angularjs

4
推荐指数
1
解决办法
607
查看次数

rails 3.1,capybara-webkit,为什么page.execute_script失败?

安装capybara-webkit后,我尝试在规范中尝试测试,这是我的测试:

Capybara.default_driver = :webkit

page.execute_script("$('#submit_direction').attr('value', '1');$('#quizForm').submit()")
Run Code Online (Sandbox Code Playgroud)

然后,我收到此错误:

/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:136:警告:不安全的世界可写dir/home/sam/Documents/PATR中的RoR,模式040777 undefined | 0 | ReferenceError:找不到变量:$

Capybara :: Driver :: Webkit :: WebkitInvalidResponseError:Javascript无法执行

有什么好主意吗?

ruby-on-rails-plugins capybara ruby-on-rails-3 capybara-webkit

3
推荐指数
1
解决办法
7903
查看次数

如何告诉capybara-webkit不要忽略确认框(或只是测试他们的内容)

所以我有一个场景:

Given I signed in to my business account
And there is one customer named "Samantha Seeley"
When I go to the customers management page
Then "Delete" should show a confirmation dialog saying "Are you sure?"
Run Code Online (Sandbox Code Playgroud)

链接很简单:

<%= link_to 'Delete' customer_path(customer), method: :delete, confirm: 'Are you sure?' do %>
Run Code Online (Sandbox Code Playgroud)

因此,当我点击Chrome中的链接时,此代码确实会显示确认对话框,但使用如下页面渲染:

Then /^"(.*?)" should show a confirmation dialog saying "(.*?)"$/ do |arg1, arg2|
  click_on arg1
  page.driver.render "tmp/screenshot.jpg"
end
Run Code Online (Sandbox Code Playgroud)

我相信我可以确认javascript似乎没有被评估(没有显示确认对话框).这个假设可能是错的,我不确定.

谢谢你的帮助.

ruby-on-rails cucumber capybara ruby-on-rails-3 capybara-webkit

3
推荐指数
1
解决办法
1588
查看次数

使用capybara webkit删除cookie

我最近开始使用capybara-webkit来加速我的验收测试.我的测试中有90%使用标准的capybara DSL运行,但有些略有不同.

我遇到问题的主要原因之一是删除cookie.以前我用过以下内容:

page.driver.browser.manage.delete_all_cookies
Run Code Online (Sandbox Code Playgroud)

但这不适用于capybara-webkit.收到此错误:

 undefined method `delete_cookie' for #<Selenium::WebDriver::Driver:0x007f86cb068b88> (NoMethodError)
Run Code Online (Sandbox Code Playgroud)

有谁知道如何使用capybara-webkit删除cookie?

谢谢!

selenium capybara capybara-webkit selenium-webdriver

3
推荐指数
1
解决办法
1808
查看次数

Capybara: won't select bootstrap button group

I have the following button group that I cannot get Capybara w/ Selenium to select for:

<div class="btn-group hidden-sm" data-toggle-name="user[attributes][0][customization_id]" data-toggle="buttons">
  <label class="btn btn-default active">
    <input type="radio" value="17">
      Stocky body
  </label>
  <label class="btn btn-default">
    <input type="radio" value="16">
      Round body
  </label>
</div>
Run Code Online (Sandbox Code Playgroud)

I have tried to following:

click_button 'Stocky body'

find(:xpath, "//input[@value='16']").click
Run Code Online (Sandbox Code Playgroud)

and

find(:xpath, "//input[@type='radio'][@value='16']").click
Run Code Online (Sandbox Code Playgroud)

At this point I've ready over an hour of :xpath and Capybara answers and they all see to be saying that the :xpath code should at …

selenium xpath capybara twitter-bootstrap capybara-webkit

3
推荐指数
1
解决办法
1288
查看次数

什么WebKit版本是Qt 5.4.1在OSX上使用?

我怎么能从终端检查这个?

我已经尝试qmake -v但只能给出

› qmake -v
QMake version 3.0
Using Qt version 5.4.1 in /usr/local/Cellar/qt5/5.4.1/lib
Run Code Online (Sandbox Code Playgroud)

qt webkit qtwebkit capybara-webkit

3
推荐指数
1
解决办法
1263
查看次数

NameError:未初始化的常量Capybara :: Webkit.configure

我一定不能正确理解这个方法调用的位置.我有这个test_helper.rb文件

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)

require 'rails/test_help'
require 'minitest/rails/capybara'
require 'capybara'
require 'capybara/rails'
require 'capybara/webkit'

Dir[Rails.root.join('test/support/**/*.rb')].each { |f| require f }

Capybara::Webkit.configure do |config|
  config.allow_unknown_urls
end
Run Code Online (Sandbox Code Playgroud)

我跑的时候会收到这个错误 rake test

NoMethodError:未定义的方法configure' for Capybara::Webkit:Module /Users/sameer/code/rails/door_app/test/test_helper.rb:XX:in'

看起来我正在做Capybara-webkit Github页面的README中所描述的内容.

ruby-on-rails capybara-webkit

3
推荐指数
1
解决办法
1998
查看次数

为什么即使我删除了 application.js 文件,Capypara + Rspect 测试仍然通过?

我有 rails 应用程序,并且在 application.js 文件中有一些 ajax 调用。O 有 rspec、capybara、webkit、factorygirl 和 databasecleaner 用于测试。我编写了全部通过的功能测试。然后不小心删除了 application.js 文件并运行测试,它们仍然通过。请帮我找出原因。非常感谢。

PS:如果您不赞成我的问题,请至少告诉我原因。我一直在寻找答案,但找不到。

ruby ruby-on-rails capybara rspec-rails capybara-webkit

3
推荐指数
1
解决办法
461
查看次数

如何使用capybara选择select2下拉字段

在线帮助使用带有capybara的select2(参见下面的链接),但就我在select2下拉字段中看到的情况而言,没有任何帮助.我尝试了各种各样的事情,包括在以下情况下尝试填写字段:js => false(使用某些内容find(:xpath, "//input[@id='product_manufacturer_id']").set "Test product manufacturer")或其他select2字段的解决方案的变体(请参阅下面给出的链接).到目前为止,没有什么对我有用.

关于我的配置的说明:

  • 使用select2版本3
  • 使用capybara WebKit
  • 这个特殊的字段也使用简单的形式,并且是一个关联(所以f.association......).特别是,ProductManufacturer实例has_many与产品有关系.
  • select2下拉字段应该由ProductManufacturer与查询文本匹配的实例(即您在搜索字段中键入的文本)动态填充.

如果有必要了解我如何实施工厂:

这是我的工厂文件:

factory :product do
  name "Test product"
  url { Faker::Name.name.parameterize }
  access_level 1
  product_manufacturer
end

factory :product_manufacturer do
  name "Test product manufacturer"

  factory :product_manufacturer_with_product do
    transient do
      products_count 1
    end

    after(:create) do |product, evaluator|
      create_list(:product,
                   evaluator.products_count,
                   product: product)
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

然后,在测试开始之前,我运行:

@product_manufacturer = create(:product_manufacturer)
Run Code Online (Sandbox Code Playgroud)

我的最新尝试: 我的帮助方法(适用于我的其他select2字段):

def select2_choose(id, options)
  page.execute_script  "$('#{id}').trigger('keydown').val('{options[:query]}').trigger('keyup');"
  find(".select2-result-label", :text => options[:choose]).click …
Run Code Online (Sandbox Code Playgroud)

rspec capybara capybara-webkit select2 factory-bot

3
推荐指数
1
解决办法
1851
查看次数