MDL-68353 test: Update filemanager/filepicker xpath selector

This commit is contained in:
Shamim Rezaie 2020-05-14 20:16:43 +10:00
parent 9b6efe3aea
commit 58994fe8bb
4 changed files with 5 additions and 7 deletions

View File

@ -255,7 +255,7 @@ XPATH
,
'filemanager' => <<<XPATH
.//*[@data-fieldtype = 'filemanager' or @data-fieldtype = 'filepicker']
/descendant::input[@id = //label[contains(normalize-space(string(.)), %locator%)]/@for]
/descendant::input[@id = substring-before(//p[contains(normalize-space(string(.)), %locator%)]/@id, '_label')]
XPATH
,
'passwordunmask' => <<<XPATH

View File

@ -74,7 +74,7 @@ trait core_behat_file_helper {
$filepickerelement = behat_context_helper::escape($filepickerelement);
$filepickercontainer = $this->find(
'xpath',
"//input[./@id = //label[normalize-space(.)=$filepickerelement]/@for]" .
"//input[./@id = substring-before(//p[normalize-space(.)=$filepickerelement]/@id, '_label')]" .
"//ancestor::*[@data-fieldtype = 'filemanager' or @data-fieldtype = 'filepicker']",
$exception
);

View File

@ -68,7 +68,7 @@ class behat_form_filemanager extends behat_form_field {
$fieldlabel = $this->get_field_locator();
// Get the name of the current directory elements.
$xpath = "//label[contains(., '" . $fieldlabel . "')]" .
$xpath = "//p[normalize-space(.)='$fieldlabel']" .
"/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')]" .
"/descendant::div[@data-fieldtype = 'filemanager']" .
"/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-filename ')]";

View File

@ -209,10 +209,8 @@ class behat_repository_upload extends behat_base {
$filepickerelement = behat_context_helper::escape($filepickerelement);
$filepickercontainer = $this->find(
'xpath',
"//input[./@id = //label[normalize-space(.)=$filepickerelement]/@for]" .
"//ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' felement ')] |" .
"//input[./@id = //label[normalize-space(.)=$filepickerelement]/@for]" .
"//ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-setting ')]",
"//input[./@id = substring-before(//p[normalize-space(.)=$filepickerelement]/@id, '_label')]" .
"//ancestor::*[@data-fieldtype = 'filemanager' or @data-fieldtype = 'filepicker']",
$exception
);
}