ixis / codeception-utilities
此包已被弃用且不再维护。未建议替代包。
Codeception 通用助手和实用方法。
dev-develop
2016-05-05 13:40 UTC
Requires
- php: >=5.4.0
- codeception/codeception: ~2.0.0
This package is not auto-updated.
Last update: 2020-08-16 18:35:39 UTC
README
一些 Codeception 通用助手和实用方法。
- seeLinkInSelector/dontSeeLinkInSelector - 在特定的 CSS 或 XPath 选择器中查找链接。
- seeElementHasStyle/dontSeeElementHasStyle - 检查元素是否应用了样式。允许您检查单个元素是否分配了 CSS 样式,例如,您可以检查 ".icon-r" 类是否向右浮动。需要 WebDriver。
- seeRegexInSource/dontSeeRegexInSource - 页面源代码与正则表达式匹配。
CkEditor 实用工具
- fillCkEditor - 填充 CKEditor WYSIWYG 字段。
- grabCkEditorValue - 获取 CKEditor 字段的当前值。
- seeInCkEditor/dontSeeInCkEditor - 在 CKEditor 实例中查看指定的文本。
安装
将其添加到您的 composer.json,例如:
{
"repositories": [
{
"type":"vcs",
"url":"git@github.com:ixis/codeception-utilities.git"
}
],
"require": {
"ixis/codeception-utilities": "dev-develop"
}
}
配置
modules:
enabled:
- CodeceptionUtilities
- CodeceptionCkEditorUtilities
示例
// See a link with title and URL as specified in the element selected by "#content #footer".
$I->seeLinkInSelector("Facebook", "https://#/", "#content #footer");
// See the element selected by "#footer .icon-r" has the float:right style applied.
$I->seeElementHasStyle("#footer .icon-r", "float", "right");
// Set the ckeditor with id "editor1" to "<p>hello world</p>"
$I->fillCkEditor("editor1", "<p>hello world</p>");
// Grab the current value of the ckeditor field and assert it contains "hello"
$value = $I->grabCkEditorValue("editor1");
PHPUnit_Framework_Assert::assertContains("hello", $value);
// or, if using Asserts Codeception module:
$I->assertContains("hello", $value)