运行 Cucumber 在 Rails 中测试时出现参数错误
Argument error while running Cucumber tests in Rails
我正在按照信号量的 Rails 测试手册进行操作,我在 运行 测试 authentication_steps.rb
时遇到了这个问题。
wrong number of arguments (given 2, expected 0) (ArgumentError)
给出上述错误的测试如下
When("I fill in the sign up form") do
click_link "Sign up"
fill_in "user_email", :with => "tester@testdomain.test"
fill_in "user_password", :with => "pa$$word"
fill_in "user_password_confirmation", :with => "pa$$word"
click_button "Sign up"
end
下图显示了错误。 capybara v3.0.2
、cucumber v3.1.0
身份验证是使用设计实现的。
感谢所有帮助。提前致谢
Capybara 3 中的 Driver::Node#click
方法发生了变化,可以支持偏移点击和按住按键点击。驱动程序编写者现在需要更新他们的实现来接受这些参数。您不知道您使用的是哪个驱动程序,但您使用的驱动程序的任何版本都与 Capybara 不兼容 3.x
将来 运行 使用 --backtrace
选项的 Cucumber 测试应该会为您提供有关错误的完整堆栈跟踪,这将使调试问题变得更加容易。
我正在按照信号量的 Rails 测试手册进行操作,我在 运行 测试 authentication_steps.rb
时遇到了这个问题。
wrong number of arguments (given 2, expected 0) (ArgumentError)
给出上述错误的测试如下
When("I fill in the sign up form") do
click_link "Sign up"
fill_in "user_email", :with => "tester@testdomain.test"
fill_in "user_password", :with => "pa$$word"
fill_in "user_password_confirmation", :with => "pa$$word"
click_button "Sign up"
end
下图显示了错误。 capybara v3.0.2
、cucumber v3.1.0
身份验证是使用设计实现的。
感谢所有帮助。提前致谢
Capybara 3 中的 Driver::Node#click
方法发生了变化,可以支持偏移点击和按住按键点击。驱动程序编写者现在需要更新他们的实现来接受这些参数。您不知道您使用的是哪个驱动程序,但您使用的驱动程序的任何版本都与 Capybara 不兼容 3.x
将来 运行 使用 --backtrace
选项的 Cucumber 测试应该会为您提供有关错误的完整堆栈跟踪,这将使调试问题变得更加容易。