MDL-77632 core_grades: Fix row_column_of_table_should_contain()

This commit is contained in:
Mihail Geshoski
2023-06-12 13:06:13 +08:00
committed by Ilya Tregubov
parent 65cafd36cc
commit 3643f48e0f
2 changed files with 4 additions and 12 deletions
+2 -10
View File
@@ -855,16 +855,8 @@ class grade_edit_tree_column_name extends grade_edit_tree_column {
$itemicon = \html_writer::div($params['icon'], 'mr-1');
$itemtype = \html_writer::span($params['type'], 'd-block text-uppercase small dimmed_text');
// Generate the content for a cell that represents a grade item.
// If a behat test site is running avoid outputting the information about the type of the grade item.
// This additional information causes issues in behat particularly with the existing xpath used to
// interact with table elements.
if (!defined('BEHAT_SITE_RUNNING')) {
$content = \html_writer::div($itemtype . $params['name']);
} else {
$content = \html_writer::div($params['name']);
}
$itemtitle = html_writer::div($params['name'], 'rowtitle');
$content = \html_writer::div($itemtype . $itemtitle);
$moveaction = isset($params['moveaction']) ? $params['moveaction'] : '';
+2 -2
View File
@@ -1456,8 +1456,8 @@ EOF;
// Check if value exists in specific row/column.
// Get row xpath.
// GoutteDriver uses DomCrawler\Crawler and it is making XPath relative to the current context, so use descendant.
$rowxpath = $tablexpath."/tbody/tr[descendant::th[normalize-space(.)=" . $rowliteral .
"] | descendant::td[normalize-space(.)=" . $rowliteral . "]]";
$rowxpath = $tablexpath . "/tbody/tr[descendant::*[@class='rowtitle'][normalize-space(.)=" . $rowliteral . "] | " . "
descendant::th[normalize-space(.)=" . $rowliteral . "] | descendant::td[normalize-space(.)=" . $rowliteral . "]]";
$columnvaluexpath = $rowxpath . $columnpositionxpath . "[contains(normalize-space(.)," . $valueliteral . ")]";