MDL-47410 behat: Perform exact match for date_time selectors

This commit is contained in:
Andrew Nicols 2021-02-18 08:02:54 +08:00
parent 46fd92b938
commit 708ae8aa0f

View File

@ -268,7 +268,7 @@ XPATH
XPATH
,
'date_time' => <<<XPATH
.//fieldset[(%idMatch% or ./legend[%tagTextMatch%]) and (@data-fieldtype='date' or @data-fieldtype='date_time')]
.//fieldset[(%idMatch% or ./legend[%exactTagTextMatch%]) and (@data-fieldtype='date' or @data-fieldtype='date_time')]
XPATH
],
];
@ -287,6 +287,12 @@ XPATH
'%ariaLabelMatch%' => [
'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 */