【发布时间】:2017-07-25 08:10:03
【问题描述】:
使用 Codeception 和 Gherkin,我试图弄清楚如何测试文本光标位置的自动更新:
When I click "New post"
Then the blinking text cursor should be in the "Title" field
代码是这样的:
<a href="#" id="js-move-text-cursor-to-post-title-input">
New post
</a>
…
<label>
Title
<input type="text" name="title">
</label>
…
<!-- Some JavaScript to set the text cursor to the "Title" input field -->
那么,我的问题是,我可以在下面的步骤定义中写什么来测试这个功能?
/**
* @Then the blinking text cursor should be in the :label field
* @param string $label
*/
public function theBlinkingTextCursorShouldBeInTheField(string $label)
{
// @TODO
}
tests/acceptance.suite.yml:
actor: AcceptanceTester
modules:
enabled:
- Symfony:
part: SERVICES
- Doctrine2:
depends: Symfony
- WebDriver:
url: http://localhost:8000
browser: chrome
- \Helper\Acceptance
【问题讨论】:
标签: php selenium webdriver bdd codeception