coursemapping.feature 11.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@mod @mod_feedback
Feature: Mapping courses in a feedback
  In order to collect the same feedback about multiple courses
  As a manager
  I need to be able to map site feedback to courses

  Background:
    Given the following "users" exist:
      | username | firstname | lastname |
      | user1    | Username  | 1        |
      | user2    | Username  | 2        |
      | user3    | Username  | 3        |
      | teacher  | Teacher   | 4        |
      | manager  | Manager   | 5        |
    And the following "courses" exist:
      | fullname | shortname |
      | Course 1 | C1        |
      | Course 2 | C2        |
      | Course 3 | C3        |
    And the following "course enrolments" exist:
      | user    | course | role    |
      | user1   | C1     | student |
      | user1   | C2     | student |
      | user2   | C1     | student |
      | user2   | C2     | student |
      | user3   | C3     | student |
      | teacher | C1     | editingteacher |
      | teacher | C2     | editingteacher |
      | teacher | C3     | editingteacher |
    And the following "system role assigns" exist:
      | user    | course               | role    |
      | manager | Acceptance test site | manager |
    And the following "activities" exist:
34
35
36
      | activity   | name             | course               | idnumber  | anonymous | publish_stats | section |
      | feedback   | Course feedback  | Acceptance test site | feedback0 | 1         | 1             | 1       |
      | feedback   | Another feedback | C1                   | feedback1 | 1         | 1             | 0       |
37
38
    When I log in as "manager"
    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
42
43
    And I add a "Information" question to the feedback with:
      | Question         | this is an information question |
      | Label            | info                            |
44
      | Information type | Course                          |
45
46
47
48
49
50
51
52
53
54
55
56
    And I add a "Multiple choice (rated)" question to the feedback with:
      | Question               | this is a multiple choice rated    |
      | Label                  | multichoicerated                   |
      | Multiple choice type   | Multiple choice - single answer    |
      | Multiple choice values | 0/option a\n1/option b\n5/option c |
    And I add a "Multiple choice" question to the feedback with:
      | Question               | this is a simple multiple choice    |
      | Label                  | multichoicesimple                   |
      | Multiple choice type   | Multiple choice - single answer allowed (dropdownlist) |
      | Multiple choice values | option d\noption e\noption f                           |
    And I log out
    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
63
64
65
66
    And I add the "Feedback" block
    And I log out

  Scenario: Course feedback can not be mapped
    And I log in as "manager"
67
    And I am on "Course 1" course homepage
68
69
70
71
72
73
74
75
    And I follow "Another feedback"
    And I should not see "Mapped courses"
    And I should not see "Map feedback to courses"

  @javascript
  Scenario: Site feedback is not mapped to any course
    And I log in as "user1"
    And I am on site homepage
76
    And I follow "Course feedback"
77
    And I follow "Answer the questions"
78
79
80
81
82
83
    And I should see "Acceptance test site" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option a                         | 1        |
      | this is a simple multiple choice | option d |
    And I press "Submit your answers"
    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
88
89
90
91
92
93
94
    And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
    And I should see "C1" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option b                         | 1        |
      | this is a simple multiple choice | option e |
    And I press "Submit your answers"
    And I press "Continue"
    And I click on "Course feedback" "link" in the "Feedback" "block"
95
    And I should not see "Answer the questions"
96
97
    And I log out
    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
102
103
104
105
106
107
108
109
110
    And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
    And I should see "C1" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option c                         | 1        |
      | this is a simple multiple choice | option e |
    And I press "Submit your answers"
    And I press "Continue"
    And I log out
    And I log in as "manager"
    And I am on site homepage
111
    And I follow "Course feedback"
112

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
117
118
    And I should see "1 (33.33 %)" in the "option a" "table_row"
    And I should see "1 (33.33 %)" in the "option b" "table_row"
    And I should see "1 (33.33 %)" in the "option c" "table_row"
119
120
    And I should see "Average: 2.00"
    And I follow "Sort by course"
121
122
    And I should see "2.50" in the "C1" "table_row"
    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
125
    And I set the field "Filter by course" to "Course 1"
    And I press "Filter"
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
129
130
131
132
133
134
135
136
    And I should see "0" in the "option a" "table_row"
    And I should see "1 (50.00 %)" in the "option b" "table_row"
    And I should see "1 (50.00 %)" in the "option c" "table_row"
    And I log out

  @javascript
  Scenario: Site feedback is mapped to courses
    And I log in as "manager"
    And I am on site homepage
137
    And I follow "Course feedback"
