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 |
35 | feedback | Course feedback | Acceptance test site | feedback0 | 1 | 1 |
36 | feedback | Another feedback | C1 | feedback1 | 1 | 1 |
37 When I log in as "manager"
38 And I am on site homepage
39 And I follow "Course feedback"
40 And I follow "Edit questions"
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 follow "Course 1"
58 And I turn editing mode on
59 And I add the "Feedback" block
60 And I am on site homepage
61 And I follow "Course 2"
62 And I add the "Feedback" block
63 And I am on site homepage
64 And I follow "Course 3"
65 And I add the "Feedback" block
68 Scenario: Course feedback can not be mapped
69 And I log in as "manager"
70 And I am on site homepage
71 And I follow "Course 1"
72 And I follow "Another feedback"
73 And I should not see "Mapped courses"
74 And I should not see "Map feedback to courses"
77 Scenario: Site feedback is not mapped to any course
78 And I log in as "user1"
79 And I am on site homepage
80 And I follow "Course feedback"
81 And I follow "Answer the questions..."
82 And I should see "Acceptance test site" in the ".feedback_form" "css_element"
83 And I set the following fields to these values:
85 | this is a simple multiple choice | option d |
86 And I press "Submit your answers"
87 And I press "Continue"
88 And I follow "Course 1"
89 And I click on "Course feedback" "link" in the "Feedback" "block"
90 And I follow "Answer the questions..."
91 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
92 And I should see "C1" in the ".feedback_form" "css_element"
93 And I set the following fields to these values:
95 | this is a simple multiple choice | option e |
96 And I press "Submit your answers"
97 And I press "Continue"
98 And I click on "Course feedback" "link" in the "Feedback" "block"
99 And I should not see "Answer the questions..."
101 And I log in as "user2"
102 And I follow "Course 1"
103 And I click on "Course feedback" "link" in the "Feedback" "block"
104 And I follow "Answer the questions..."
105 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
106 And I should see "C1" in the ".feedback_form" "css_element"
107 And I set the following fields to these values:
109 | this is a simple multiple choice | option e |
110 And I press "Submit your answers"
111 And I press "Continue"
113 And I log in as "manager"
114 And I am on site homepage
115 And I follow "Course feedback"
117 And I follow "Analysis"
118 And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element"
119 And I should see "1 (33.33 %)" in the "option a" "table_row"
120 And I should see "1 (33.33 %)" in the "option b" "table_row"
121 And I should see "1 (33.33 %)" in the "option c" "table_row"
122 And I should see "Average: 2.00" in the "(multichoicerated)" "table"
123 And I click on "Sort by course" "link" in the "(multichoicerated)" "table"
124 And I should see "2.50" in the "C1" "table_row"
125 And I should see "1.00" in the "Acceptance test site" "table_row"
127 And I set the field "Filter by course" to "Course 1"
129 And I should see "Course 1" in the "#feedback_course_filter .fautocomplete .label" "css_element"
130 And I should see "0" in the "option a" "table_row"
131 And I should see "1 (50.00 %)" in the "option b" "table_row"
132 And I should see "1 (50.00 %)" in the "option c" "table_row"
136 Scenario: Site feedback is mapped to courses
137 And I log in as "manager"
138 And I am on site homepage
139 And I follow "Course feedback"
140 And I follow "Map feedback to courses"
141 And I set the field "Courses" to "Course 2"
142 And I set the field "Courses" to "Course 3"
143 And I press "Save changes"
146 And I log in as "user1"
147 And I am on site homepage
148 And I follow "Course feedback"
149 And I should see "You can only access this feedback from a course"
150 And I should not see "Answer the questions..."
152 And I am on site homepage
153 And I follow "Course 1"
154 And "Feedback" "block" should not exist
155 And I should not see "Course feedback"
157 And I am on site homepage
158 And I follow "Course 2"
159 And I click on "Course feedback" "link" in the "Feedback" "block"
160 And I follow "Answer the questions..."
161 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
162 And I should see "C2" in the ".feedback_form" "css_element"
163 And I set the following fields to these values:
165 | this is a simple multiple choice | option e |
166 And I press "Submit your answers"
167 And I press "Continue"
168 And I click on "Course feedback" "link" in the "Feedback" "block"
169 And I should not see "Answer the questions..."
171 And I log in as "user2"
172 And I follow "Course 2"
173 And I click on "Course feedback" "link" in the "Feedback" "block"
174 And I follow "Answer the questions..."
175 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
176 And I should see "C2" in the ".feedback_form" "css_element"
177 And I set the following fields to these values:
179 | this is a simple multiple choice | option e |
180 And I press "Submit your answers"
181 And I press "Continue"
183 And I log in as "user3"
184 And I follow "Course 3"
185 And I click on "Course feedback" "link" in the "Feedback" "block"
186 And I follow "Answer the questions..."
187 And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
188 And I should see "C3" in the ".feedback_form" "css_element"
189 And I set the following fields to these values:
191 | this is a simple multiple choice | option d |
192 And I press "Submit your answers"
193 And I press "Continue"
195 And I log in as "manager"
196 And I am on site homepage
197 And I follow "Course feedback"
198 And I follow "Analysis"
199 And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element"
200 And I should see "0" in the "option a" "table_row"
201 And I should see "1 (33.33 %)" in the "option b" "table_row"
202 And I should see "2 (66.67 %)" in the "option c" "table_row"
203 And I should see "Average: 3.67" in the "(multichoicerated)" "table"
204 And I click on "Sort by course" "link" in the "(multichoicerated)" "table"
205 And I should see "3.00" in the "C3" "table_row"
206 And I should see "2.50" in the "C2" "table_row"
208 And I set the field "Filter by course" to "Course 2"
210 And I should see "0" in the "option a" "table_row"
211 And I should see "1 (50.00 %)" in the "option b" "table_row"
212 And I should see "1 (50.00 %)" in the "option c" "table_row"
213 And I should see "2 (100.00 %)" in the "option e" "table_row"
214 And I set the field "Filter by course" to "Course 3"
216 And I should see "0" in the "option a" "table_row"
217 And I should see "0" in the "option b" "table_row"
218 And I should see "1 (100.00 %)" in the "option c" "table_row"
219 And I should see "1 (100.00 %)" in the "option d" "table_row"
220 And I follow "Show all"
221 And I should see "1 (33.33 %)" in the "option d" "table_row"
222 And I should see "2 (66.67 %)" in the "option e" "table_row"
223 And I should see "0" in the "option f" "table_row"
226 Scenario: Site feedback deletion hides feedback block completely
227 When I log in as "manager"
228 And I am on site homepage
229 And I follow "Turn editing on"
230 And I add the "Feedback" block
231 And I click on "Delete" "link" in the "//div[contains(@class,'block_site_main_menu')]//li[contains(.,'Course feedback')]" "xpath_element"
233 And I follow "Turn editing off"
234 And I am on site homepage
235 Then "Feedback" "block" should not exist
236 And I follow "Course 1"
237 And "Feedback" "block" should not exist