Skip to content

Commit

Permalink
MNT Use behat-extension function for clicking elements
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 15, 2021
1 parent 037afdd commit ca19c50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
9 changes: 5 additions & 4 deletions tests/behat/features/multitab-validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 0 additions & 12 deletions tests/behat/src/AdminContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit ca19c50

Please sign in to comment.