From f94ff57604a2295bef1c1e4d97a01f539aabf18d Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Tue, 24 Sep 2019 13:58:15 +1200 Subject: [PATCH 1/3] BUG Add a method that allow multiple button to be search for and press --- src/Context/BasicContext.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Context/BasicContext.php b/src/Context/BasicContext.php index ba632e8..3883644 100644 --- a/src/Context/BasicContext.php +++ b/src/Context/BasicContext.php @@ -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 From 09cf3ca9160fb451fc3e42e9017770c3ef3e762e Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Tue, 24 Sep 2019 13:58:47 +1200 Subject: [PATCH 2/3] BUG Fix Travis build config --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6366014..31200a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -dist: precise +dist: xenial sudo: false @@ -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 From a594f4418884402949d32ffd653bd56eef615996 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Tue, 24 Sep 2019 15:29:11 +1200 Subject: [PATCH 3/3] Rename click-oneoof-these-buttons method --- src/Context/BasicContext.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Context/BasicContext.php b/src/Context/BasicContext.php index 3883644..1b3ae49 100644 --- a/src/Context/BasicContext.php +++ b/src/Context/BasicContext.php @@ -443,10 +443,10 @@ JS; } /** - * @Given /^I press one of these buttons "([^"]*)"$/ + * @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 stepIPressOneOfTheseButtons($text) + public function stepIPressTheButtons($text) { $buttonNames = explode('|', $text); foreach ($buttonNames as $name) {