Skip to content

Commit

Permalink
Merge pull request #61 from creative-commoners/pulls/1/i-click-elements
Browse files Browse the repository at this point in the history
MNT Use behat-extension function for clicking elements
  • Loading branch information
bergice authored Apr 22, 2021
2 parents ab7e947 + 54cf0d2 commit d254116
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tests/behat/features/revoke.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Feature: See other devices and revoke their access
Scenario: I can see other devices and revoke their access
When I go to "/admin/security"
# Click the ADMIN user
And I click the ".col-FirstName" element
And I click on the ".col-FirstName" element
# Ensure XHR loaded from endpoint
And I wait until I see the ".login-session .text-success" element
# Assert text for the two login sessions
Then I should see the text "Current" in the ".login-session .text-success" element
Then I should see the text "Log out" in the ".login-session__logout" element
# Click "Log out" button
When I click the ".login-session__logout" element
When I click on the ".login-session__logout" element
# Wait for modal to fade in
And I wait until I see the ".modal-dialog .btn-primary" element
# Click the green button in the modal
When I click the ".modal-dialog .btn-primary" element
When I click on the ".modal-dialog .btn-primary" element
# Assert text has changed
Then I should see the text "Logging out..." in the ".login-session__logout" element
# Assert hidden element is applied which fades to not visible via a css transition
Expand Down
12 changes: 0 additions & 12 deletions tests/behat/src/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ public function iSeeTheElement($selector): void
assertNotNull($element, sprintf('Element %s not found', $selector));
}

/**
* @When /^I click the "([^"]+)" element$/
* @param $selector
*/
public function iClickTheElement(string $selector): void
{
$page = $this->getMainContext()->getSession()->getPage();
$element = $page->find('css', $selector);
assertNotNull($element, sprintf('Element %s not found', $selector));
$element->click();
}

/**
* @When /^I should see the text "([^"]+)" in the "([^"]+)" element$/
* @param $selector
Expand Down

0 comments on commit d254116

Please sign in to comment.