2 Feature: Mapping courses in a feedback
3 In order to collect the same feedback about multiple courses
5 I need to be able to map site feedback to courses
8 Given the following "users" exist:
9 | username | firstname | lastname |
10 | user1 | Username | 1 |
11 | user2 | Username | 2 |
12 | user3 | Username | 3 |
13 | teacher | Teacher | 4 |
14 | manager | Manager | 5 |
15 And the following "courses" exist:
16 | fullname | shortname |
20 And the following "course enrolments" exist:
21 | user | course | role |
22 | user1 | C1 | student |
23 | user1 | C2 | student |
24 | user2 | C1 | student |
25 | user2 | C2 | student |
26 | user3 | C3 | student |
27 | teacher | C1 | editingteacher |
28 | teacher | C2 | editingteacher |
29 | teacher | C3 | editingteacher |
30 And the following "system role assigns" exist:
31 | user | course | role |
32 | manager | Acceptance test site | manager |
33 And the following "activities" exist:
34 | activity | name | course | idnumber | anonymous | publish_stats | section |
35 | feedback | Course feedback | Acceptance test site | feedback0 | 1 | 1 | 1 |
36 | feedback | Another feedback | C1 | feedback1 | 1 | 1 | 0 |
37 When I log in as "manager"
38 And I am on site homepage
39 And I follow "Course feedback"
40 And I click on "Edit questions" "link" in the "[role=main]" "css_element"
41 And I add a "Information" question to the feedback with:
42 | Question | this is an information question |
44 | Information type | Course |
45 And I add a "Multiple choice (rated)" question to the feedback with:
46 | Question | this is a multiple choice rated |
47 | Label | multichoicerated |
48 | Multiple choice type | Multiple choice - single answer |
49 | Multiple choice values | 0/option a\n1/option b\n5/option c |
50 And I add a "Multiple choice" question to the feedback with:
51 | Question | this is a simple multiple choice |
52 | Label | multichoicesimple |
53 | Multiple choice type | Multiple choice - single answer allowed (dropdownlist) |
54 | Multiple choice values | option d\noption e\noption f |
56 And I log in as "teacher"
57 And I am on "Course 1" course homepage with editing mode on
58 And I add the "Feedback" block
59 And I am on "Course 2" course homepage
60 And I add the "Feedback" block
61 And I am on "Course 3" course homepage
62 And I add the "Feedback" block
65 Scenario: Course feedback can not be mapped
66 And I log in as "manager"
67 And I am on "Course 1" course homepage
68 And I follow "Another feedback"
69 And I should not see "Mapped courses"
70 And I should not see "Map feedback to courses"
73 Scenario: Site feedback is not mapped to any course
74 And I log in as "user1"
75 And I am on site homepage
76 And I follow "Course feedback"
77 And I follow "Answer the questions"
78 And I should see "Acceptance test site" in the ".feedback_form" "css_element"
79 And I set the following fields to these values:
81 | this is a simple multiple choice | option d |
82 And I press "Submit your answers"
83 And I press "Continue"
84 And I am on "Course 1" course homepage
85 And I click on "Course feedback" "link" in the "Feedback" "block"
86 And I follow "Answer the questions"
87 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
88 And I should see "C1" in the ".feedback_form" "css_element"
89 And I set the following fields to these values:
91 | this is a simple multiple choice | option e |
92 And I press "Submit your answers"
93 And I press "Continue"
94 And I click on "Course feedback" "link" in the "Feedback" "block"
95 And I should not see "Answer the questions"
97 And I log in as "user2"
98 And I am on "Course 1" course homepage
99 And I click on "Course feedback" "link" in the "Feedback" "block"
100 And I follow "Answer the questions"
101 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
102 And I should see "C1" in the ".feedback_form" "css_element"
103 And I set the following fields to these values:
105 | this is a simple multiple choice | option e |
106 And I press "Submit your answers"
107 And I press "Continue"
109 And I log in as "manager"
110 And I am on site homepage
111 And I follow "Course feedback"
113 And I navigate to "Analysis" in current page administration
114 And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
115 And I show chart data for the "multichoicerated" feedback
116 And I should see "1 (33.33 %)" in the "option a" "table_row"
117 And I should see "1 (33.33 %)" in the "option b" "table_row"
118 And I should see "1 (33.33 %)" in the "option c" "table_row"
119 And I should see "Average: 2.00"
120 And I follow "Sort by course"
121 And I should see "2.50" in the "C1" "table_row"
122 And I should see "1.00" in the "Acceptance test site" "table_row"
123 And I click on "Back" "link" in the "region-main" "region"
124 And I set the field "Filter by course" to "Course 1"
126 And I should see "Course 1" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
127 And I show chart data for the "multichoicerated" feedback
128 And I should see "0" in the "option a" "table_row"
129 And I should see "1 (50.00 %)" in the "option b" "table_row"
130 And I should see "1 (50.00 %)" in the "option c" "table_row"
134 Scenario: Site feedback is mapped to courses
135 And I log in as "manager"
136 And I am on site homepage
137 And I follow "Course feedback"
138 And I follow "Map feedback to courses"
139 And I set the field "Courses" to "Course 2"
140 And I set the field "Courses" to "Course 3"
141 # Weird solution to make the editable field to lose the focus
142 # but with the focus, "save changes" uses to fail because of
143 # the suggestions hiding the button.
144 And I press key "27" in the field "Courses"
145 And I press "Save changes"
146 And I should see "Course mapping has been changed"
149 And I log in as "user1"
150 And I am on site homepage
151 And I follow "Course feedback"
152 And I should see "You can only access this feedback from a course"
153 And I should not see "Answer the questions"
155 And I am on "Course 1" course homepage
156 And "Feedback" "block" should not exist
157 And I should not see "Course feedback"
159 And I am on "Course 2" course homepage
160 And I click on "Course feedback" "link" in the "Feedback" "block"
161 And I follow "Answer the questions"
162 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
163 And I should see "C2" in the ".feedback_form" "css_element"
164 And I set the following fields to these values:
166 | this is a simple multiple choice | option e |
167 And I press "Submit your answers"
168 And I press "Continue"
169 And I click on "Course feedback" "link" in the "Feedback" "block"
170 And I should not see "Answer the questions"
172 And I log in as "user2"
173 And I am on "Course 2" course homepage
174 And I click on "Course feedback" "link" in the "Feedback" "block"
175 And I follow "Answer the questions"
176 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
177 And I should see "C2" in the ".feedback_form" "css_element"
178 And I set the following fields to these values:
180 | this is a simple multiple choice | option e |
181 And I press "Submit your answers"
182 And I press "Continue"
184 And I log in as "user3"
185 And I am on "Course 3" course homepage
186 And I click on "Course feedback" "link" in the "Feedback" "block"
187 And I follow "Answer the questions"
188 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
189 And I should see "C3" in the ".feedback_form" "css_element"
190 And I set the following fields to these values:
192 | this is a simple multiple choice | option d |
193 And I press "Submit your answers"
194 And I press "Continue"
196 And I log in as "manager"
197 And I am on site homepage
198 And I follow "Course feedback"
199 And I navigate to "Analysis" in current page administration
200 And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
201 And I show chart data for the "multichoicerated" feedback
202 And I should see "0" in the "option a" "table_row"
203 And I should see "1 (33.33 %)" in the "option b" "table_row"
204 And I should see "2 (66.67 %)" in the "option c" "table_row"
205 And I should see "Average: 3.67"
206 And I click on "Sort by course" "link"
207 And I should see "3.00" in the "C3" "table_row"
208 And I should see "2.50" in the "C2" "table_row"
209 And I click on "Back" "link" in the "region-main" "region"
210 And I set the field "Filter by course" to "Course 2"
212 And I show chart data for the "multichoicerated" feedback
213 And I should see "0" in the "option a" "table_row"
214 And I should see "1 (50.00 %)" in the "option b" "table_row"
215 And I should see "1 (50.00 %)" in the "option c" "table_row"
216 And I show chart data for the "multichoicesimple" feedback
217 And I should see "2 (100.00 %)" in the "option e" "table_row"
218 And I set the field "Filter by course" to "Course 3"
220 And I show chart data for the "multichoicerated" feedback
221 And I should see "0" in the "option a" "table_row"
222 And I should see "0" in the "option b" "table_row"
223 And I should see "1 (100.00 %)" in the "option c" "table_row"
224 And I show chart data for the "multichoicesimple" feedback
225 And I should see "1 (100.00 %)" in the "option d" "table_row"
226 And I follow "Show all"
227 And I show chart data for the "multichoicesimple" feedback
228 And I should see "1 (33.33 %)" in the "option d" "table_row"
229 And I should see "2 (66.67 %)" in the "option e" "table_row"
230 And I should see "0" in the "option f" "table_row"
233 Scenario: Site feedback deletion hides feedback block completely
234 When I log in as "manager"
235 And I am on site homepage
236 And I turn editing mode on
237 And I add the "Feedback" block
238 And I add the "Main menu" block
239 And I click on "Delete" "link" in the "Course feedback" activity
241 And I follow "Turn editing off"
242 And I am on site homepage
243 Then "Feedback" "block" should not exist
244 And I am on "Course 1" course homepage
245 And "Feedback" "block" should not exist