From 54cf0d2bc580c98a479d2c1f888babdbf494c2c1 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Apr 2021 13:47:49 +1200 Subject: [PATCH] MNT Use behat-extension function for clicking elements --- tests/behat/features/revoke.feature | 6 +++--- tests/behat/src/FixtureContext.php | 12 ------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/behat/features/revoke.feature b/tests/behat/features/revoke.feature index 2d67a27..1415ac7 100644 --- a/tests/behat/features/revoke.feature +++ b/tests/behat/features/revoke.feature @@ -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 diff --git a/tests/behat/src/FixtureContext.php b/tests/behat/src/FixtureContext.php index 3344e31..04dcfce 100644 --- a/tests/behat/src/FixtureContext.php +++ b/tests/behat/src/FixtureContext.php @@ -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