MDL-68353 test: get_field_locator to support custom field labels
This commit is contained in:
@@ -221,7 +221,9 @@ XPATH
|
||||
.//*[contains(., %locator%) and not(.//*[contains(., %locator%)])]
|
||||
XPATH
|
||||
, 'form_row' => <<<XPATH
|
||||
.//*[self::label or self::div[contains(concat(' ', @class, ' '), ' fstaticlabel ')]][contains(., %locator%)]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]
|
||||
.//*[contains(concat(' ', @class, ' '), ' col-form-label ')]
|
||||
[normalize-space(.)= %locator%]
|
||||
/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]
|
||||
XPATH
|
||||
, 'autocomplete_selection' => <<<XPATH
|
||||
.//div[contains(concat(' ', normalize-space(@class), ' '), concat(' ', 'form-autocomplete-selection', ' '))]/span[@role='listitem'][contains(normalize-space(.), %locator%)]
|
||||
|
||||
@@ -251,7 +251,7 @@ class behat_form_field {
|
||||
// Defaults to label.
|
||||
if ($locatortype == 'label' || $locatortype == false) {
|
||||
|
||||
$labelnode = $this->session->getPage()->find('xpath', '//label[@for="' . $fieldid . '"]');
|
||||
$labelnode = $this->session->getPage()->find('xpath', "//label[@for='$fieldid']|//p[@id='{$fieldid}_label']");
|
||||
|
||||
// Exception only if $locatortype was specified.
|
||||
if (!$labelnode && $locatortype == 'label') {
|
||||
|
||||
Reference in New Issue
Block a user