Capybara与jquery.selectize的集成测试 [英] Capybara integration tests with jquery.selectize
本文介绍了Capybara与jquery.selectize的集成测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 jquery.selectize用表单编写水豚集成测试。
?
我要测试输入两个值的用户。
I'd like to test a user entering a couple of values.
推荐答案
此处的大多数答案都是从封面下进行更改的,与用户的交互作用不同。这是一个与用户操作相近的版本。
Most of the answers here change stuff from beneath the covers and aren't the same as the users interaction. Here is a version which is close to the what the user does.
# waits for the text to show up in autocomplete and then selects it
def selectize_select(selectize_class, text)
find("#{selectize_class} .selectize-input input").native.send_keys(text) #fill the input text
find(:xpath, "//div[@data-selectable and contains(., '#{text}')]").click #wait for the input and then click on it
# convert css selector to xpath selector using Nokogiri::CSS.xpath_for
end
这篇关于Capybara与jquery.selectize的集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文