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