MDL-77033 core_behat: Refactor behat steps to be reusable.

We will need similar step definitions for gradebook setup page.
So moving those from grader plugin to the core.
This commit is contained in:
Ilya Tregubov 2023-03-06 10:34:38 +08:00
parent 9ba802ca0c
commit 8b4bc3d31a
11 changed files with 235 additions and 244 deletions

View file

@ -93,134 +93,6 @@ class behat_gradereport_grader extends behat_base {
throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
}
/**
* Gets course grade category id from coursename.
*
* @throws Exception
* @param string $coursename
* @return int
*/
protected function get_course_grade_category_id(string $coursename) : int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE c.fullname = ?
AND gc.depth = 1";
if ($id = $DB->get_field_sql($sql, [$coursename])) {
return $id;
}
throw new Exception('The specified course grade category with course name "' . $coursename . '" does not exist');
}
/**
* Gets grade category id from its name.
*
* @throws Exception
* @param string $categoryname
* @return int
*/
protected function get_grade_category_id(string $categoryname) : int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE gc.fullname = ?";
if ($id = $DB->get_field_sql($sql, [$categoryname])) {
return $id;
}
throw new Exception('The specified grade category with name "' . $categoryname . '" does not exist');
}
/**
* Clicks on given grade item menu.
*
* @Given /^I click on grade item menu "([^"]*)"$/
* @param string $itemname
*/
public function i_click_on_grade_item_menu(string $itemname) {
$xpath = $this->get_gradeitem_selector($itemname);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Clicks on course grade category menu.
*
* @Given /^I click on course grade category menu "([^"]*)"$/
* @param string $coursename
*/
public function i_click_on_course_category_menu(string $coursename) {
$xpath = $this->get_course_grade_category_selector($coursename);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Clicks on given grade category menu.
*
* @Given /^I click on grade category menu "([^"]*)"$/
* @param string $categoryname
*/
public function i_click_on_category_menu(string $categoryname) {
$xpath = $this->get_grade_category_selector($categoryname);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Gets unique xpath selector for a grade item.
*
* @throws Exception
* @param string $itemname
* @return string
*/
protected function get_gradeitem_selector(string $itemname) : string {
$itemid = $this->get_grade_item_id($itemname);
return "//table[@id='user-grades']//*[@data-type='item'][@data-id='" . $itemid . "']";
}
/**
* Gets unique xpath selector for a course category.
*
* @throws Exception
* @param string $coursename
* @return string
*/
protected function get_course_grade_category_selector(string $coursename) {
$itemid = $this->get_course_grade_category_id($coursename);
return "//table[@id='user-grades']//*[@data-type='category'][@data-id='" . $itemid . "']";
}
/**
* Gets unique xpath selector for a grade category.
*
* @throws Exception
* @param string $categoryname
* @return string
*/
protected function get_grade_category_selector(string $categoryname) : string {
$itemid = $this->get_grade_category_id($categoryname);
return "//table[@id='user-grades']//*[@data-type='category'][@data-id='" . $itemid . "']";
}
/**
* Clicks on given user menu.
*

View file

@ -50,14 +50,14 @@ Feature: We can sort grades/user fields on the grader report
And "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
# Sort by grades in descending order.
And I click on grade item menu "Test assignment name 1"
And I click on grade item menu "Test assignment name 1" of type "gradeitem" on "grader" page
And I choose "Descending" in the open action menu
And I wait until the page is ready
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
And "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
# Sort by grades in ascending order.
And I click on grade item menu "Test assignment name 1"
And I click on grade item menu "Test assignment name 1" of type "gradeitem" on "grader" page
And I choose "Ascending" in the open action menu
And I wait until the page is ready
Then "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"

View file

@ -50,7 +50,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- | -4- | -5- | -6- |
| Student 1 | student1@example.com | 80 | 90 | 30 | 170 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Show totals only" in the open action menu
And I should not see "Test assignment name 1"
And I should not see "Test assignment name 2"
@ -59,7 +59,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 170 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"
@ -90,7 +90,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- | -4- | -5- | -6- |
| Student 1 | student1@example.com | 80 | - | 30 | 105.71 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Show totals only" in the open action menu
And I should not see "Test assignment name 1"
And I should not see "Test assignment name 2"
@ -99,7 +99,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 105.71 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"

View file

@ -33,7 +33,7 @@ Feature: We can bulk insert grades for students in a course
Scenario: I can not save bulk insert until I fill required form elements
Given I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
@ -61,7 +61,7 @@ Feature: We can bulk insert grades for students in a course
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And the field "Grade for Student 1" matches value "50.00"
And the field "Override for Student 1" matches value "0"
@ -125,7 +125,7 @@ Feature: We can bulk insert grades for students in a course
Scenario: I can not update grades if the value is out of bounds.
Given I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"

View file

@ -106,7 +106,7 @@ Feature: We can use Single view
And the "Override for Test assignment one" "checkbox" should be enabled
Scenario: Single view links work on grade report.
Given I click on grade item menu "Test assignment one"
Given I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I should see "Test assignment one"
When I navigate to "View > Grader report" in the course gradebook

View file

@ -55,4 +55,123 @@ class behat_grades extends behat_base {
$node = $this->find('xpath', './/input[@value="' . $value . '"]', false, $container);
$node->click();
}
/**
* Gets the grade item id from its name.
*
* @throws Exception
* @param string $itemname Item name
* @return int
*/
protected function get_grade_item_id(string $itemname): int {
global $DB;
if ($id = $DB->get_field('grade_items', 'id', ['itemname' => $itemname])) {
return $id;
}
// The course total is a special case.
if ($itemname === "Course total") {
if (!$id = $DB->get_field('grade_items', 'id', ['itemtype' => 'course'])) {
throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
}
return $id;
}
// Find a category with the name.
if ($catid = $DB->get_field('grade_categories', 'id', ['fullname' => $itemname])) {
if ($id = $DB->get_field('grade_items', 'id', ['iteminstance' => $catid])) {
return $id;
}
}
throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
}
/**
* Gets course grade category id from coursename.
*
* @throws Exception
* @param string $coursename
* @return int
*/
protected function get_course_grade_category_id(string $coursename): int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE c.fullname = ?
AND gc.depth = 1";
if ($id = $DB->get_field_sql($sql, [$coursename])) {
return $id;
}
throw new Exception('The specified course grade category with course name "' . $coursename . '" does not exist');
}
/**
* Gets grade category id from its name.
*
* @throws Exception
* @param string $categoryname
* @return int
*/
protected function get_grade_category_id(string $categoryname): int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE gc.fullname = ?";
if ($id = $DB->get_field_sql($sql, [$categoryname])) {
return $id;
}
throw new Exception('The specified grade category with name "' . $categoryname . '" does not exist');
}
/**
* Clicks on given grade item menu.
*
* @Given /^I click on grade item menu "([^"]*)" of type "([^"]*)" on "([^"]*)" page$/
* @param string $itemname Item name
* @param string $itemtype Item type - grade item, category or course
* @param string $page Page - setup or grader
* @throws Exception
*/
public function i_click_on_grade_item_menu(string $itemname, string $itemtype, string $page) {
if ($itemtype == 'gradeitem') {
$itemid = $this->get_grade_item_id($itemname);
} else if ($itemtype == 'category') {
$itemid = $this->get_grade_category_id($itemname);
} else if ($itemtype == 'course') {
$itemid = $this->get_course_grade_category_id($itemname);
} else {
throw new Exception('Unknown item type: ' . $itemtype);
}
if ($page == 'grader') {
if ($itemtype == 'gradeitem') {
$xpath = "//table[@id='user-grades']//*[@data-type='item'][@data-id='" . $itemid . "']";
} else if (($itemtype == 'category') || ($itemtype == 'course')) {
$xpath = "//table[@id='user-grades']//*[@data-type='category'][@data-id='" . $itemid . "']";
} else {
throw new Exception('Unknown item type: ' . $itemtype);
}
} else if ($page == 'setup') {
$xpath = "//table[@id='grade_edit_tree_table']//*[@data-id='" . $itemid . "']";
} else {
throw new Exception('Unknown page: ' . $page);
}
$this->execute("behat_general::i_click_on", [$this->escape($xpath), "xpath_element"]);
}
}

