问题标签 [capybara]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby - 如何运行独立的 Capybara 测试?
我正在尝试对远程服务器进行测试。IE:
问题是,你如何运行它?
ruby-on-rails - 你如何发布到 Capybara 中的 URL?
刚刚从 Cucumber+Webrat 切换到 Cucumber+Capybara,我想知道如何将内容发布到 Capybara 中的 URL。
在 Cucumber+Webrat 中,我能够迈出一步:
但是,Capybara 文档提到:
访问方法只带一个参数,请求方法总是 GET.always GET。
如何修改我的步骤,以便 Cucumber+Capybara 对 URL 进行 POST?
session - 测试两个黄瓜功能时未清除浏览器会话
我的应用程序上有两个黄瓜功能,类似于:
我将 webdriver/selenium 用于 firefox 和 css 选择器。总是第二个功能!失败,无论如何。我已经尝试移除钩子,所以它不会转到 twitter.com 并注销。我还尝试了一个钩子@re-login 来登录我的本地应用程序。我也尝试通过 Capybara 清除 cookie。
如果有人可以帮助我,我将非常感谢。我反对在不遵循由外向内循环的情况下开发我的应用程序但没有太多时间的想法。
PD 我注意到第二个功能的存在(即使它没有场景)使第一个功能失败。这对我来说很奇怪
ruby-on-rails - Timeout::Selenium/Capybara/Cucumber 出错
我有一个场景步骤
此步骤与 Timeout::Error 不一致地失败
更奇怪的是,填充不同字段时该步骤失败。任何指针将不胜感激..
ruby-on-rails - Capybara 使用什么库作为 CSS 选择器?
对于我的验收测试,我使用 Steak 和 Capybara (+ Envjs)。当试图找到这样的元素时,find("#ticker").find("li:eq(0)")
它会告诉我Unable to find 'li:eq(0)'
,但find("#ticker").find("li:eq(1)")
返回li
列表中正确的第一个元素。我习惯了 eq 选择器以 0 (jQuery) 开头。为什么Capybara中的eq选择器以1开头?错误或功能?
更新
似乎它是一些非官方的选择器,其工作方式类似于nth-child
. Capybara (/Envjs) 在选择器的底层使用了什么?它似乎不是 jQuery,因为它以 eq(0) 开头,如上所述。
ruby-on-rails - Cucumber: find the input with label text X?
In Cucumber, I'm trying to create a step like this:
I'd like the "Business name" input to be defined as "the input whose label has text "Business name."
Here's what I've got on the step so far:
In jQuery, I'd look for the label with that text, look at its "for" attribute, and find the input with that id. But the only selectors I've seen so far in Cucumber are these:
and
Can anybody suggest a solution using the Webrat / Capybara selector syntax?
jquery-ui - jquery ui datepicker的xpath选择器
我的页面在输入字段#graph_start_date 上有一个 jquery ui datepicker
我正在尝试编写以下 Cucumber 步骤
这是我对步骤定义的内容:
jquery ui datepicker 最初插入到 dom
当它弹出时,dom包含
在它被解雇后,dom 包含
ruby-on-rails - 使用水豚进行黄瓜测试中的饼干
作为我对网站的集成测试的一部分,我将黄瓜与水豚一起使用。水豚似乎无法模仿 cookie 的使用。
例如,我在用户登录时设置了 cookie:
但是,当我稍后使用 cookies.inspect 获取 cookie 的值时,它会返回 {} 这是水豚的已知限制吗?如果是这种情况,我如何通过多个请求测试登录用户?
我应该添加我的测试:
ruby-on-rails - Integration tests of web services and XHR
I am using Steak and Capybara to do my integration tests. I also would like to test the serialization output (webservices using XML and JSON format) of my models. The problem is that JSON is only available by using a XML HTTP Request. So Capybara's visit method does not work. It also seems that I don't have access to xhr
method in my acceptance tests (not sure why, because I require the normal spec_helper.rb in my acceptance_helper.rb).
How do you test web services? Using the xhr
method (after requiring it somehow)? A special method with Capybara? Something else?
I also have some custom serialization (beside the normal my_object.to_xml
). I guess it is better to do that in the model tests. Would you then still test the web service output of those custom serializations?
ruby-on-rails-3 - Rails、Capybara 和子域:如何访问某些子域
Rails 3,黄瓜 0.9.4,水豚 0.4.0
我想用子域测试我的功能。我找到了解决方案:
如果我运行它会起作用,cucumber features/subdomain.feature
但如果我运行它会失败cucumber features
!这令人难以置信,但这是真的。我记录了当前的网址,它subdomain.example.com
适用于一个场景cucumber features/subdomain.feature
www.example.com
cucumber features
在这两种情况下!
我不知道原因...
有没有用 capybara 测试子域的最佳方法?