我允许用户与其他人分享照片。当用户查看照片及其描述时,他们可以点击“分享”并加载新页面。在这个页面上填写一个电子邮件地址(和可选的注释 - 这里没有测试过)并点击“分享照片”。系统通过一个链接向收件人发送电子邮件,主题行包含照片的名称。带有“共享”表单的页面还会显示该照片已被共享的个人列表。水豚:Webkit无法找到iframe或其内容
整页加载是用户投诉的来源。他们想要一个模式窗口来快速加载和最小化导航。我同意。
我使用shadowbox.js将共享页面加载到模态窗口中的iframe中。它运行良好,如果需要,可以很好地回退到旧页面。
但是 - 我只是无法让我的测试通过。特别是,Capybara:Webkit无法找到iframe。
的环境是: 铁路3.0.9 水豚0.4.1.2 水豚,WebKit的0.5.0 黄瓜1.0.2
黄瓜故事:
Feature: Share photo
@javascript
Scenario: User shares photo
When I follow "Share"
Then I should see "Share Old Man Photo" inside "#sb-player"
And I should see information about who I've shared this photo with
When I fill in "Share with" with "[email protected]"
And I press "Share Photo"
Then "[email protected]" should receive an email with subject "Old Man photo has been shared with you"
我的步:
Then %r{^I should see "([^"]*)" inside ([^"].*)$} do |expected_text, named_element|
selector = element_for(named_element)
within_frame selector do
page.should have_content(expected_text)
end
end
失败消息:
(::) failed steps (::)
Unable to locate frame. (Capybara::Driver::Webkit::WebkitError)
./features/step_definitions/sharing_steps.rb:94:in `/^I should see "([^"]*)" inside "([^"]*)"$/'
features/user_shares_photo.feature:21:in `Then I should see "Share Old Man Photo" inside "#sb-player"'
Failing Scenarios:
cucumber features/user_shares_photo.feature:19
我试过每个元素ID的组合。我只是无法让Capybara:Webkit识别iframe。
任何想法或解决方案?我无法提供失败的测试,并且正在考虑推出整个iframe方法 - 但我希望找到解决方案。
谢谢
它可以与不同的水豚驱动程序一起使用吗? –