Using Codeception and Gherkin, I'm trying to figure out how to test the automatic updating of text cursor position:
When I click "New post"
Then the blinking text cursor should be in the "Title" field
The code is something like this:
<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 -->
So, my question is, what can I write in the following step definition to test this feature?
/**
* @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
This seems very similar to another question that was asked: https://stackoverflow.com/a/44165078/1668200
Maybe the answers to that question would help you out.