- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将表单数据从 cucumber 测试发送到 Controller 方法。
我有一个带有登录名和密码字段的表单,以及提交按钮。
表单 View :
<%= text_field_tag 'login', id: 'login-input' %>
<%= password_field_tag 'password', nil, id: 'password-input' %>
<%= submit_tag 'Login', id: 'submit-credentials' %>
在 cucumber 步骤中,我以该形式输入值(未显示登录字段,但类似)。
Then(/^I press "password-input"$/) do
find("#password-input").click
end
Then(/^I enter "myPassword" into the "password-input"$/) do
find("#password-input").text("myPassword")
end
现在登录名和密码值已设置。
然后我按下提交按钮
And(/^I press "submit-credentials"$/) do
find("#submit-credentials").click()
end
我的身份验证方法被调用,但它的参数为空。
当我在网页上正常输入值时,一切正常。为什么 cucumber 版本不起作用?
我所有的 cucumber 步骤都通过了!!所以我很困惑
如何将数据从文本字段发送到 Controller 方法?
谢谢
最佳答案
有几种方法可以interact with forms in Capybara
尝试使用
Then(/^I enter "myPassword" into the "password-input"$/) do
find("#password-input").set("myPassword")
end
代替
Then(/^I press "password-input"$/) do
find("#password-input").click
end
Then(/^I enter "myPassword" into the "password-input"$/) do
find("#password-input").text("myPassword")
end
关于ruby-on-rails - Rails Cucumber 测试 - 将表单数据发送到方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41062423/
我一直在开发一个 .NET 字符串格式化库来协助应用程序的本地化。它称为 SmartFormat 并在 GitHub 上开源. 它试图解决的问题之一是 Grammatical Numbers .这也称
leetcode关于单数II的题目是: 给定一个整数数组,除一个元素外,每个元素出现三次。找到那一个。笔记:您的算法应该具有线性运行时复杂度。你能在不使用额外内存的情况下实现它吗? 其实我已经从网站上
我想知道创建/命名模型的首选方法是什么? 我的应用程序有一个“用户”模型,其中包含用于创建、获取、更新(等)用户记录的所有相关业务逻辑。 在我的一些 Controller 中,我可能想要获取多个“用户
在我的 Mysql 数据库中,我有一个术语列表,例如(首字母大写,大多数时候是复数) Hairdressers Restaurants Beauty Salons Fournitures For Re
如果我决定为我的所有路线名称使用复数形式,但某些资源仅作为一个东西存在,您是否将其保持为单数(更直观)或尊重使用复数的决定并保持这种方式? 我们正在用 PHP 为我们的客户门户网站设计一个新的 API
我可能在做一些愚蠢的事情,但是...... 应用/模型/user.rb: class User 然后,当我导航到 /users/123/totem/new 时,出现错误: ActionView::
您能否澄清一些 Matplotlib 术语: “subplots”(或“subplot”?)这个词是“axes”的同义词吗? “轴”和“轴”的单数/复数是什么? 最佳答案 这确实是一个令人困惑的问题。
我有一个 profile我的应用程序中的模型。我想允许用户通过 /profile 查看他们自己的个人资料,所以我创建了这条路线: resource :profile, :only => :show 我
我是一名优秀的程序员,十分优秀!