0
我正在使用Cucumber-Capybara组合进行测试。我没有使用Rails应用程序,而是一个简单的捆绑应用程序。使用cucumber/capybara在bundler应用程序中测试动态URL
我想测试我的前端应用程序的一些动态URL。例如,项目展示页的URL为:
/suitability/items/197/
(Assertion: Then I go to suitability-item-show page)
在上面的URL中,197是一个:id。我想测试包含动态数据的类似页面。
我曾尝试以下两种方式:
Then(/^I should be on suitability\-item\-show page$/) do
visit '/suitability/items/:id/'
end
和
Then(/^I should be on suitability\-item\-show page$/) do
visit "/suitability/items/#{:id}/"
end
但他们没有工作对我来说
请帮我解决这个。
写作背后的原因:身份证是我正在尝试编写的URL,因为我们在路由文件中提到它。我试过你的解决方案。我得到“未定义的局部变量或方法'ID'”错误。 –