mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 15:05:32 +00:00
Only match visible buttons in "I press button" step
This commit is contained in:
parent
88de98e03d
commit
5e879a88b8
@ -267,10 +267,13 @@ JS;
|
|||||||
public function stepIPressTheButton($button)
|
public function stepIPressTheButton($button)
|
||||||
{
|
{
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
|
$els = $page->findAll('named', array('link_or_button', "'$button'"));
|
||||||
$buttonElement = $page->find('named', array('link_or_button', "'$button'"));
|
$matchedEl = null;
|
||||||
assertNotNull($buttonElement, sprintf('%s button not found', $button));
|
foreach($els as $el) {
|
||||||
$buttonElement->click();
|
if($el->isVisible()) $matchedEl = $el;
|
||||||
|
}
|
||||||
|
assertNotNull($matchedEl, sprintf('%s button not found', $button));
|
||||||
|
$matchedEl->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user