irs/behat-popup-extension

使用 Selenium 2 进行弹出窗口操作的 Behat 上下文。

dev-master 2014-01-27 10:59 UTC

This package is auto-updated.

Last update: 2024-09-22 20:39:26 UTC


README

Build Status

该扩展向功能上下文中添加以下步骤定义,允许测试弹出窗口:

Given /^(?:|I )press ok on alert$/
Given /^(?:|I )press ok on confirmation$/
Given /^(?:|I )press ok on input popup$/
Given /^(?:|I ) press cancel on confirmation$/
Given /^(?:|I ) press cancel on input popup$/
Given /^(?:|I ) type "([^"]*)" into input popup$/
Given /^the alert message should contain "([^"]*)"$/
Given /^the confirmation message should contain "([^"]*)"$/
Given /^the prompt message should contain "([^"]*)"$/
Given /^the alert message should not contain "([^"]*)"$/
Given /^the confirmation message should not contain "([^"]*)"$/
Given /^the prompt message should not contain "([^"]*)"$/

安装

安装扩展的最简单方法是向您的 composer.json 文件中添加以下代码:

{
    "require": {
        "irs/behat-popup-extension": "dev-master"
    }
}

之后,执行 composer install 并将以下行添加到 behat.yml 文件中,以启用扩展:

default:
  extensions:
    Irs\BehatPopupExtension\Extension: ~

现在您可以在功能上下文中使用 Irs\BehatPopupExtension\PopupContext 特性。并且不要忘记功能上下文应该实现 Behat\MinkExtension\Context\MinkAwareInterface 接口。