Add step definition for cms list

This commit is contained in:
Saophalkun Ponlu 2017-07-21 11:40:38 +12:00
parent 4af84a2f61
commit 98e77ec1c4
1 changed files with 36 additions and 0 deletions

View File

@ -122,6 +122,20 @@ class CmsUiContext implements Context
return $cms_tree_element;
}
protected function getCmsListElement()
{
$this->getSession()->wait(
5000,
"document.querySelector('.cms-lists') !== null"
);
$page = $this->getSession()->getPage();
$cms_list_element = $page->find('css', '.cms-list');
assertNotNull($cms_list_element, 'CMS list not found');
return $cms_list_element;
}
/**
* @Given /^I should see a "([^"]*)" button in CMS Content Toolbar$/
*/
@ -155,6 +169,28 @@ class CmsUiContext implements Context
assertNull($element, sprintf('%s found', $text));
}
/**
* @When /^I should see "([^"]*)" in the list$/
*/
public function stepIShouldSeeInCmsList($text)
{
// Wait until visible
$cmsListElement = $this->getCmsListElement();
$element = $cmsListElement->find('named', array('content', "'$text'"));
assertNotNull($element, sprintf('%s not found', $text));
}
/**
* @When /^I should not see "([^"]*)" in the list$/
*/
public function stepIShouldNotSeeInCmsList($text)
{
// Wait until visible
$cmsListElement = $this->getCmsListElement();
$element = $cmsListElement->find('named', array('content', "'$text'"));
assertNull($element, sprintf('%s not found', $text));
}
/**
* @When /^I should see a "([^"]*)" tab in the CMS content header tabs$/
*/