View file

@ -24,7 +24,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
@javascript
Scenario: Hide minimum grade
Given I click on grade item menu "Assignment1"
Given I click on grade item menu "Assignment1" of type "gradeitem" on "grader" page
When I choose "Edit grade item" in the open action menu
And I should see "Minimum grade"
Then I navigate to "Grades > General settings" in site administration
@ -32,7 +32,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Assignment1"
And I click on grade item menu "Assignment1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Minimum grade"

View file

@ -37,359 +37,359 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 1 |
| Weight | 20 |
| Extra credit | 0 |
And I press "Save changes"
And I click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 1 |
| Weight | 5 |
| Extra credit | 0 |
And I press "Save changes"
And I click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 0 |
| Weight | 0 |
| Extra credit | 1 |
And I press "Save changes"
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
Scenario: Switching a category from Natural aggregation to Mean of grades and back
Given I click on course grade category menu "Course 1"
Given I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Mean of grades"
When I press "Save changes"
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
Then I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Mean of grades"
And I press "Save changes"
And I click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item b2"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
# Switching back.
Given I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
Scenario: Switching a category from Natural aggregation to Weighted mean of grades and back
Given I click on course grade category menu "Course 1"
Given I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Weighted mean of grades"
And I press "Save changes"
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
Then I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Weighted mean of grades"
And I press "Save changes"
And I click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
# Switching back.
Given I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
@ -405,24 +405,24 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I should not see "Cat natural &" in the "select#menumoveafter" "css_element"
When I select "Cat natural &" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
Then the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
@ -435,19 +435,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat ec" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
@ -459,19 +459,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat simple" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
@ -483,22 +483,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat weighted" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "2"
And I press "Save changes"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "5"
And I press "Save changes"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "8"
And I press "Save changes"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "11"
@ -512,19 +512,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I select "Cat weighted2" from the "Move selected items to" singleselect
And I wait "2" seconds
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "2"
And I press "Save changes"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "5"
And I press "Save changes"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "8"
And I press "Save changes"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "11"
And I press "Save changes"
@ -536,22 +536,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Course 1" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"

