Merge branch 'MDL-75081-402' of https://github.com/paulholden/moodle into MOODLE_402_STABLE

This commit is contained in:
Jun Pataleta
2024-02-07 10:37:12 +08:00
8 changed files with 56 additions and 43 deletions
+3 -3
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 "You're not enrolled in any course"
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
@@ -77,14 +77,14 @@ Feature: Within the grader report, test that we can search for users
And I wait until the page is ready
And the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |
# Case: No users found.
When I set the field "Search users" to "Plagiarism"
@@ -92,14 +92,14 @@ Feature: Within the grader report, test that we can search for users
# Table remains unchanged as the user had no results to select from the dropdown.
And the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |
# Case: Multiple users found and select only one result.
Then I set the field "Search users" to "User"
@@ -222,17 +222,18 @@ Feature: Within the grader report, test that we can search for users
And "User Example" "list_item" should exist in the ".user-search" "css_element"
And "User Test" "list_item" should exist in the ".user-search" "css_element"
And "Student 1" "list_item" should exist in the ".user-search" "css_element"
And I press the down key
And I press the enter key
And I wait until the page is ready
And I wait "1" seconds
And the following should exist in the "user-grades" table:
| -1- |
| Student 1 |
And the following should not exist in the "user-grades" table:
| -1- |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
@accessibility
@@ -378,7 +379,7 @@ Feature: Within the grader report, test that we can search for users
And the following should exist in the "user-grades" table:
| -1- |
| Student test31 |
And the following should exist in the "user-grades" table:
And the following should not exist in the "user-grades" table:
| -1- |
| Student test32 |
And I click on "Clear" "link" in the ".user-search" "css_element"
@@ -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"
@@ -62,6 +62,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 |
@@ -52,7 +52,7 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "user-grades" table:
And the following should not exist in the "setup-grades" table:
| Test assignment two |
| Manual grade |
| Category 1 total |
@@ -137,8 +137,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse the grade category 'Category 1'.
@@ -164,8 +162,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse again the grade category 'Category 1'.
@@ -180,8 +176,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
# Expand the grade category 'Course'. 'Category 1' should be still collapsed.
And I click on "Expand" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
@@ -189,7 +183,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "setup-grades" table:
@@ -227,7 +220,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "setup-grades" table:
@@ -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',
@@ -206,6 +207,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'))]
+31 -17
View File
@@ -1511,12 +1511,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);
}
}
}
}
@@ -1536,18 +1543,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()
);
}
}
}
+1
View File
@@ -4,6 +4,7 @@ information provided here is intended especially for developers.
=== 4.2.6 ===
* The `html_writer::select_time` method has a `$timezone` parameter to use when formatting the time parameter
* New Behat `heading` named selector to more easily assert the presence of H1-H6 elements on the page
=== 4.2.5 ===