diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php index 267887a8f14..5cdc18ea358 100644 --- a/grade/edit/tree/lib.php +++ b/grade/edit/tree/lib.php @@ -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'] : ''; diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 9f8f292a857..c5f97ed3ce7 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -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 . ")]";