From bc7a59536b4940779159f558d0ff9d239fe14c04 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 1 Jul 2015 10:52:21 +0800 Subject: [PATCH] MDL-50481 behat: SingleSelect can be urlselect and should support id/name --- lib/tests/behat/behat_forms.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 5b3378cacc2..932dec3a355 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -395,8 +395,13 @@ class behat_forms extends behat_base { if (!$this->running_javascript()) { // Press button in the specified select container. - $containerxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' singleselect ') and " . - ".//label[contains(normalize-space(string(.)), '" . $singleselect . "')]]"; + $containerxpath = "//div[" . + "(contains(concat(' ', normalize-space(@class), ' '), ' singleselect ') " . + "or contains(concat(' ', normalize-space(@class), ' '), ' urlselect ')". + ") and ( + .//label[contains(normalize-space(string(.)), '" . $singleselect . "')] " . + "or .//select[(./@name='" . $singleselect . "' or ./@id='". $singleselect . "')]" . + ")]"; $actions[] = new Given('I click on "' . get_string('go') . '" "button" in the "' . $containerxpath . '" "xpath_element"');