View file

@ -62,7 +62,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 25 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
Then the field "Grade to pass" matches value "25"
And I am on "Course 1" course homepage
@ -72,7 +72,7 @@ Feature: We can set the grade to pass value
And I set the field "Grade to pass" to "30"
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Grade to pass" matches value "30"
@ -86,7 +86,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 3 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "3"
@ -121,13 +121,13 @@ Feature: We can set the grade to pass value
| Assessment grade to pass | 10 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Workshop 1 (submission)"
And I click on grade item menu "Test Workshop 1 (submission)" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "40"
And I set the field "Grade to pass" to "45"
And I press "Save changes"
And I click on grade item menu "Test Workshop 1 (assessment)"
And I click on grade item menu "Test Workshop 1 (assessment)" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
And the field "Grade to pass" matches value "10"
@ -163,7 +163,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 9.5 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Quiz 1"
And I click on grade item menu "Test Quiz 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "9.5"
@ -184,7 +184,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Lesson 1"
And I click on grade item menu "Test Lesson 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
@ -206,7 +206,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 90#50 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Lesson 1"
And I click on grade item menu "Test Lesson 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90#50"
@ -229,7 +229,7 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Database 1"
And I click on grade item menu "Test Database 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
@ -270,7 +270,7 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
@ -294,7 +294,7 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test Glossary 1"
And I click on grade item menu "Test Glossary 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"

View file

@ -27,10 +27,10 @@ Feature: Turn editing mode on
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And "Edit grade item" "link" should exist
And I turn editing mode off
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
Then "Edit grade item" "link" should not exist
Scenario: Edit mode on page Homepage

View file

@ -66,7 +66,7 @@ Feature: I can grade a students interaction across a forum
But I should not see "Test Forum 1 rating"
# The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 whole forum"
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
@ -122,7 +122,7 @@ Feature: I can grade a students interaction across a forum
But I should not see "Test Forum 1 whole forum"
# The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
@ -159,7 +159,7 @@ Feature: I can grade a students interaction across a forum
And I should see "Test Forum 1 whole forum"
# The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "100"
@ -167,7 +167,7 @@ Feature: I can grade a students interaction across a forum
And I should see "Peers" in the "Parent category" "fieldset"
And I press "cancel"
And I click on grade item menu "Test Forum 1 whole forum"
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"