weekly release 4.5dev
[moodle.git] / grade / tests / behat / grade_item_pass_data_to_advanced_page.feature
blobd473031272367709e78040d9ba0c8b9b1655a212
1 @core @core_grades @javascript @testtt
2 Feature: We carry over data from modal to advanced grade item settings
3   In order to setup grade items quickly
4   As an teacher
5   I need to ensure data is carried over from modal to advanced grade item settings
7   Background:
8     Given the following "courses" exist:
9       | fullname | shortname | category | groupmode |
10       | Course 1 | C1        | 0        | 1         |
11     And the following "users" exist:
12       | username | firstname | lastname | email                | idnumber |
13       | teacher1 | Teacher   | 1        | teacher1@example.com | t1       |
14     And the following "course enrolments" exist:
15       | user     | course | role           |
16       | teacher1 | C1     | editingteacher |
17     And the following "grade categories" exist:
18       | fullname                 | course |
19       | Some cool grade category | C1     |
20     And the following config values are set as admin:
21       | enableoutcomes | 1 |
22     And the following "scales" exist:
23       | name       | scale                                     |
24       | Test Scale | Disappointing, Good, Very good, Excellent |
25     And the following "grade outcomes" exist:
26       | fullname  | shortname | course | scale      |
27       | Outcome 1 | OT1       | C1     | Test Scale |
28       | Outcome 2 | OT2       | C1     | Test Scale |
29     And the following "activities" exist:
30       | activity | course | idnumber | name               | intro             |
31       | assign   | C1     | a1       | Test assignment 1  | Submit something! |
32     And I log in as "admin"
33     And I set the following administration settings values:
34       | grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
35     And I log out
36     And I am on the "Course 1" course page logged in as teacher1
37     And I navigate to "Setup > Gradebook setup" in the course gradebook
38     And I choose the "Add grade item" item in the "Add" action menu
40   Scenario: Defaults are used when creating a new grade item
41     Given I click on "Show more..." "link" in the ".modal-dialog" "css_element"
42     Then the following fields match these values:
43       | Item name         |          |
44       | Minimum grade     | 0        |
45       | Maximum grade     | 100      |
46       | Weight adjusted   | 0        |
47       | aggregationcoef2  | 0        |
48       | Grade category    | Course 1 |
49     And I press "Cancel"
50     And I wait until the page is ready
51     And I choose the "Add category" item in the "Add" action menu
52     And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
53     And the following fields match these values:
54       | Category name                |          |
55       | Aggregation                  | Natural  |
56       | Weight adjusted              | 0        |
57       | grade_item_aggregationcoef2  | 0        |
58       | Parent category              | Course 1 |
59     And I press "Cancel"
60     And I wait until the page is ready
61     And I choose the "Add outcome item" item in the "Add" action menu
62     And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
63     And the following fields match these values:
64       | Item name         |                          |
65       | Outcome           | Outcome 1                |
66       | Linked activity   | None                     |
67       | Grade category    | Course 1                 |
69   Scenario: We carry over data from modal to advanced grade item settings
70     Given I set the following fields to these values:
71       | Item name         | Manual item 1            |
72       | Minimum grade     | 1                        |
73       | Maximum grade     | 99                       |
74       | Weight adjusted   | 1                        |
75       | aggregationcoef2  | 100                      |
76       | Grade category    | Some cool grade category |
77     When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
78     Then the following fields match these values:
79       | Item name         | Manual item 1            |
80       | Minimum grade     | 1                        |
81       | Maximum grade     | 99                       |
82       | Weight adjusted   | 1                        |
83       | aggregationcoef2  | 100                      |
84       | Grade category    | Some cool grade category |
85     And I press "Cancel"
86     And I wait until the page is ready
87     And I choose the "Add category" item in the "Add" action menu
88     And I set the following fields to these values:
89       | Category name                | Category 1               |
90       | Aggregation                  | Mean of grades           |
91       | Minimum grade                | 1                        |
92       | Maximum grade                | 99                       |
93       | Weight adjusted              | 1                        |
94       | grade_item_aggregationcoef2  | 100                      |
95       | Parent category              | Some cool grade category |
96     And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
97     And the following fields match these values:
98       | Category name                | Category 1               |
99       | Aggregation                  | Mean of grades           |
100       | Minimum grade                | 1                        |
101       | Maximum grade                | 99                       |
102       | Weight adjusted              | 1                        |
103       | grade_item_aggregationcoef2  | 100                      |
104       | Parent category              | Some cool grade category |
105     And I press "Cancel"
106     And I choose the "Add category" item in the "Add" action menu
107     # Confirm that the form values are carried over even if some mandatory fields are missing (e.g. Category name).
108     And I set the following fields to these values:
109       | Aggregation                  | Mean of grades           |
110       | Minimum grade                | 1                        |
111       | Maximum grade                | 99                       |
112       | Weight adjusted              | 1                        |
113       | grade_item_aggregationcoef2  | 100                      |
114       | Parent category              | Some cool grade category |
115     And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
116     And the following fields match these values:
117       | Category name                |                          |
118       | Aggregation                  | Mean of grades           |
119       | Minimum grade                | 1                        |
120       | Maximum grade                | 99                       |
121       | Weight adjusted              | 1                        |
122       | grade_item_aggregationcoef2  | 100                      |
123       | Parent category              | Some cool grade category |
124     And I press "Cancel"
125     And I wait until the page is ready
126     And I choose the "Add outcome item" item in the "Add" action menu
127     And I set the following fields to these values:
128       | Item name         | Outcome item 1           |
129       | Outcome           | Outcome 2                |
130       | Linked activity   | Test assignment 1        |
131     And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
132     And the following fields match these values:
133       | Item name         | Outcome item 1           |
134       | Outcome           | Outcome 2                |
135       | Linked activity   | Test assignment 1        |