138
139
140
    And I follow "Map feedback to courses"
    And I set the field "Courses" to "Course 2"
    And I set the field "Courses" to "Course 3"
141
    And I press "Save changes"
142
    And I should see "Course mapping has been changed"
143
144
145
146
    And I log out

    And I log in as "user1"
    And I am on site homepage
147
    And I follow "Course feedback"
148
    And I should see "You can only access this feedback from a course"
149
    And I should not see "Answer the questions"
150

151
    And I am on "Course 1" course homepage
152
153
154
    And "Feedback" "block" should not exist
    And I should not see "Course feedback"

155
    And I am on "Course 2" course homepage
156
    And I click on "Course feedback" "link" in the "Feedback" "block"
157
    And I follow "Answer the questions"
158
159
160
161
162
163
164
165
    And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
    And I should see "C2" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option b                         | 1        |
      | this is a simple multiple choice | option e |
    And I press "Submit your answers"
    And I press "Continue"
    And I click on "Course feedback" "link" in the "Feedback" "block"
166
    And I should not see "Answer the questions"
167
168
    And I log out
    And I log in as "user2"
169
    And I am on "Course 2" course homepage
170
    And I click on "Course feedback" "link" in the "Feedback" "block"
171
    And I follow "Answer the questions"
172
173
174
175
176
177
178
179
180
    And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
    And I should see "C2" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option c                         | 1        |
      | this is a simple multiple choice | option e |
    And I press "Submit your answers"
    And I press "Continue"
    And I log out
    And I log in as "user3"
181
    And I am on "Course 3" course homepage
182
    And I click on "Course feedback" "link" in the "Feedback" "block"
183
    And I follow "Answer the questions"
184
185
186
187
188
189
190
191
192
193
    And I should not see "Acceptance test site" in the ".feedback_form" "css_element"
    And I should see "C3" in the ".feedback_form" "css_element"
    And I set the following fields to these values:
      | option c                         | 1        |
      | this is a simple multiple choice | option d |
    And I press "Submit your answers"
    And I press "Continue"
    And I log out
    And I log in as "manager"
    And I am on site homepage
194
    And I follow "Course feedback"
195
    And I navigate to "Analysis" in current page administration
196
    And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
197
    And I show chart data for the "multichoicerated" feedback
198
199
200
    And I should see "0" in the "option a" "table_row"
    And I should see "1 (33.33 %)" in the "option b" "table_row"
    And I should see "2 (66.67 %)" in the "option c" "table_row"
201
202
    And I should see "Average: 3.67"
    And I click on "Sort by course" "link"
203
204
    And I should see "3.00" in the "C3" "table_row"
    And I should see "2.50" in the "C2" "table_row"
205
    And I click on "Back" "link" in the "region-main" "region"
206
207
    And I set the field "Filter by course" to "Course 2"
    And I press "Filter"
208
    And I show chart data for the "multichoicerated" feedback
209
210
211
    And I should see "0" in the "option a" "table_row"
    And I should see "1 (50.00 %)" in the "option b" "table_row"
    And I should see "1 (50.00 %)" in the "option c" "table_row"
212
    And I show chart data for the "multichoicesimple" feedback
213
    And I should see "2 (100.00 %)" in the "option e" "table_row"
214
215
    And I set the field "Filter by course" to "Course 3"
    And I press "Filter"
216
    And I show chart data for the "multichoicerated" feedback
217
218
219
    And I should see "0" in the "option a" "table_row"
    And I should see "0" in the "option b" "table_row"
    And I should see "1 (100.00 %)" in the "option c" "table_row"
220
    And I show chart data for the "multichoicesimple" feedback
221
222
    And I should see "1 (100.00 %)" in the "option d" "table_row"
    And I follow "Show all"
223
    And I show chart data for the "multichoicesimple" feedback
224
225
226
227
    And I should see "1 (33.33 %)" in the "option d" "table_row"
    And I should see "2 (66.67 %)" in the "option e" "table_row"
    And I should see "0" in the "option f" "table_row"
    And I log out
228
229
230
231

  Scenario: Site feedback deletion hides feedback block completely
    When I log in as "manager"
    And I am on site homepage
232
    And I turn editing mode on
233
    And I add the "Feedback" block
234
    And I add the "Main menu" block
235
    And I click on "Delete" "link" in the "Course feedback" activity
236
237
238
239
    And I press "Yes"
    And I follow "Turn editing off"
    And I am on site homepage
    Then "Feedback" "block" should not exist
240
    And I am on "Course 1" course homepage
241
242
    And "Feedback" "block" should not exist
    And I log out