mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
BUG Add a method that allow multiple button to be search for and press
This commit is contained in:
parent
6ffbd879dc
commit
f94ff57604
@ -442,6 +442,24 @@ JS;
|
||||
$button->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I press one of these buttons "([^"]*)"$/
|
||||
* @param string $text A list of button names can be provided by seperating the entries with the | character.
|
||||
*/
|
||||
public function stepIPressOneOfTheseButtons($text)
|
||||
{
|
||||
$buttonNames = explode('|', $text);
|
||||
foreach ($buttonNames as $name) {
|
||||
$button = $this->findNamedButton(trim($name));
|
||||
if ($button) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull($button, "{$text} button not found");
|
||||
$button->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Needs to be in single command to avoid "unexpected alert open" errors in Selenium.
|
||||
* Example1: I press the "Remove current combo" button, confirming the dialog
|
||||
|
Loading…
Reference in New Issue
Block a user