将“然后向我显示页面”行添加到 cucumber 场景可以在我同事的计算机上使用相同的设置进行工作,但在我的计算机上不行。事实上,添加暂停步骤定义并调用它似乎完全被忽略了。
步骤定义:
Then /^show me the page$/ do
save_and_open_page
end
AfterStep('@pause') do
print "Press Return to continue"
STDIN.getc
end
特点:
(line 25) Scenario Outline: An authorised user visits the blah..,
Given a blah: ... blah ...
And I am logged in as <role>
And the date is 1 April 2012
When I go to the blah page
And I click "foobar"
Then I should see "Blah foobar"
And I should see "Foobar on Mon Apr 1 00:00:00 2012 by <email>"
Then show me the page
And ...
命令行:
cucumber features/blah/foos.feature:25 --require features --tags @pause
使用 Firefox 16.02(避免 17 中的错误)
两台机器都有 git-fetch'd、pull'd、bundle install'd,因此所有 gem 都是相同的,都使用 Rbenv 版本 * 1.9.3-p327-perf。我可能遗漏了一些明显的东西......
更新:tmp/capybara/不包含该文件,因此现在没有保存...
感谢 Beerlington 的解决方案:将显示的页面向上移动一位。在显示页面之前出现故障,因此没有显示。
最佳答案
复制评论中的答案,以便从“未回答”过滤器中删除此问题:
Solution thanks to Beerlington: Move the show me the page line up one. There was failure before show me the page, thus it did not get shown.
关于ruby-on-rails - cucumber 显示页面未显示页面(解决方案: it was on the wrong line),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14155775/