[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_quiz
   2  Feature: Edit quizzes where some questions require the previous one to have been completed
   3    In order to create quizzes where later questions can only be seen after earlier ones are answered
   4    As a teacher
   5    I need to be able to configure this on the Edit quiz page
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email                |
  10        | teacher1 | T1        | Teacher1 | teacher1@example.com |
  11      And the following "courses" exist:
  12        | fullname | shortname | category |
  13        | Course 1 | C1        | 0        |
  14      And the following "course enrolments" exist:
  15        | user     | course | role           |
  16        | teacher1 | C1     | editingteacher |
  17      And the following "question categories" exist:
  18        | contextlevel | reference | name           |
  19        | Course       | C1        | Test questions |
  20      And I log in as "teacher1"
  21  
  22    @javascript
  23    Scenario: The first question cannot depend on the previous (whatever is in the DB)
  24      Given the following "activities" exist:
  25        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  26        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  27      And the following "questions" exist:
  28        | questioncategory | qtype       | name | questiontext    |
  29        | Test questions   | truefalse   | TF1  | First question  |
  30      And quiz "Quiz 1" contains the following questions:
  31        | question | page | requireprevious |
  32        | TF1      | 1    | 1               |
  33      And I follow "Course 1"
  34      And I follow "Quiz 1"
  35      And I follow "Edit quiz"
  36      Then "be attempted" "link" should not be visible
  37      # The text "be attempted" is used as a relatively unique string in both the add and remove links.
  38  
  39    @javascript
  40    Scenario: If the second question depends on the first, that is shown
  41      Given the following "activities" exist:
  42        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  43        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  44      And the following "questions" exist:
  45        | questioncategory | qtype       | name | questiontext    |
  46        | Test questions   | truefalse   | TF1  | First question  |
  47        | Test questions   | truefalse   | TF2  | Second question |
  48      And quiz "Quiz 1" contains the following questions:
  49        | question | page | requireprevious |
  50        | TF1      | 1    | 0               |
  51        | TF2      | 1    | 1               |
  52      And I follow "Course 1"
  53      And I follow "Quiz 1"
  54      And I follow "Edit quiz"
  55      Then "This question cannot be attempted until the previous question has been completed." "link" should be visible
  56  
  57    @javascript
  58    Scenario: A question can depend on a random question
  59      Given the following "activities" exist:
  60        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  61        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  62      And the following "questions" exist:
  63        | questioncategory | qtype       | name                    | questiontext   |
  64        | Test questions   | truefalse   | TF1                     | First question |
  65        | Test questions   | random      | Random (Test questions) | 0              |
  66      And quiz "Quiz 1" contains the following questions:
  67        | question                | page | requireprevious |
  68        | Random (Test questions) | 1    | 0               |
  69        | TF1                     | 1    | 1               |
  70      And I follow "Course 1"
  71      And I follow "Quiz 1"
  72      And I follow "Edit quiz"
  73      Then "This question cannot be attempted until the previous question has been completed." "link" should be visible
  74  
  75    @javascript
  76    Scenario: The second question can be set to depend on the first
  77      Given the following "activities" exist:
  78        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  79        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  80      And the following "questions" exist:
  81        | questioncategory | qtype       | name | questiontext    |
  82        | Test questions   | truefalse   | TF1  | First question  |
  83        | Test questions   | truefalse   | TF2  | Second question |
  84        | Test questions   | truefalse   | TF3  | Third question  |
  85      And quiz "Quiz 1" contains the following questions:
  86        | question | page | requireprevious |
  87        | TF1      | 1    | 0               |
  88        | TF2      | 1    | 0               |
  89        | TF3      | 1    | 0               |
  90      And I follow "Course 1"
  91      And I follow "Quiz 1"
  92      And I follow "Edit quiz"
  93      When I follow "No restriction on when question 2 can be attempted • Click to change"
  94      Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
  95      And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
  96  
  97    @javascript
  98    Scenario: A question that did depend on the previous can be un-linked
  99      Given the following "activities" exist:
 100        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 101        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 102      And the following "questions" exist:
 103        | questioncategory | qtype       | name | questiontext    |
 104        | Test questions   | truefalse   | TF1  | First question  |
 105        | Test questions   | truefalse   | TF2  | Second question |
 106        | Test questions   | truefalse   | TF3  | Third question  |
 107      And quiz "Quiz 1" contains the following questions:
 108        | question | page | requireprevious |
 109        | TF1      | 1    | 0               |
 110        | TF2      | 1    | 1               |
 111        | TF3      | 1    | 1               |
 112      And I follow "Course 1"
 113      And I follow "Quiz 1"
 114      And I follow "Edit quiz"
 115      When I follow "Question 3 cannot be attempted until the previous question 2 has been completed • Click to change"
 116      Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
 117      And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
 118  
 119    @javascript
 120    Scenario: Question dependency cannot apply to deferred feedback quizzes so UI is hidden
 121      Given the following "activities" exist:
 122        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 123        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | deferredfeedback   |
 124      And the following "questions" exist:
 125        | questioncategory | qtype       | name                    | questiontext    |
 126        | Test questions   | truefalse   | TF1                     | First question  |
 127        | Test questions   | truefalse   | TF2                     | Second question |
 128        | Test questions   | random      | Random (Test questions) | 0               |
 129      And quiz "Quiz 1" contains the following questions:
 130        | question                | page | requireprevious |
 131        | Random (Test questions) | 1    | 0               |
 132        | TF1                     | 1    | 1               |
 133        | TF2                     | 1    | 1               |
 134      And I follow "Course 1"
 135      And I follow "Quiz 1"
 136      And I follow "Edit quiz"
 137      Then "be attempted" "link" in the "TF1" "list_item" should not be visible
 138      Then "be attempted" "link" in the "TF2" "list_item" should not be visible
 139  
 140    @javascript
 141    Scenario: Question dependency cannot apply to questions in a shuffled section so UI is hidden
 142      Given the following "activities" exist:
 143        | activity   | name   | intro              | course | idnumber | preferredbehaviour | questionsperpage |
 144        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | 2                |
 145      And the following "questions" exist:
 146        | questioncategory | qtype       | name | questiontext    |
 147        | Test questions   | truefalse   | TF1  | First question  |
 148        | Test questions   | truefalse   | TF2  | Second question |
 149      And quiz "Quiz 1" contains the following questions:
 150        | question | page | requireprevious |
 151        | TF1      | 1    | 1               |
 152        | TF2      | 1    | 1               |
 153      And quiz "Quiz 1" contains the following sections:
 154        | heading   | firstslot | shuffle |
 155        | Section 1 | 1         | 1       |
 156      And I follow "Course 1"
 157      And I follow "Quiz 1"
 158      And I follow "Edit quiz"
 159      Then "be attempted" "link" in the "TF2" "list_item" should not be visible
 160  
 161    @javascript
 162    Scenario: Question dependency cannot apply to the first questions in section when the previous section is shuffled
 163      Given the following "activities" exist:
 164        | activity   | name   | intro              | course | idnumber | preferredbehaviour | questionsperpage |
 165        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | 2                |
 166      And the following "questions" exist:
 167        | questioncategory | qtype       | name | questiontext    |
 168        | Test questions   | truefalse   | TF1  | First question  |
 169        | Test questions   | truefalse   | TF2  | Second question |
 170      And quiz "Quiz 1" contains the following questions:
 171        | question | page | requireprevious |
 172        | TF1      | 1    | 1               |
 173        | TF2      | 1    | 1               |
 174      And quiz "Quiz 1" contains the following sections:
 175        | heading   | firstslot | shuffle |
 176        | Section 1 | 1         | 1       |
 177        | Section 2 | 2         | 0       |
 178      And I follow "Course 1"
 179      And I follow "Quiz 1"
 180      And I follow "Edit quiz"
 181      Then "be attempted" "link" in the "TF2" "list_item" should not be visible
 182  
 183    @javascript
 184    Scenario: Question dependency cannot apply to quizzes with sequential navigation so UI is hidden
 185      Given the following "activities" exist:
 186        | activity   | name   | intro              | course | idnumber | preferredbehaviour | navmethod  |
 187        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | sequential |
 188      And the following "questions" exist:
 189        | questioncategory | qtype       | name | questiontext    |
 190        | Test questions   | truefalse   | TF1  | First question  |
 191        | Test questions   | truefalse   | TF2  | Second question |
 192      And quiz "Quiz 1" contains the following questions:
 193        | question | page | requireprevious |
 194        | TF1      | 1    | 1               |
 195        | TF2      | 1    | 1               |
 196      And I follow "Course 1"
 197      And I follow "Quiz 1"
 198      And I follow "Edit quiz"
 199      Then "be attempted" "link" in the "TF2" "list_item" should not be visible
 200  
 201    @javascript
 202    Scenario: A question can never depend on an essay
 203      Given the following "activities" exist:
 204        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 205        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 206      And the following "questions" exist:
 207        | questioncategory | qtype       | name  | questiontext   |
 208        | Test questions   | essay       | Story | First question |
 209        | Test questions   | truefalse   | TF1   | First question |
 210      And quiz "Quiz 1" contains the following questions:
 211        | question | page | requireprevious |
 212        | Story    | 1    | 0               |
 213        | TF1      | 1    | 0               |
 214      And I follow "Course 1"
 215      And I follow "Quiz 1"
 216      And I follow "Edit quiz"
 217      Then "be attempted" "link" in the "TF1" "list_item" should not be visible
 218  
 219    @javascript
 220    Scenario: A question can never depend on a description
 221      Given the following "activities" exist:
 222        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 223        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 224      And the following "questions" exist:
 225        | questioncategory | qtype       | name | questiontext   |
 226        | Test questions   | description | Info | Read me        |
 227        | Test questions   | truefalse   | TF1  | First question |
 228      And quiz "Quiz 1" contains the following questions:
 229        | question | page | requireprevious |
 230        | Info     | 1    | 0               |
 231        | TF1      | 1    | 0               |
 232      And I follow "Course 1"
 233      And I follow "Quiz 1"
 234      And I follow "Edit quiz"
 235      Then "be attempted" "link" in the "TF1" "list_item" should not be visible
 236  
 237    @javascript
 238    Scenario: When questions are reordered, the dependency icons are updated correctly
 239      Given the following "activities" exist:
 240        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 241        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 242      And the following "questions" exist:
 243        | questioncategory | qtype       | name | questiontext    |
 244        | Test questions   | truefalse   | TF1  | First question  |
 245        | Test questions   | truefalse   | TF2  | Second question |
 246        | Test questions   | truefalse   | TF3  | Third question  |
 247      And quiz "Quiz 1" contains the following questions:
 248        | question | page | requireprevious |
 249        | TF1      | 1    | 0               |
 250        | TF2      | 1    | 1               |
 251        | TF3      | 1    | 1               |
 252      And I follow "Course 1"
 253      And I follow "Quiz 1"
 254      And I follow "Edit quiz"
 255      When I move "Question 1" to "After Question 3" in the quiz by clicking the move icon
 256      Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible
 257      And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible
 258      And "be attempted" "link" in the "TF2" "list_item" should not be visible


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