mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Limit "should see a button" to actually visible elements
This commit is contained in:
parent
17bca1db86
commit
7dfe5ccbd2
@ -105,8 +105,12 @@ class CmsFormsContext extends BehatContext
|
|||||||
public function iShouldSeeAButton($text)
|
public function iShouldSeeAButton($text)
|
||||||
{
|
{
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$element = $page->find('named', array('link_or_button', "'$text'"));
|
$els = $page->findAll('named', array('link_or_button', "'$text'"));
|
||||||
assertNotNull($element, sprintf('%s button not found', $text));
|
$matchedEl = null;
|
||||||
|
foreach($els as $el) {
|
||||||
|
if($el->isVisible()) $matchedEl = $el;
|
||||||
|
}
|
||||||
|
assertNotNull($matchedEl, sprintf('%s button not found', $text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,8 +119,12 @@ class CmsFormsContext extends BehatContext
|
|||||||
public function iShouldNotSeeAButton($text)
|
public function iShouldNotSeeAButton($text)
|
||||||
{
|
{
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$element = $page->find('named', array('link_or_button', "'$text'"));
|
$els = $page->findAll('named', array('link_or_button', "'$text'"));
|
||||||
assertNull($element, sprintf('%s button found', $text));
|
$matchedEl = null;
|
||||||
|
foreach($els as $el) {
|
||||||
|
if($el->isVisible()) $matchedEl = $el;
|
||||||
|
}
|
||||||
|
assertNull($matchedEl, sprintf('%s button found', $text));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user