Only match visible buttons in "I press button" step

This commit is contained in:
Ingo Schommer 2013-06-07 16:26:00 +02:00
parent 88de98e03d
commit 5e879a88b8

View File

@ -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();
}
/**