diff --git a/tests/behat/src/CmsUiContext.php b/tests/behat/src/CmsUiContext.php index 0eeae3ff8..45a7a8c87 100644 --- a/tests/behat/src/CmsUiContext.php +++ b/tests/behat/src/CmsUiContext.php @@ -155,6 +155,15 @@ class CmsUiContext implements Context assertNull($element, sprintf('%s found', $text)); } + /** + * @When /^I should see a "([^"]*)" tab in the CMS content header tabs$/ + */ + public function stepIShouldSeeInCMSContentTabs($text) + { + // Wait until visible + assertNotNull($this->getCmsTabElement($text), sprintf('%s content tab not found', $text)); + } + /** * Applies a specific action to an element * @@ -219,6 +228,44 @@ class CmsUiContext implements Context $this->interactWithElement($treeNode, $method); } + /** + * @When /^I (?P(?:(?:double |right |left |)click)|hover) on "(?P[^"]*)" in the header tabs$/ + */ + public function stepIClickOnElementInTheHeaderTabs($method, $text) + { + $tabsNode = $this->getCmsTabElement($text); + assertNotNull($tabsNode, sprintf('%s not found', $text)); + $this->interactWithElement($tabsNode, $method); + } + + /** + * @Then the :text header tab should be active + */ + public function theHeaderTabShouldBeActive($text) + { + $element = $this->getCmsTabElement($text); + assertNotNull($element); + assertTrue($element->hasClass('active')); + } + + /** + * @Then the :text header tab should not be active + */ + public function theHeaderTabShouldNotBeActive($text) + { + $element = $this->getCmsTabElement($text); + assertNotNull($element); + assertFalse($element->hasClass('active')); + } + + /** + * @return NodeElement + */ + protected function getCmsTabElement($text) + { + return $this->getCmsTabsElement()->findLink($text); + } + /** * @When /^I expand the "([^"]*)" CMS Panel$/ */