From ca19c50980f495f9610c71485ac9550dc779fa54 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 15 Apr 2021 13:22:54 +1200 Subject: [PATCH] MNT Use behat-extension function for clicking elements --- tests/behat/features/multitab-validation.feature | 9 +++++---- tests/behat/src/AdminContext.php | 12 ------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/behat/features/multitab-validation.feature b/tests/behat/features/multitab-validation.feature index 06dd66592..5bd68b68f 100644 --- a/tests/behat/features/multitab-validation.feature +++ b/tests/behat/features/multitab-validation.feature @@ -7,7 +7,8 @@ Feature: Multi-tab page validation icons Given a "multi tab page" "My MultiTab Page" And a "single tab page" "My SingleTab Page" - Scenario: I can see tab validation icons on mutli-tab pages + @sboyd + Scenario: I can see tab validation icons on multi-tab pages Given I am logged in with "ADMIN" permissions And I go to "/admin/pages" And I should see "My MultiTab Page" in the tree @@ -17,21 +18,21 @@ Feature: Multi-tab page validation icons Then I should not see an invalid tab icon on the "Second" tab Then I should see an invalid tab icon on the "Third" tab Then I should see an invalid tab icon on the "Fourth" tab - When I click the "#tab-Root_Third" element + When I click on the "#tab-Root_Third" element And I fill in "Third tab first field" with "abc" When I press the "Save" button Then I can see the form validation error message Then I should not see an invalid tab icon on the "Second" tab Then I should not see an invalid tab icon on the "Third" tab Then I should see an invalid tab icon on the "Fourth" tab - When I click the "#tab-Root_Fourth" element + When I click on the "#tab-Root_Fourth" element And I fill in "Fourth tab first field" with "def" When I press the "Save" button Then I can not see the form validation error message Then I should not see an invalid tab icon on the "Second" tab Then I should not see an invalid tab icon on the "Third" tab Then I should not see an invalid tab icon on the "Fourth" tab - When I click the "#tab-Root_Second" element + When I click on the "#tab-Root_Second" element And I fill in "Second tab first field" with "wrong value" When I press the "Save" button Then I can see the form validation error message diff --git a/tests/behat/src/AdminContext.php b/tests/behat/src/AdminContext.php index 0b26249eb..69f8b53d3 100644 --- a/tests/behat/src/AdminContext.php +++ b/tests/behat/src/AdminContext.php @@ -59,16 +59,4 @@ public function iCanSeeTheFormValidationErrorMessage($not) assertTrue(strpos($element->getText(), $text) !== false, $message); } } - - /** - * @When /^I click the "([^"]+)" element$/ - * @param $selector - */ - public function iClickTheElement($selector) - { - $page = $this->getMainContext()->getSession()->getPage(); - $element = $page->find('css', $selector); - assertNotNull($element, sprintf('Element %s not found', $selector)); - $element->click(); - } }