diff --git a/tests/behat/src/CmsUiContext.php b/tests/behat/src/CmsUiContext.php index 45a7a8c87..a1c053794 100644 --- a/tests/behat/src/CmsUiContext.php +++ b/tests/behat/src/CmsUiContext.php @@ -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$/ */