运行最新版本的Rails,Cucumber和Capybara当Capybara需要按下按钮时,我陷入困境。我试图消除所有问题,并确保窗体生成并正确显示。 B)如果我尝试按下带有完全不正确的标识或文本值的按钮(如果我尝试按下具有正确标识或文本值('提交')的按钮B)如果我尝试按下具有完全不正确标识或文本值的按钮( 'cxxxommit')导轨,黄瓜,水豚 - 黄瓜一步不能按下按钮
我可以重现上都Ubuntu和Windows 7的
的错误这些错误:
选项A
And I save the Quote
undefined method `name' for nil:NilClass (ActionView::Template::Error)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
个
选项B
And I save the Quote
no button with value or id or text 'cxxxommit' found (Capybara::ElementNotFound)
(eval):2:in `click_button'
./features/step_definitions/quote_steps.rb:63:in `/^I save the Quote$/'
features\interactions\policies\quotes.feature:22:in `And I save the Quote'
版本:
红宝石1.9.2p290(2011-07-09)[I386-的mingw32]
的Rails 3.1.3
场景
Scenario: Create a complete manual entered quote for a client
When I select the XXX as YYY
And I save the Quote
Then I should see "Policy was successfully created"
步骤
When /^I select the (.*) as (.*)$/ do |field, value|
select(value, :from => field)
end
When /^I save the Quote$/ do
# debugger
click_button('commit')
# ================================================
# The next line causes the second error
# click_button('cxxxommit')
# ================================================
# find_button('commit').click
end
请注意,我已阅读并尝试以下SO发布Cucumber press button
failure (Capybara::ElementNotFound)
任何帮助或方向将不胜感激。
谢谢
这里有一些不一致之处。您的方案是针对项目,而不是报价。此外,您的错误消息表明,当您向我们提供的步骤代码表示“提交”时,它找不到'cxxxommit'。此外,你有两个“选项”的错误信息?您没有向我们展示哪些代码会导致哪些错误消息。请编辑问题并解决这些问题,并最好向我们展示一个最小失败情况。 – 2012-01-09 12:45:28
@MarkThomas:感谢您的快速反馈。我已经更新了这个问题以反映最初的问题,在不同的项目中工作会打乱我的大脑。 – 2012-01-10 06:24:03
HTML的外观如何?它是一个输入元素或JavaScript操作? – 2012-01-10 12:24:10