From d178652cf83abfbb822557401997b5ff2832752b Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Apr 2021 13:25:47 +1200 Subject: [PATCH] MNT Use behat-extension function for clicking elements --- tests/behat/features/next-form-step.feature | 8 ++++---- tests/behat/src/FixtureContext.php | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/behat/features/next-form-step.feature b/tests/behat/features/next-form-step.feature index 233ba73..adbfd29 100644 --- a/tests/behat/features/next-form-step.feature +++ b/tests/behat/features/next-form-step.feature @@ -10,12 +10,12 @@ Feature: Next form step for userforms When I go to "/my-userform" And I wait for 2 seconds And the ".progress-title" element should contain "EditableFormStep_01" - When I click the ".step-button-next" element + When I click on the ".step-button-next" element Then the ".progress-title" element should contain "EditableFormStep_03" - When I click the ".step-button-prev" element + When I click on the ".step-button-prev" element And I fill in "abc" for "EditableTextField_01" - And I click the ".step-button-next" element + And I click on the ".step-button-next" element Then the ".progress-title" element should contain "EditableFormStep_02" # prevent the 'form has unsaved changes' alrt - When I click the ".step-button-prev" element + When I click on the ".step-button-prev" element And I fill in "" for "EditableTextField_01" diff --git a/tests/behat/src/FixtureContext.php b/tests/behat/src/FixtureContext.php index 21732c3..5f6cf47 100644 --- a/tests/behat/src/FixtureContext.php +++ b/tests/behat/src/FixtureContext.php @@ -15,18 +15,6 @@ use SilverStripe\Versioned\Versioned; */ class FixtureContext extends BaseFixtureContext { - /** - * @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(); - } - /** * Example: Given a userform with a hidden form step "My userform" *