mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02: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)
|
||||
{
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$buttonElement = $page->find('named', array('link_or_button', "'$button'"));
|
||||
assertNotNull($buttonElement, sprintf('%s button not found', $button));
|
||||
$buttonElement->click();
|
||||
$els = $page->findAll('named', array('link_or_button', "'$button'"));
|
||||
$matchedEl = null;
|
||||
foreach($els as $el) {
|
||||
if($el->isVisible()) $matchedEl = $el;
|
||||
}
|
||||
assertNotNull($matchedEl, sprintf('%s button not found', $button));
|
||||
$matchedEl->click();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user