[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/feedback/tests/behat/ -> multichoice.feature (source)

   1  @mod @mod_feedback
   2  Feature: Testing multichoice questions in feedback
   3    In order to create feedbacks
   4    As a teacher
   5    I need to be able to create different types of multichoice questions
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname |
  10        | teacher1 | Teacher   | 1        |
  11        | student1 | Student   | 1        |
  12        | student2 | Student   | 2        |
  13      And the following "courses" exist:
  14        | fullname | shortname |
  15        | Course 1 | C1        |
  16      And the following "course enrolments" exist:
  17        | user     | course | role           |
  18        | teacher1 | C1     | editingteacher |
  19        | student1 | C1     | student        |
  20        | student2 | C1     | student        |
  21      And the following "activities" exist:
  22        | activity   | name                | course | idnumber    |
  23        | feedback   | Learning experience | C1     | feedback0   |
  24      And I log in as "teacher1"
  25      And I follow "Course 1"
  26      And I follow "Learning experience"
  27      And I follow "Edit questions"
  28  
  29    @javascript
  30    Scenario: Non-rated single-answer multiple choice questions in feedback
  31      When I add a "Multiple choice" question to the feedback with:
  32        | Question         | this is a multiple choice 1 |
  33        | Label            | multichoice1                |
  34        | Multiple choice type | Multiple choice - single answer |
  35        | Multiple choice values | option a\noption b\noption c  |
  36      And I add a "Label" question to the feedback with:
  37        | Contents | this is the first page of the feedback |
  38      And I select "Add a page break" from the "Add question" singleselect
  39      And I add a "Multiple choice" question to the feedback with:
  40        | Question         | this is a multiple choice 2 |
  41        | Label            | multichoice2                |
  42        | Multiple choice type | Multiple choice - single answer |
  43        | Multiple choice values | option d\noption e\noption f  |
  44        | Required | 1 |
  45      And I add a "Label" question to the feedback with:
  46        | Contents | this is the second page of the feedback |
  47      And I select "Add a page break" from the "Add question" singleselect
  48      And I add a "Multiple choice" question to the feedback with:
  49        | Question         | this is a multiple choice 3 |
  50        | Label            | multichoice3                |
  51        | Multiple choice type | Multiple choice - single answer |
  52        | Multiple choice values | option g\noption h\noption i  |
  53        | Hide the "Not selected" option | Yes                   |
  54        | Dependence item                | multichoice2          |
  55        | Dependence value               | option d              |
  56      And I add a "Label" question to the feedback with:
  57        | Contents | this is the third page of the feedback |
  58      And I log out
  59      And I log in as "student1"
  60      And I follow "Course 1"
  61      And I follow "Learning experience"
  62      And I follow "Answer the questions..."
  63      # Examine the first page, select nothing, go to the next page
  64      Then the following fields match these values:
  65        | Not selected | 1 |
  66        | option a     | 0 |
  67        | option b     | 0 |
  68        | option c     | 0 |
  69      And "Previous page" "button" should not exist
  70      And "Submit your answers" "button" should not exist
  71      And I should see "this is the first page of the feedback"
  72      And I should not see "this is the second page of the feedback"
  73      And I should not see "this is the third page of the feedback"
  74      And I press "Next page"
  75      # Examine the second page, select nothing, try to go to the next page
  76      And I should see "Not selected"
  77      And the following fields match these values:
  78        | Not selected | 1 |
  79        | option d     | 0 |
  80        | option e     | 0 |
  81        | option f     | 0 |
  82      And "Previous page" "button" should exist
  83      And "Submit your answers" "button" should not exist
  84      And I should not see "this is the first page of the feedback"
  85      And I should see "this is the second page of the feedback"
  86      And I should not see "this is the third page of the feedback"
  87      And I press "Next page"
  88      # We are still on the second page because the field is required
  89      And I should see "Required" in the ".error" "css_element"
  90      And I should see "this is the second page of the feedback"
  91      And I set the field "option e" to "1"
  92      And the following fields match these values:
  93        | Not selected | 0 |
  94        | option d     | 0 |
  95        | option e     | 1 |
  96        | option f     | 0 |
  97      And I press "Next page"
  98      # Now we are on the third page, element is not shown because of wrong dependency.
  99      And I should see "this is the third page of the feedback"
 100      And I should not see "this is a multiple choice 3"
 101      # Go back, check that values are preserved and change the option to enable dependency.
 102      And I press "Previous page"
 103      And the following fields match these values:
 104        | Not selected | 0 |
 105        | option d     | 0 |
 106        | option e     | 1 |
 107        | option f     | 0 |
 108      And I set the field "option d" to "1"
 109      And I press "Next page"
 110      # Now third page contains all items.
 111      And I should see "this is a multiple choice 3"
 112      And I should see "this is the third page of the feedback"
 113      And I should not see "Not selected"
 114      And the following fields match these values:
 115        | option g     | 0 |
 116        | option h     | 0 |
 117        | option i     | 0 |
 118      And "Previous page" "button" should exist
 119      And "Next page" "button" should not exist
 120      And "Submit your answers" "button" should exist
 121      And I set the field "option i" to "1"
 122      And I press "Submit your answers"
 123      And I log out
 124      # Student 2 tries to trick - he answers the third question and then
 125      # goes back and changes dependency question. Analysis should not show this answer!
 126      And I log in as "student2"
 127      And I follow "Course 1"
 128      And I follow "Learning experience"
 129      And I follow "Answer the questions..."
 130      And I set the field "option a" to "1"
 131      And I press "Next page"
 132      And I set the field "option d" to "1"
 133      And I press "Next page"
 134      And I set the field "option g" to "1"
 135      And I press "Previous page"
 136      And I set the field "option f" to "1"
 137      And I press "Next page"
 138      And I press "Submit your answers"
 139      And I log out
 140      # Login as teacher and check analysis
 141      And I log in as "teacher1"
 142      And I follow "Course 1"
 143      And I follow "Learning experience"
 144      And I follow "Analysis"
 145      And I should see "Submitted answers: 2"
 146      And I should see "Questions: 3"
 147      And I show chart data for the "multichoice1" feedback
 148      And I should see "1 (50.00 %)" in the "option a" "table_row"
 149      And I should not see "%" in the "option b" "table_row"
 150      And I should not see "%" in the "option c" "table_row"
 151      And I show chart data for the "multichoice2" feedback
 152      And I should see "1 (50.00 %)" in the "option d" "table_row"
 153      And I should not see "%" in the "option e" "table_row"
 154      And I should see "1 (50.00 %)" in the "option f" "table_row"
 155      And I show chart data for the "multichoice3" feedback
 156      And I should not see "%" in the "option g" "table_row"
 157      And I should not see "%" in the "option h" "table_row"
 158      And I should see "1 (100.00 %)" in the "option i" "table_row"
 159      # Change the settings so we don't analyse empty submits
 160      And I follow "Edit questions"
 161      And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
 162      And I set the field "Do not analyse empty submits" to "Yes"
 163      And I press "Save changes to question"
 164      And I follow "Analysis"
 165      And I show chart data for the "multichoice1" feedback
 166      And I should see "1 (100.00 %)" in the "option a" "table_row"
 167      And I should not see "%" in the "option b" "table_row"
 168      And I should not see "%" in the "option c" "table_row"
 169      And I log out
 170  
 171    @javascript
 172    Scenario: Non-rated multiple-answers multiple choice questions in feedback
 173      # Create a feedback with three pages, required and dependent questions.
 174      When I add a "Multiple choice" question to the feedback with:
 175        | Question         | this is a multiple choice 1 |
 176        | Label            | multichoice1                |
 177        | Multiple choice type | Multiple choice - multiple answers |
 178        | Multiple choice values | option a\noption b\noption c  |
 179      And I add a "Label" question to the feedback with:
 180        | Contents | this is the first page of the feedback |
 181      And I select "Add a page break" from the "Add question" singleselect
 182      And I add a "Multiple choice" question to the feedback with:
 183        | Question         | this is a multiple choice 2 |
 184        | Label            | multichoice2                |
 185        | Multiple choice type | Multiple choice - multiple answers |
 186        | Multiple choice values | option d\noption e\noption f  |
 187        | Required | 1 |
 188      And I add a "Label" question to the feedback with:
 189        | Contents | this is the second page of the feedback |
 190      And I select "Add a page break" from the "Add question" singleselect
 191      And I add a "Multiple choice" question to the feedback with:
 192        | Question         | this is a multiple choice 3 |
 193        | Label            | multichoice3                |
 194        | Multiple choice type | Multiple choice - multiple answers |
 195        | Multiple choice values | option g\noption h\noption i  |
 196        | Dependence item                | multichoice2          |
 197        | Dependence value               | option d              |
 198      And I add a "Label" question to the feedback with:
 199        | Contents | this is the third page of the feedback |
 200      And I log out
 201      # Login as the first student.
 202      And I log in as "student1"
 203      And I follow "Course 1"
 204      And I follow "Learning experience"
 205      And I follow "Answer the questions..."
 206      # Examine the first page, select nothing, go to the next page
 207      And I should not see "Not selected"
 208      And the following fields match these values:
 209        | option a     | 0 |
 210        | option b     | 0 |
 211        | option c     | 0 |
 212      And "Previous page" "button" should not exist
 213      And "Submit your answers" "button" should not exist
 214      And I should see "this is the first page of the feedback"
 215      And I should not see "this is the second page of the feedback"
 216      And I should not see "this is the third page of the feedback"
 217      And I press "Next page"
 218      # Examine the second page, select nothing, try to go to the next page
 219      Then I should not see "Not selected"
 220      And the following fields match these values:
 221        | option d     | 0 |
 222        | option e     | 0 |
 223        | option f     | 0 |
 224      And "Previous page" "button" should exist
 225      And "Submit your answers" "button" should not exist
 226      And I should not see "this is the first page of the feedback"
 227      And I should see "this is the second page of the feedback"
 228      And I should not see "this is the third page of the feedback"
 229      And I press "Next page"
 230      # We are still on the second page because the field is required
 231      And I should see "Required" in the ".error" "css_element"
 232      And I should see "this is the second page of the feedback"
 233      And I set the field "option e" to "1"
 234      And I set the field "option f" to "1"
 235      And the following fields match these values:
 236        | option d     | 0 |
 237        | option e     | 1 |
 238        | option f     | 1 |
 239      And I press "Next page"
 240      # Now we are on the third page, element is not shown because of wrong dependency.
 241      And I should see "this is the third page of the feedback"
 242      And I should not see "this is a multiple choice 3"
 243      # Go back, check that values are preserved and change the option to enable dependency.
 244      And I press "Previous page"
 245      And the following fields match these values:
 246        | option d     | 0 |
 247        | option e     | 1 |
 248        | option f     | 1 |
 249      And I set the field "option d" to "1"
 250      And I set the field "option e" to "0"
 251      And I press "Next page"
 252      # Now third page contains all items.
 253      And I should see "this is a multiple choice 3"
 254      And I should see "this is the third page of the feedback"
 255      And the following fields match these values:
 256        | option g     | 0 |
 257        | option h     | 0 |
 258        | option i     | 0 |
 259      And "Previous page" "button" should exist
 260      And "Next page" "button" should not exist
 261      And "Submit your answers" "button" should exist
 262      And I set the field "option i" to "1"
 263      And I press "Submit your answers"
 264      And I log out
 265      # Student 2 tries to trick - he answers the third question and then
 266      # goes back and changes dependency question. Analysis should not show this answer!
 267      And I log in as "student2"
 268      And I follow "Course 1"
 269      And I follow "Learning experience"
 270      And I follow "Answer the questions..."
 271      And I set the field "option a" to "1"
 272      And I set the field "option b" to "1"
 273      And I press "Next page"
 274      And I set the field "option d" to "1"
 275      And I press "Next page"
 276      And I set the field "option g" to "1"
 277      And I press "Previous page"
 278      And I set the field "option d" to "0"
 279      And I set the field "option f" to "1"
 280      And I press "Next page"
 281      And I press "Submit your answers"
 282      And I log out
 283      # Login as teacher and check analysis
 284      And I log in as "teacher1"
 285      And I follow "Course 1"
 286      And I follow "Learning experience"
 287      And I follow "Analysis"
 288      And I should see "Submitted answers: 2"
 289      And I should see "Questions: 3"
 290      And I show chart data for the "multichoice1" feedback
 291      And I should see "1 (50.00 %)" in the "option a" "table_row"
 292      And I should see "1 (50.00 %)" in the "option b" "table_row"
 293      And I should not see "%" in the "option c" "table_row"
 294      And I show chart data for the "multichoice2" feedback
 295      And I should see "1 (50.00 %)" in the "option d" "table_row"
 296      And I should not see "%" in the "option e" "table_row"
 297      And I should see "2 (100.00 %)" in the "option f" "table_row"
 298      And I show chart data for the "multichoice3" feedback
 299      And I should not see "%" in the "option g" "table_row"
 300      And I should not see "%" in the "option h" "table_row"
 301      And I should see "1 (100.00 %)" in the "option i" "table_row"
 302      # Change the settings so we don't analyse empty submits
 303      And I follow "Edit questions"
 304      And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
 305      And I set the field "Do not analyse empty submits" to "Yes"
 306      And I press "Save changes to question"
 307      And I follow "Analysis"
 308      And I show chart data for the "multichoice1" feedback
 309      And I should see "1 (100.00 %)" in the "option a" "table_row"
 310      And I should see "1 (100.00 %)" in the "option b" "table_row"
 311      And I should not see "%" in the "option c" "table_row"
 312      And I log out
 313  
 314    @javascript
 315    Scenario: Non-rated single-answer dropdown multiple choice questions in feedback
 316      When I add a "Multiple choice" question to the feedback with:
 317        | Question         | this is a multiple choice 1 |
 318        | Label            | multichoice1                |
 319        | Multiple choice type | Multiple choice - single answer allowed (dropdownlist) |
 320        | Multiple choice values | option a\noption b\noption c  |
 321      And I add a "Label" question to the feedback with:
 322        | Contents | this is the first page of the feedback |
 323      And I select "Add a page break" from the "Add question" singleselect
 324      And I add a "Multiple choice" question to the feedback with:
 325        | Question         | this is a multiple choice 2 |
 326        | Label            | multichoice2                |
 327        | Multiple choice type | Multiple choice - single answer allowed (dropdownlist) |
 328        | Multiple choice values | option d\noption e\noption f  |
 329        | Required | 1 |
 330      And I add a "Label" question to the feedback with:
 331        | Contents | this is the second page of the feedback |
 332      And I select "Add a page break" from the "Add question" singleselect
 333      And I add a "Multiple choice" question to the feedback with:
 334        | Question         | this is a multiple choice 3 |
 335        | Label            | multichoice3                |
 336        | Multiple choice type | Multiple choice - single answer allowed (dropdownlist) |
 337        | Multiple choice values | option g\noption h\noption i  |
 338        | Dependence item                | multichoice2          |
 339        | Dependence value               | option d              |
 340      And I add a "Label" question to the feedback with:
 341        | Contents | this is the third page of the feedback |
 342      And I log out
 343      And I log in as "student1"
 344      And I follow "Course 1"
 345      And I follow "Learning experience"
 346      And I follow "Answer the questions..."
 347      # Examine the first page, select nothing, go to the next page
 348      Then the following fields match these values:
 349        | this is a multiple choice 1 | 0 |
 350      And "Previous page" "button" should not exist
 351      And "Submit your answers" "button" should not exist
 352      And I should see "this is the first page of the feedback"
 353      And I should not see "this is the second page of the feedback"
 354      And I should not see "this is the third page of the feedback"
 355      And I press "Next page"
 356      # Examine the second page, select nothing, try to go to the next page
 357      And the following fields match these values:
 358        | this is a multiple choice 2 | 0 |
 359      And "Previous page" "button" should exist
 360      And "Submit your answers" "button" should not exist
 361      And I should not see "this is the first page of the feedback"
 362      And I should see "this is the second page of the feedback"
 363      And I should not see "this is the third page of the feedback"
 364      And I press "Next page"
 365      # We are still on the second page because the field is required
 366      And I should see "Required" in the ".error" "css_element"
 367      And I should see "this is the second page of the feedback"
 368      And I set the field "this is a multiple choice 2" to "option e"
 369      And I press "Next page"
 370      # Now we are on the third page, element is not shown because of wrong dependency.
 371      And I should see "this is the third page of the feedback"
 372      And I should not see "this is a multiple choice 3"
 373      # Go back, check that values are preserved and change the option to enable dependency.
 374      And I press "Previous page"
 375      And the following fields match these values:
 376        | this is a multiple choice 2 | option e |
 377      And I set the field "this is a multiple choice 2" to "option d"
 378      And I press "Next page"
 379      # Now third page contains all items.
 380      And I should see "this is the third page of the feedback"
 381      And the following fields match these values:
 382        | this is a multiple choice 3 | 0 |
 383      And "Previous page" "button" should exist
 384      And "Next page" "button" should not exist
 385      And "Submit your answers" "button" should exist
 386      And I set the field "this is a multiple choice 3" to "option i"
 387      And I press "Submit your answers"
 388      And I log out
 389      # Student 2 tries to trick - he answers the third question and then
 390      # goes back and changes dependency question. Analysis should not show this answer!
 391      And I log in as "student2"
 392      And I follow "Course 1"
 393      And I follow "Learning experience"
 394      And I follow "Answer the questions..."
 395      And I set the field "this is a multiple choice 1" to "option a"
 396      And I press "Next page"
 397      And I set the field "this is a multiple choice 2" to "option d"
 398      And I press "Next page"
 399      And I set the field "this is a multiple choice 3" to "option g"
 400      And I press "Previous page"
 401      And I set the field "this is a multiple choice 2" to "option f"
 402      And I press "Next page"
 403      And I press "Submit your answers"
 404      And I log out
 405      # Login as teacher and check analysis
 406      And I log in as "teacher1"
 407      And I follow "Course 1"
 408      And I follow "Learning experience"
 409      And I follow "Analysis"
 410      And I should see "Submitted answers: 2"
 411      And I should see "Questions: 3"
 412      And I show chart data for the "multichoice1" feedback
 413      And I should see "1 (50.00 %)" in the "option a" "table_row"
 414      And I should not see "%" in the "option b" "table_row"
 415      And I should not see "%" in the "option c" "table_row"
 416      And I show chart data for the "multichoice2" feedback
 417      And I should see "1 (50.00 %)" in the "option d" "table_row"
 418      And I should not see "%" in the "option e" "table_row"
 419      And I should see "1 (50.00 %)" in the "option f" "table_row"
 420      And I show chart data for the "multichoice3" feedback
 421      And I should not see "%" in the "option g" "table_row"
 422      And I should not see "%" in the "option h" "table_row"
 423      And I should see "1 (100.00 %)" in the "option i" "table_row"
 424      # Change the settings so we don't analyse empty submits
 425      And I follow "Edit questions"
 426      And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
 427      And I set the field "Do not analyse empty submits" to "Yes"
 428      And I press "Save changes to question"
 429      And I follow "Analysis"
 430      And I show chart data for the "multichoice1" feedback
 431      And I should see "1 (100.00 %)" in the "option a" "table_row"
 432      And I should not see "%" in the "option b" "table_row"
 433      And I should not see "%" in the "option c" "table_row"
 434      And I log out


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1