From b903d21ea214e54b2ce21468c50998a40e13fb84 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 18 Nov 2022 20:40:31 +0000 Subject: [PATCH 1/2] MDL-76398 behat: broader action menu partial matching by element. For action menu elements whose trigger element isn't plain text (e.g. a pix icon), we should be able to match via the title of that element. --- lib/behat/classes/partial_named_selector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index 99c7d1b12a6..8591aa737a1 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -147,7 +147,7 @@ XPATH descendant::*[ contains(concat(' ', normalize-space(@class), ' '), ' dropdown-toggle ') and - contains(normalize-space(.), %locator%) + (contains(normalize-space(.), %locator%) or descendant::*[%titleMatch%]) ] ] XPATH From 91e96925c9c0a9983622870936f56c7cd32680f5 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 21 Nov 2022 11:44:55 +0000 Subject: [PATCH 2/2] MDL-76398 reportbuilder: use improved action menu steps in Behat. Improved steps for using actions menus were added in 232ebac3, so make use of them here for consistency/reliability. --- reportbuilder/tests/behat/behat_reportbuilder.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reportbuilder/tests/behat/behat_reportbuilder.php b/reportbuilder/tests/behat/behat_reportbuilder.php index 10818fbc889..9db24f09a7e 100644 --- a/reportbuilder/tests/behat/behat_reportbuilder.php +++ b/reportbuilder/tests/behat/behat_reportbuilder.php @@ -109,7 +109,11 @@ class behat_reportbuilder extends behat_base { * @param string $row */ public function i_press_action_in_the_report_row(string $action, string $row): void { - $this->execute('behat_action_menu::i_open_the_action_menu_in', [$this->escape($row), 'table_row']); - $this->execute('behat_action_menu::i_choose_in_the_open_action_menu', [$this->escape($action)]); + $this->execute('behat_action_menu::i_choose_in_the_named_menu_in_container', [ + $this->escape($action), + get_string('actions', 'core_reportbuilder'), + $this->escape($row), + 'table_row', + ]); } }