Merge branch 'MDL-75081-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2024-02-07 10:38:03 +08:00
commit e5b9510af2
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
6 changed files with 48 additions and 27 deletions

View File

@ -27,8 +27,8 @@ Feature: Confirm that we can open multiple browser tabs
# Switch between all the tabs and confirm their different contents.
Then I should see "No courses"
And I switch to "CourseViewer2" tab
And I should see "Course 3" in the "h1" "css_element"
And "Course 3" "heading" should exist
And I switch to "CourseViewer1" tab
And I should see "Course 2" in the "h1" "css_element"
And "Course 2" "heading" should exist
And I switch to the main tab
And I should see "Course 1" in the "h1" "css_element"
And "Course 1" "heading" should exist

View File

@ -27,36 +27,36 @@ Feature: Teacher can navigate to the previous or next user report.
Scenario: A teacher can navigate to the next user report
Given I click on "Student 1" in the "user" search widget
And I should see "Student 1" in the ".user-heading" "css_element"
And "Student 1" "heading" should exist
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"
When I click on "Student 2" "link" in the ".next" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And "Student 2" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 3" "link" in the ".next" "css_element"
And I should see "Student 3" in the ".user-heading" "css_element"
And "Student 3" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"
Scenario: A teacher can navigate to the previous user report
Given I click on "Student 3" in the "user" search widget
And I should see "Student 3" in the ".user-heading" "css_element"
And "Student 3" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"
When I click on "Student 2" "link" in the ".previous" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And "Student 2" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 1" "link" in the ".previous" "css_element"
And I should see "Student 1" in the ".user-heading" "css_element"
And "Student 1" "heading" should exist
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"

View File

@ -63,6 +63,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I set the field "Grade out of 100" to "70"
And I press "Save changes"
When I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode off
Then the following should exist in the "gradereport-grader-table" table:
| | | |
| First name / Last name | Assignment 1 | Course total |

View File

@ -104,6 +104,7 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
'group_message_tab' => 'group_message_tab',
'group_message_list_area' => 'group_message_list_area',
'group_message_message_content' => 'group_message_message_content',
'heading' => 'heading',
'icon_container' => 'icon_container',
'icon' => 'icon',
'link' => 'link',
@ -205,6 +206,9 @@ XPATH
XPATH
, 'group_message_message_content' => <<<XPATH
.//*[@data-region='message-drawer']//*[@data-region='message' and @data-message-id and contains(., %locator%)]
XPATH
, 'heading' => <<<XPATH
.//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][contains(normalize-space(.), %locator%)]
XPATH
, 'icon_container' => <<<XPATH
.//span[contains(@data-region, concat(%locator%,'-icon-container'))]

View File

@ -1466,12 +1466,19 @@ EOF;
$datahash = $data->getHash();
foreach ($datahash as $row) {
$firstcell = null;
foreach ($row as $column => $value) {
if ($firstcell === null) {
$firstcell = $value;
} else {
$this->row_column_of_table_should_contain($firstcell, $column, $table, $value);
// Row contains only a single column, just assert it's present in the table.
if (count($row) === 1) {
$this->execute('behat_general::assert_element_contains_text', [reset($row), $table, 'table']);
} else {
// Iterate over all columns.
$firstcell = null;
foreach ($row as $column => $value) {
if ($firstcell === null) {
$firstcell = $value;
} else {
$this->row_column_of_table_should_contain($firstcell, $column, $table, $value);
}
}
}
}
@ -1491,18 +1498,25 @@ EOF;
$datahash = $data->getHash();
foreach ($datahash as $value) {
$row = array_shift($value);
foreach ($value as $column => $value) {
try {
$this->row_column_of_table_should_contain($row, $column, $table, $value);
// Throw exception if found.
} catch (ElementNotFoundException $e) {
// Table row/column doesn't contain this value. Nothing to do.
continue;
// Row contains only a single column, just assert it's not present in the table.
if (count($value) === 1) {
$this->execute('behat_general::assert_element_not_contains_text', [reset($value), $table, 'table']);
} else {
// Iterate over all columns.
$row = array_shift($value);
foreach ($value as $column => $value) {
try {
$this->row_column_of_table_should_contain($row, $column, $table, $value);
// Throw exception if found.
} catch (ElementNotFoundException $e) {
// Table row/column doesn't contain this value. Nothing to do.
continue;
}
throw new ExpectationException('"' . $column . '" with value "' . $value . '" is present in "' .
$row . '" row for table "' . $table . '"', $this->getSession()
);
}
throw new ExpectationException('"' . $column . '" with value "' . $value . '" is present in "' .
$row . '" row for table "' . $table . '"', $this->getSession()
);
}
}
}

View File

@ -1,8 +1,10 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 4.1.8 ===
=== 4.1.9
* New Behat `heading` named selector to more easily assert the presence of H1-H6 elements on the page
=== 4.1.8 ===
* The current page language is available in new `core/config` language property for Javascript modules
=== 4.1.7 ===