Ruby on rails 4 使用cucumber、capybara和webkit测试客户端验证
我在应用程序中使用Cucumber和Capybara进行集成测试 我有这样一个Ruby on rails 4 使用cucumber、capybara和webkit测试客户端验证,ruby-on-rails-4,cucumber,capybara-webkit,Ruby On Rails 4,Cucumber,Capybara Webkit,我在应用程序中使用Cucumber和Capybara进行集成测试 我有这样一个场景设置 @javascript Scenario: Register with invalid values with javascript validation Given I am not signed in When I register with an invalid account Then I should see "Please enter a valid email a
场景
设置
@javascript
Scenario: Register with invalid values with javascript validation
Given I am not signed in
When I register with an invalid account
Then I should see "Please enter a valid email address."
And I should see "Please enter a strong password with a minimum of 8 charaters."
And I should see "The password confirmation does not match the entered password."
And I should be on the sign up page
该表格通过遵守(Zurb基金会)进行验证。虽然在浏览器中验证工作正常,但当我将Selenium web驱动程序与Chrome一起使用时,情况也是如此
但是,我想使用Capybara webkit驱动程序无头运行测试。当我使用Capybara.javascript\u driver=:webkit
将驱动程序设置为默认值时(我安装了Capybara webkit
gem)。JavaScript验证无法阻止表单提交
这是我注册无效帐户时的步骤定义
When(/^I register with an invalid account$/) do
visit new_member_registration_path
fill_in "Email", :with => "test@"
fill_in "member[password]", :with => "test"
fill_in "Password confirmation", :with => "testt"
click_button "Sign up"
end
是否需要启用其他功能来测试客户端验证?如果在填写最后一个字段和单击“注册”之间执行睡眠5,则该场景是否通过?我刚刚尝试了此操作,没有。我仍然收到相同的结果。