Merge pull request #7177 from robbieaverill/pulls/4.0/cms-header-tabs-behat-context

NEW Add Behat CMS header tab context methods
This commit is contained in:
Damian Mooyman 2017-07-17 10:51:10 +12:00 committed by GitHub
commit 6f50e080ad

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,44 @@ 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)
{
$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$/
*/