From 708ae8aa0f92cdbbf854bae823450d1aa73548c1 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 18 Feb 2021 08:02:54 +0800 Subject: [PATCH] MDL-47410 behat: Perform exact match for date_time selectors --- lib/behat/classes/partial_named_selector.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index f987b015738..7965f49f5f5 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -268,7 +268,7 @@ XPATH XPATH , 'date_time' => << [ 'moodle' => 'contains(./@aria-label, %locator%)', ], + '%exactTagTextMatch%' => [ + // This is based upon the upstream tagTextMatch but performs an exact match rather than a loose match using + // contains(). + // If possible we should only use exact matches for any new form fields that we add. + 'moodle' => 'normalize-space(text())=%locator%', + ], ]; /** @var List of deprecated selectors */