Twitter引导模式的黄瓜功能
Cucumber feature for twitter bootstrap modal
>我正在编写一个黄瓜功能,我想删除一个类别,但在删除它之前,我会显示一个模态屏幕来询问用户的体型。
我正在使用Twitter引导程序并使用他们提供的javscript模式。
但是我被困住了,所以任何人都可以直接帮助我如何测试这个。这是我到目前为止的功能:
Scenario: Delete category with articles
Given I am logged in as an admin
And I have category titled Paints
When I go to the list of categories
And I push delete button for the Paints category
Then I should get a popup to confirm
我已经实现了该功能的必要步骤,当然接受最后一个。但是我不知道如何开始:
我读了一些关于page.driver.browser.switch_to.alert的东西,但现在不要,如果这可行的话。
有人有一些建议吗?
多谢。
正如您在问题中所建议的,您可以使用硒驱动程序访问对话框。 我假设您使用的是 Capybara,因此您可以通过以下方式定义用于接受/取消弹出窗口的步骤定义:
Then /^I accept the popup to confirm$/
page.driver.browser.switch_to.alert.accept
end
Then /^I cancel the popup to confirm$/
page.driver.browser.switch_to.alert.dismiss
end
编辑:似乎模态实际上不是一个窗口...让我们像这样尝试一下:
创建一个帮助程序函数来检测模态元素是否在周围:
def find_modal_element
wait_until { page.find(modal_element_id).visible? }
end
然后让我们更改步骤定义:
Then /^I should see a popup window$/
find_modal_element
page.find(modal_element_id).text.must_match "Whatever you want it to match"
end
相关文章:
- 添加文字和评论功能更新Div
- JavaScript打印功能使日历停止工作
- 每当您在选择器内移动鼠标时,悬停功能就会重复
- 如何防止网页加载后自动启动功能
- 除修剪外的其他功能
- 悬停功能触发器
- 使用angularjs向浏览器发送servlet响应(下载功能)
- 删除CKEditor工具栏按钮,但不删除功能
- 异步facebook功能
- 如何将chrome扩展功能移植到移动设备(特别是jquery和trello)
- jQuery滚动功能只工作一次
- Graphiti中是否有任何工具提示功能
- React redux初始化功能,无论状态变化如何
- 在哪里可以学习ECMAScript标准中尚未包含的JavaScript功能
- 正在获取select上的功能id
- Rhino打印功能
- 黄瓜JS可以看到我的功能,但似乎没有运行这些步骤
- Twitter引导模式的黄瓜功能
- 黄瓜测试js.没有html时的动词功能.erb的存在
- 从Excel中读取黄瓜功能的数据