[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/tests/behat/ -> editing_section_headings.feature (source)

   1  @mod @mod_quiz
   2  Feature: Edit quiz page - section headings
   3    In order to build a quiz laid out in sections the way I want
   4    As a teacher
   5    I need to be able to add, edit and remove section headings as well as shuffle
   6    questions within a section.
   7  
   8    Background:
   9      Given the following "users" exist:
  10        | username | firstname | lastname | email                |
  11        | teacher1 | T1        | Teacher1 | teacher1@example.com |
  12      And the following "courses" exist:
  13        | fullname | shortname | category |
  14        | Course 1 | C1        | 0        |
  15      And the following "course enrolments" exist:
  16        | user     | course | role           |
  17        | teacher1 | C1     | editingteacher |
  18      And the following "question categories" exist:
  19        | contextlevel | reference | name           |
  20        | Course       | C1        | Test questions |
  21      And I log in as "teacher1"
  22  
  23    @javascript
  24    Scenario: We have a quiz with one default section
  25      Given the following "activities" exist:
  26        | activity   | name   | intro              | course | idnumber |
  27        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
  28      And the following "questions" exist:
  29        | questioncategory | qtype       | name | questiontext    |
  30        | Test questions   | truefalse   | TF1  | This is question 01 |
  31        | Test questions   | truefalse   | TF2  | This is question 02 |
  32        | Test questions   | truefalse   | TF3  | This is question 03 |
  33      And quiz "Quiz 1" contains the following questions:
  34        | question | page |
  35        | TF1      | 1    |
  36        | TF2      | 2    |
  37        | TF3      | 3    |
  38      When I follow "Course 1"
  39      And I follow "Quiz 1"
  40      And I follow "Edit quiz"
  41      Then I should see "Shuffle"
  42  
  43    @javascript
  44    Scenario: Modify the default section headings
  45      Given the following "activities" exist:
  46        | activity   | name   | intro              | course | idnumber |
  47        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
  48      When I follow "Course 1"
  49      And I follow "Quiz 1"
  50      And I follow "Edit quiz"
  51      And I change quiz section heading "" to "This is section one"
  52      Then I should see "This is section one"
  53  
  54   @javascript
  55    Scenario: Modify section headings
  56      Given the following "activities" exist:
  57        | activity   | name   | intro              | course | idnumber |
  58        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
  59      And the following "questions" exist:
  60        | questioncategory | qtype       | name | questiontext    |
  61        | Test questions   | truefalse   | TF1  | This is question 01 |
  62        | Test questions   | truefalse   | TF2  | This is question 02 |
  63        | Test questions   | truefalse   | TF3  | This is question 03 |
  64        | Test questions   | truefalse   | TF4  | This is question 04 |
  65        | Test questions   | truefalse   | TF5  | This is question 05 |
  66      And quiz "Quiz 1" contains the following questions:
  67        | question | page |
  68        | TF1      | 1    |
  69        | TF2      | 2    |
  70        | TF3      | 3    |
  71        | TF4      | 3    |
  72      And quiz "Quiz 1" contains the following sections:
  73        | heading   | firstslot | shuffle |
  74        |           | 1         | 0       |
  75        | Heading 2 | 2         | 0       |
  76        | Heading 3 | 3         | 1       |
  77      When I follow "Course 1"
  78      And I follow "Quiz 1"
  79      And I follow "Edit quiz"
  80      And I change quiz section heading "" to "This is section one"
  81      And I change quiz section heading "Heading 2" to "This is section two"
  82      Then I should see "This is section one"
  83      And I should see "This is section two"
  84  
  85    @javascript
  86    Scenario: Set section headings to blanks
  87      Given the following "activities" exist:
  88        | activity   | name   | intro              | course | idnumber |
  89        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
  90      And the following "questions" exist:
  91        | questioncategory | qtype       | name | questiontext    |
  92        | Test questions   | truefalse   | TF1  | This is question 01 |
  93        | Test questions   | truefalse   | TF2  | This is question 02 |
  94        | Test questions   | truefalse   | TF3  | This is question 03 |
  95        | Test questions   | truefalse   | TF4  | This is question 04 |
  96        | Test questions   | truefalse   | TF5  | This is question 05 |
  97      And quiz "Quiz 1" contains the following questions:
  98        | question | page |
  99        | TF1      | 1    |
 100        | TF2      | 2    |
 101        | TF3      | 3    |
 102        | TF4      | 3    |
 103      And quiz "Quiz 1" contains the following sections:
 104        | heading   | firstslot | shuffle |
 105        | Heading 1 | 1         | 0       |
 106        | Heading 2 | 2         | 0       |
 107        | Heading 3 | 3         | 1       |
 108      When I follow "Course 1"
 109      And I follow "Quiz 1"
 110      And I follow "Edit quiz"
 111      When I change quiz section heading "Heading 1" to ""
 112      Then I should not see "Heading 1"
 113      And I should see "Heading 2"
 114      And I should see "Heading 3"
 115  
 116      And I change quiz section heading "Heading 2" to ""
 117      And I should not see "Heading 1"
 118      And I should not see "Heading 2"
 119      And I should see "Heading 3"
 120  
 121      And I change quiz section heading "Heading 3" to ""
 122      And I should not see "Heading 1"
 123      And I should not see "Heading 2"
 124      And I should not see "Heading 3"
 125  
 126    @javascript
 127    Scenario: Remove a section
 128      Given the following "activities" exist:
 129        | activity   | name   | intro              | course | idnumber |
 130        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 131      And the following "questions" exist:
 132        | questioncategory | qtype       | name | questiontext    |
 133        | Test questions   | truefalse   | TF1  | This is question 01 |
 134        | Test questions   | truefalse   | TF2  | This is question 02 |
 135        | Test questions   | truefalse   | TF3  | This is question 03 |
 136      And quiz "Quiz 1" contains the following questions:
 137        | question | page |
 138        | TF1      | 1    |
 139        | TF2      | 2    |
 140        | TF3      | 3    |
 141      And quiz "Quiz 1" contains the following sections:
 142        | heading   | firstslot | shuffle |
 143        | Heading 1 | 1         | 0       |
 144        | Heading 2 | 2         | 0       |
 145        | Heading 3 | 3         | 1       |
 146      When I follow "Course 1"
 147      And I follow "Quiz 1"
 148      And I follow "Edit quiz"
 149      And I follow "Remove heading 'Heading 2'"
 150      And I should see "Are you sure you want to remove the 'Heading 2' section heading?"
 151      And I click on "Yes" "button" in the "Confirm" "dialogue"
 152      And I wait until the page is ready
 153      Then I should see "Heading 1"
 154      And I should not see "Heading 2"
 155      And I should see "Heading 3"
 156  
 157    @javascript
 158    Scenario: The edit-icon tool-tips are updated when a section is edited
 159      Given the following "activities" exist:
 160        | activity   | name   | intro              | course | idnumber |
 161        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 162      And the following "questions" exist:
 163        | questioncategory | qtype       | name | questiontext    |
 164        | Test questions   | truefalse   | TF1  | This is question 01 |
 165        | Test questions   | truefalse   | TF2  | This is question 02 |
 166      And quiz "Quiz 1" contains the following questions:
 167        | question | page |
 168        | TF1      | 1    |
 169        | TF2      | 2    |
 170      And quiz "Quiz 1" contains the following sections:
 171        | heading   | firstslot | shuffle |
 172        | Heading 1 | 1         | 0       |
 173        | Heading 2 | 2         | 0       |
 174      When I follow "Course 1"
 175      And I follow "Quiz 1"
 176      And I follow "Edit quiz"
 177      And I change quiz section heading "Heading 2" to "Edited heading"
 178      Then I should see "Edited heading"
 179      And "Edit heading 'Edited heading'" "link" should be visible
 180      And "Remove heading 'Edited heading'" "link" should be visible
 181  
 182    @javascript
 183    Scenario: Moving a question up from section 3 to the first section.
 184      Given the following "activities" exist:
 185        | activity   | name   | intro              | course | idnumber |
 186        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 187      And the following "questions" exist:
 188        | questioncategory | qtype       | name | questiontext    |
 189        | Test questions   | truefalse   | TF1  | This is question 01 |
 190        | Test questions   | truefalse   | TF2  | This is question 02 |
 191        | Test questions   | truefalse   | TF3  | This is question 03 |
 192        | Test questions   | truefalse   | TF4  | This is question 04 |
 193        | Test questions   | truefalse   | TF5  | This is question 05 |
 194        | Test questions   | truefalse   | TF6  | This is question 06 |
 195      And quiz "Quiz 1" contains the following questions:
 196        | question | page |
 197        | TF1      | 1    |
 198        | TF2      | 2    |
 199        | TF3      | 3    |
 200        | TF4      | 4    |
 201        | TF5      | 5    |
 202        | TF6      | 6    |
 203      And quiz "Quiz 1" contains the following sections:
 204        | heading   | firstslot | shuffle |
 205        | Heading 1 | 1         | 0       |
 206        | Heading 2 | 3         | 0       |
 207        | Heading 3 | 5         | 1       |
 208      When I follow "Course 1"
 209      And I follow "Quiz 1"
 210      And I follow "Edit quiz"
 211      And I move "TF5" to "After Question 2" in the quiz by clicking the move icon
 212      Then I should see "TF5" on quiz page "2"
 213  
 214    @javascript
 215    Scenario: moving a question down from the first section to the second section.
 216      Given the following "activities" exist:
 217        | activity   | name   | intro              | course | idnumber |
 218        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 219      And the following "questions" exist:
 220        | questioncategory | qtype       | name | questiontext    |
 221        | Test questions   | truefalse   | TF1  | This is question 01 |
 222        | Test questions   | truefalse   | TF2  | This is question 02 |
 223        | Test questions   | truefalse   | TF3  | This is question 03 |
 224        | Test questions   | truefalse   | TF4  | This is question 04 |
 225        | Test questions   | truefalse   | TF5  | This is question 05 |
 226        | Test questions   | truefalse   | TF6  | This is question 06 |
 227      And quiz "Quiz 1" contains the following questions:
 228        | question | page |
 229        | TF1      | 1    |
 230        | TF2      | 2    |
 231        | TF3      | 3    |
 232        | TF4      | 4    |
 233        | TF5      | 5    |
 234        | TF6      | 6    |
 235      And quiz "Quiz 1" contains the following sections:
 236        | heading   | firstslot | shuffle |
 237        | Heading 1 | 1         | 0       |
 238        | Heading 2 | 3         | 0       |
 239        | Heading 3 | 5         | 1       |
 240      When I follow "Course 1"
 241      And I follow "Quiz 1"
 242      And I follow "Edit quiz"
 243      And I move "TF1" to "After Question 3" in the quiz by clicking the move icon
 244      Then I should see "TF1" on quiz page "2"
 245  
 246    @javascript
 247    Scenario: I should not see a delete icon for the first section in the quiz.
 248      Given the following "activities" exist:
 249        | activity   | name   | intro              | course | idnumber |
 250        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 251      And the following "questions" exist:
 252        | questioncategory | qtype       | name | questiontext    |
 253        | Test questions   | truefalse   | TF1  | This is question 01 |
 254        | Test questions   | truefalse   | TF2  | This is question 02 |
 255        | Test questions   | truefalse   | TF3  | This is question 03 |
 256      And quiz "Quiz 1" contains the following questions:
 257        | question | page |
 258        | TF1      | 1    |
 259        | TF2      | 2    |
 260        | TF3      | 3    |
 261      And quiz "Quiz 1" contains the following sections:
 262        | heading   | firstslot | shuffle |
 263        | Heading 1 | 1         | 0       |
 264        | Heading 2 | 2         | 0       |
 265        | Heading 3 | 3         | 1       |
 266      When I follow "Course 1"
 267      And I follow "Quiz 1"
 268      And I follow "Edit quiz"
 269      Then "Remove heading 'Heading 1'" "link" should not exist
 270      And "Remove heading 'Heading 2'" "link" should exist
 271      And "Remove heading 'Heading 3'" "link" should exist
 272  
 273    @javascript
 274    Scenario: Turn shuffling on for a section
 275      Given the following "activities" exist:
 276        | activity   | name   | intro              | course | idnumber |
 277        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 278      And the following "questions" exist:
 279        | questioncategory | qtype       | name | questiontext    |
 280        | Test questions   | truefalse   | TF1  | This is question 01 |
 281        | Test questions   | truefalse   | TF2  | This is question 02 |
 282        | Test questions   | truefalse   | TF3  | This is question 03 |
 283      And quiz "Quiz 1" contains the following questions:
 284        | question | page |
 285        | TF1      | 1    |
 286        | TF2      | 2    |
 287        | TF3      | 3    |
 288      And quiz "Quiz 1" contains the following sections:
 289        | heading   | firstslot | shuffle |
 290        | Heading 1 | 1         | 0       |
 291        | Heading 2 | 2         | 0       |
 292        | Heading 3 | 3         | 0       |
 293      When I follow "Course 1"
 294      And I follow "Quiz 1"
 295      And I follow "Edit quiz"
 296      And I click on shuffle for section "Heading 1" on the quiz edit page
 297      And I click on shuffle for section "Heading 2" on the quiz edit page
 298      Then shuffle for section "Heading 1" should be "On" on the quiz edit page
 299      And shuffle for section "Heading 2" should be "On" on the quiz edit page
 300  
 301    @javascript
 302    Scenario: Turn shuffling off for a section
 303      Given the following "activities" exist:
 304        | activity   | name   | intro              | course | idnumber |
 305        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 306      And the following "questions" exist:
 307        | questioncategory | qtype       | name | questiontext    |
 308        | Test questions   | truefalse   | TF1  | This is question 01 |
 309        | Test questions   | truefalse   | TF2  | This is question 02 |
 310        | Test questions   | truefalse   | TF3  | This is question 03 |
 311      And quiz "Quiz 1" contains the following questions:
 312        | question | page |
 313        | TF1      | 1    |
 314        | TF2      | 2    |
 315        | TF3      | 3    |
 316      And quiz "Quiz 1" contains the following sections:
 317        | heading   | firstslot | shuffle |
 318        | Heading 1 | 1         | 1       |
 319        | Heading 2 | 2         | 1       |
 320        | Heading 3 | 3         | 1       |
 321      When I follow "Course 1"
 322      And I follow "Quiz 1"
 323      And I follow "Edit quiz"
 324      And I click on shuffle for section "Heading 1" on the quiz edit page
 325      And I click on shuffle for section "Heading 2" on the quiz edit page
 326      Then shuffle for section "Heading 1" should be "Off" on the quiz edit page
 327      And shuffle for section "Heading 2" should be "Off" on the quiz edit page
 328      And I reload the page
 329      And shuffle for section "Heading 1" should be "Off" on the quiz edit page
 330      And shuffle for section "Heading 2" should be "Off" on the quiz edit page
 331  
 332    @javascript
 333    Scenario: Add section heading option only appears for pages that are not the first in their section.
 334      Given the following "activities" exist:
 335        | activity   | name   | intro              | course | idnumber |
 336        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 337      And the following "questions" exist:
 338        | questioncategory | qtype       | name | questiontext    |
 339        | Test questions   | truefalse   | TF1  | This is question 01 |
 340        | Test questions   | truefalse   | TF2  | This is question 02 |
 341        | Test questions   | truefalse   | TF3  | This is question 03 |
 342      And quiz "Quiz 1" contains the following questions:
 343        | question | page |
 344        | TF1      | 1    |
 345        | TF2      | 1    |
 346        | TF3      | 2    |
 347      When I follow "Course 1"
 348      And I follow "Quiz 1"
 349      And I follow "Edit quiz"
 350      And I click on the "Add" page break icon after question "TF1"
 351      And I click on "Add" "link" in the "Page 1" "list_item"
 352      Then "a new section heading" "list_item" in the "Page 1" "list_item" should not be visible
 353      # Click away to close the menu.
 354      And I click on ".numberofquestions" "css_element"
 355      And I click on "Add" "link" in the "Page 2" "list_item"
 356      And "a new section heading" "list_item" in the "Page 2" "list_item" should be visible
 357      And I click on ".numberofquestions" "css_element"
 358      And I click on "Add" "link" in the "Page 3" "list_item"
 359      And "a new section heading" "list_item" in the "Page 3" "list_item" should be visible
 360      And I click on ".numberofquestions" "css_element"
 361      And I click on "Add" "link" in the ".last-add-menu" "css_element"
 362      And "a new section heading" "list_item" in the ".last-add-menu" "css_element" should not be visible
 363  
 364    @javascript
 365    Scenario: Verify sections are added in the right place afte ajax changes
 366      Given the following "activities" exist:
 367        | activity   | name   | intro              | course | idnumber |
 368        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
 369      And the following "questions" exist:
 370        | questioncategory | qtype       | name | questiontext    |
 371        | Test questions   | truefalse   | TF1  | This is question 01 |
 372        | Test questions   | truefalse   | TF2  | This is question 02 |
 373        | Test questions   | truefalse   | TF3  | This is question 03 |
 374        | Test questions   | truefalse   | TF4  | This is question 04 |
 375      And quiz "Quiz 1" contains the following questions:
 376        | question | page |
 377        | TF1      | 1    |
 378        | TF2      | 2    |
 379        | TF3      | 3    |
 380        | TF4      | 4    |
 381  
 382      When I follow "Course 1"
 383      And I follow "Quiz 1"
 384      And I follow "Edit quiz"
 385      And I click on the "Remove" page break icon after question "TF1"
 386      And I open the "Page 2" add to quiz menu
 387      And I follow "a new section heading" in the open menu
 388      Then "TF3" "list_item" should exist in the "Section heading ..." "list_item"


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