1@mod @mod_feedback 2Feature: Anonymous feedback 3 In order to collect feedbacks 4 As an admin 5 I need to be able to allow anonymous feedbacks 6 7 Background: 8 Given the following "users" exist: 9 | username | firstname | lastname | 10 | user1 | Username | 1 | 11 | user2 | Username | 2 | 12 | teacher | Teacher | 3 | 13 | manager | Manager | 4 | 14 And the following "courses" exist: 15 | fullname | shortname | 16 | Course 1 | C1 | 17 And the following "course enrolments" exist: 18 | user | course | role | 19 | user1 | C1 | student | 20 | user2 | C1 | student | 21 | teacher | C1 | editingteacher | 22 And the following "system role assigns" exist: 23 | user | course | role | 24 | manager | Acceptance test site | manager | 25 And the following "activities" exist: 26 | activity | name | course | idnumber | anonymous | publish_stats | section | 27 | feedback | Site feedback | Acceptance test site | feedback0 | 1 | 1 | 1 | 28 | feedback | Course feedback | C1 | feedback1 | 1 | 1 | 0 | 29 When I log in as "manager" 30 And I am on site homepage 31 And I follow "Site feedback" 32 And I click on "Edit questions" "link" in the "[role=main]" "css_element" 33 And I add a "Multiple choice" question to the feedback with: 34 | Question | Do you like our site? | 35 | Label | multichoice2 | 36 | Multiple choice type | Multiple choice - single answer | 37 | Hide the "Not selected" option | Yes | 38 | Multiple choice values | Yes\nNo\nI don't know | 39 And I log out 40 41 Scenario: Guests can see anonymous feedback on front page but can not complete 42 When I follow "Site feedback" 43 Then I should not see "Answer the questions" 44 And I follow "Preview" 45 And I should see "Do you like our site?" 46 And I press "Continue" 47 48 Scenario: Complete anonymous feedback on the front page as an authenticated user 49 And I log in as "user1" 50 And I am on site homepage 51 When I follow "Site feedback" 52 And I follow "Preview" 53 And I should see "Do you like our site?" 54 And I press "Continue" 55 And I follow "Answer the questions" 56 And I should see "Do you like our site?" 57 And I set the following fields to these values: 58 | Yes | 1 | 59 And I press "Submit your answers" 60 And I should not see "Submitted answers" 61 And I press "Continue" 62 63 @javascript 64 Scenario: Complete anonymous feedback and view analysis on the front page as an authenticated user 65 And I log in as "admin" 66 And I set the following system permissions of "Authenticated user on frontpage" role: 67 | capability | permission | 68 | mod/feedback:viewanalysepage | Allow | 69 And I log out 70 And I log in as "user1" 71 And I am on site homepage 72 When I follow "Site feedback" 73 And I follow "Preview" 74 And I should see "Do you like our site?" 75 And I press "Continue" 76 And I follow "Answer the questions" 77 And I should see "Do you like our site?" 78 And I set the following fields to these values: 79 | Yes | 1 | 80 And I press "Submit your answers" 81 And I log out 82 And I log in as "user2" 83 And I am on site homepage 84 And I follow "Site feedback" 85 And I follow "Preview" 86 And I should see "Do you like our site?" 87 And I press "Continue" 88 And I follow "Answer the questions" 89 And I set the following fields to these values: 90 | No | 1 | 91 And I press "Submit your answers" 92 And I follow "Submitted answers" 93 And I should see "Submitted answers: 2" 94 And I should see "Questions: 1" 95 # And I should not see "multichoice2" # TODO MDL-29303 do not show labels to users who can not edit feedback 96 And I show chart data for the "multichoice2" feedback 97 And I should see "Do you like our site?" 98 And I should see "1 (50.00 %)" in the "Yes" "table_row" 99 And I should see "1 (50.00 %)" in the "No" "table_row" 100 And I log out 101 And I log in as "manager" 102 And I am on site homepage 103 And I follow "Site feedback" 104 And I navigate to "Show responses" in current page administration 105 And I should not see "Username" 106 And I should see "Anonymous entries (2)" 107 And I follow "Response number: 1" 108 And I should not see "Username" 109 And I should see "Response number: 1 (Anonymous)" 110 And I log out 111 112 Scenario: Complete fully anonymous feedback on the front page as a guest 113 Given the following config values are set as admin: 114 | feedback_allowfullanonymous | 1 | 115 When I follow "Site feedback" 116 And I follow "Preview" 117 And I should see "Do you like our site?" 118 And I press "Continue" 119 And I follow "Answer the questions" 120 And I should see "Do you like our site?" 121 And I set the following fields to these values: 122 | Yes | 1 | 123 And I press "Submit your answers" 124 And I should not see "Submitted answers" 125 And I press "Continue" 126 127 @javascript 128 Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest 129 Given the following config values are set as admin: 130 | feedback_allowfullanonymous | 1 | 131 And I log in as "admin" 132 And I set the following system permissions of "Guest" role: 133 | capability | permission | 134 | mod/feedback:viewanalysepage | Allow | 135 And I log out 136 When I follow "Site feedback" 137 And I follow "Preview" 138 And I should see "Do you like our site?" 139 And I press "Continue" 140 And I follow "Answer the questions" 141 And I should see "Do you like our site?" 142 And I set the following fields to these values: 143 | Yes | 1 | 144 And I press "Submit your answers" 145 And I press "Continue" 146 # Starting new feedback 147 When I follow "Site feedback" 148 And I follow "Preview" 149 And I should see "Do you like our site?" 150 And I press "Continue" 151 And I follow "Answer the questions" 152 And I should see "Do you like our site?" 153 And I set the following fields to these values: 154 | No | 1 | 155 And I press "Submit your answers" 156 And I follow "Submitted answers" 157 And I should see "Submitted answers: 2" 158 And I should see "Questions: 1" 159 # And I should not see "multichoice2" # TODO MDL-29303 160 And I show chart data for the "multichoice2" feedback 161 And I should see "Do you like our site?" 162 And I should see "1 (50.00 %)" in the "Yes" "table_row" 163 And I should see "1 (50.00 %)" in the "No" "table_row" 164 And I log in as "manager" 165 And I am on site homepage 166 And I follow "Site feedback" 167 And I navigate to "Show responses" in current page administration 168 And I should see "Anonymous entries (2)" 169 And I follow "Response number: 1" 170 And I should see "Response number: 1 (Anonymous)" 171 And I log out 172 173 @javascript 174 Scenario: Anonymous feedback in a course 175 # Teacher can not 176 When I am on the "Course feedback" "feedback activity" page logged in as teacher 177 And I click on "Edit questions" "link" in the "[role=main]" "css_element" 178 And I add a "Multiple choice" question to the feedback with: 179 | Question | Do you like this course? | 180 | Label | multichoice1 | 181 | Multiple choice type | Multiple choice - single answer | 182 | Hide the "Not selected" option | Yes | 183 | Multiple choice values | Yes\nNo\nI don't know | 184 And I log out 185 186 And I am on the "Course feedback" "feedback activity" page logged in as user1 187 And I follow "Preview" 188 Then I should see "Do you like this course?" 189 And I press "Continue" 190 And I follow "Answer the questions" 191 And I should see "Do you like this course?" 192 And I set the following fields to these values: 193 | Yes | 1 | 194 And I press "Submit your answers" 195 And I log out 196 And I am on the "Course feedback" "feedback activity" page logged in as user2 197 And I follow "Preview" 198 And I should see "Do you like this course?" 199 And I press "Continue" 200 And I follow "Answer the questions" 201 And I should see "Do you like this course?" 202 And I set the following fields to these values: 203 | No | 1 | 204 And I press "Submit your answers" 205 And I follow "Submitted answers" 206 And I should see "Submitted answers: 2" 207 And I should see "Questions: 1" 208 # And I should not see "multichoice2" # TODO MDL-29303 209 And I show chart data for the "multichoice1" feedback 210 And I should see "Do you like this course?" 211 And I should see "1 (50.00 %)" in the "Yes" "table_row" 212 And I should see "1 (50.00 %)" in the "No" "table_row" 213 And I log out 214 And I am on the "Course feedback" "feedback activity" page logged in as teacher 215 And I follow "Preview" 216 And I should see "Do you like this course?" 217 And I press "Continue" 218 And I should not see "Answer the questions" 219 And I navigate to "Show responses" in current page administration 220 And I should not see "Username" 221 And I should see "Anonymous entries (2)" 222 And I follow "Response number: 1" 223 And I should not see "Username" 224 And I should see "Response number: 1 (Anonymous)" 225 And I should not see "Prev" 226 And I follow "Next" 227 And I should see "Response number: 2 (Anonymous)" 228 And I should see "Prev" 229 And I should not see "Next" 230 And I click on "Back" "link" in the "[role=main]" "css_element" 231 # Delete anonymous response 232 And I click on "Delete entry" "link" in the "Response number: 1" "table_row" 233 And I press "Yes" 234 And I should see "Anonymous entries (1)" 235 And I should not see "Response number: 1" 236 And I should see "Response number: 2" 237 238 Scenario: Collecting new non-anonymous feedback from a previously anonymous feedback activity 239 When I am on the "Course feedback" "feedback activity" page logged in as teacher 240 And I navigate to "Edit settings" in current page administration 241 And I set the following fields to these values: 242 | Allow multiple submissions | Yes | 243 And I press "Save and display" 244 And I follow "Edit questions" 245 And I add a "Short text answer" question to the feedback with: 246 | Question | this is a short text answer | 247 | Label | shorttext | 248 | Maximum characters accepted | 200 | 249 And I log out 250 When I am on the "Course feedback" "feedback activity" page logged in as user1 251 And I follow "Answer the questions" 252 And I set the following fields to these values: 253 | this is a short text answer | anontext | 254 And I press "Submit your answers" 255 And I log out 256 # Switch to non-anon responses. 257 And I am on the "Course feedback" "feedback activity editing" page logged in as teacher 258 And I set the following fields to these values: 259 | Record user names | User's name will be logged and shown with answers | 260 And I press "Save and display" 261 And I log out 262 # Now leave a non-anon feedback as user1 263 And I am on the "Course feedback" "feedback activity" page logged in as user1 264 And I follow "Answer the questions" 265 And I set the following fields to these values: 266 | this is a short text answer | usertext | 267 And I press "Submit your answers" 268 And I log out 269 # Now check the responses are correct. 270 And I am on the "Course feedback" "feedback activity" page logged in as teacher 271 And I follow "Show responses" 272 And I should see "Anonymous entries (1)" 273 And I should see "Non anonymous entries (1)" 274 And I click on "," "link" in the "Username 1" "table_row" 275 And I should see "(Username 1)" 276 And I should see "usertext" 277 And I follow "Back" 278 And I follow "Response number: 1" 279 And I should see "Response number: 1 (Anonymous)" 280 Then I should see "anontext" 281