Skip to content

Commit

Permalink
Merge pull request #189 from open-sausages/pulls/4/smarter-stepIPress…
Browse files Browse the repository at this point in the history
…TheButton

BUG Update stepIPressTheButton to accept a list of button names separated by |
  • Loading branch information
robbieaverill authored Sep 24, 2019
2 parents 6ffbd87 + a594f44 commit bd4a737
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: php

dist: precise
dist: xenial

sudo: false

Expand Down Expand Up @@ -29,7 +29,7 @@ before_script:
- export PATH=~/.composer/vendor/bin:$PATH
- composer validate
- composer install --dev --prefer-dist
- composer require --prefer-dist --no-update silverstripe/recipe-core:1.0.x-dev
- composer require --prefer-dist --no-update silverstripe/recipe-core:^4
- composer update
- if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi
- phpenv rehash
Expand Down
18 changes: 18 additions & 0 deletions src/Context/BasicContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,24 @@ public function stepIPressTheButton($text)
$button->click();
}

/**
* @Given /^I press the "([^"]*)" buttons$/
* @param string $text A list of button names can be provided by seperating the entries with the | character.
*/
public function stepIPressTheButtons($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
Expand Down

0 comments on commit bd4a737

Please sign in to comment.