NEW Add Behat CMS header tab context methods

This commit is contained in:
Robbie Averill 2017-07-16 23:41:24 +12:00
parent 7fd316d405
commit 2dd5bb4d19

View File

@ -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,40 @@ class CmsUiContext implements Context
$this->interactWithElement($treeNode, $method);
}
/**
* @When /^I (?P<method>(?:(?:double |right |left |)click)|hover) on "(?P<text>[^"]*)" 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)
{
assertTrue($this->getCmsTabElement($text)->hasClass('active'));
}
/**
* @Then the :text header tab should not be active
*/
public function theHeaderTabShouldNotBeActive($text)
{
assertFalse($this->getCmsTabElement($text)->hasClass('active'));
}
/**
* @return NodeElement
*/
protected function getCmsTabElement($text)
{
return $this->getCmsTabsElement()->findLink($text);
}
/**
* @When /^I expand the "([^"]*)" CMS Panel$/
*/