[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_quiz
   2  Feature: Attemp a quiz where some questions require that the previous question has been answered.
   3    In order to complete a quiz where questions require previous ones to be complete
   4    As a student
   5    I need later questions to appear once earlier ones have been answered.
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email               |
  10        | student  | Student   | One      | student@example.com |
  11        | teacher  | Teacher   | One      | teacher@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        | student  | C1     | student |
  18        | teacher  | C1     | teacher |
  19      And the following "question categories" exist:
  20        | contextlevel | reference | name           |
  21        | Course       | C1        | Test questions |
  22  
  23    @javascript
  24    Scenario: A question that requires the previous one is initally blocked
  25      Given the following "questions" exist:
  26        | questioncategory | qtype       | name  | questiontext    |
  27        | Test questions   | truefalse   | TF1   | First question  |
  28        | Test questions   | truefalse   | TF2   | Second question |
  29      And the following "activities" exist:
  30        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  31        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  32      And quiz "Quiz 1" contains the following questions:
  33        | question | page | requireprevious |
  34        | TF1      | 1    | 0               |
  35        | TF2      | 1    | 1               |
  36  
  37      When I log in as "student"
  38      And I follow "Course 1"
  39      And I follow "Quiz 1"
  40      And I press "Attempt quiz now"
  41  
  42      Then I should see "First question"
  43      And I should see "This question cannot be attempted until the previous question has been completed."
  44      And I should not see "Second question"
  45      And I log out
  46      And I log in as "teacher"
  47      And I follow "Course 1"
  48      And I follow "Quiz 1"
  49      And I follow "Attempts: 1"
  50      And I follow "Review attempt"
  51      And I should see "First question"
  52      And I should see "This question cannot be attempted until the previous question has been completed."
  53      And I should not see "Second question"
  54      And "Question 1" "link" should exist
  55      And "Question 2" "link" should not exist
  56  
  57    @javascript
  58    Scenario: A question requires the previous one becomes available when the first one is answered
  59      Given the following "questions" exist:
  60        | questioncategory | qtype       | name  | questiontext    |
  61        | Test questions   | truefalse   | TF1   | First question  |
  62        | Test questions   | truefalse   | TF2   | Second question |
  63      And the following "activities" exist:
  64        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
  65        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  66      And quiz "Quiz 1" contains the following questions:
  67        | question | page | requireprevious |
  68        | TF1      | 1    | 0               |
  69        | TF2      | 1    | 1               |
  70  
  71      When I log in as "student"
  72      And I follow "Course 1"
  73      And I follow "Quiz 1"
  74      And I press "Attempt quiz now"
  75      And I click on "True" "radio" in the "First question" "question"
  76      And I press "Check"
  77  
  78      Then I should see "First question"
  79      And I should not see "This question cannot be attempted until the previous question has been completed."
  80      And I should see "Second question"
  81      And "Question 1" "link" should exist
  82      And "Question 2" "link" should exist
  83  
  84    @javascript
  85    Scenario: After quiz submitted, all questions show on the review page
  86      Given the following "questions" exist:
  87        | questioncategory | qtype       | name  | questiontext    |
  88        | Test questions   | truefalse   | TF1   | First question  |
  89        | Test questions   | truefalse   | TF2   | Second question |
  90      And the following "activities" exist:
  91        | activity | name   | intro              | course | idnumber | preferredbehaviour |
  92        | quiz     | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
  93      And quiz "Quiz 1" contains the following questions:
  94        | question | page | requireprevious |
  95        | TF1      | 1    | 0               |
  96        | TF2      | 1    | 1               |
  97  
  98      When I log in as "student"
  99      And I follow "Course 1"
 100      And I follow "Quiz 1"
 101      And I press "Attempt quiz now"
 102      And I press "Finish attempt ..."
 103      And I press "Submit all and finish"
 104      And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
 105  
 106      Then the state of "First question" question is shown as "Not answered"
 107      And the state of "Second question" question is shown as "Not answered"
 108  
 109    @javascript
 110    Scenario: A questions cannot be blocked in a deferred feedback quiz (despite what is set in the DB).
 111      Given the following "questions" exist:
 112        | questioncategory | qtype       | name  | questiontext    |
 113        | Test questions   | truefalse   | TF1   | First question  |
 114        | Test questions   | truefalse   | TF2   | Second question |
 115      And the following "activities" exist:
 116        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 117        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | deferredfeedback   |
 118      And quiz "Quiz 1" contains the following questions:
 119        | question | page | requireprevious |
 120        | TF1      | 1    | 0               |
 121        | TF2      | 1    | 1               |
 122  
 123      When I log in as "student"
 124      And I follow "Course 1"
 125      And I follow "Quiz 1"
 126      And I press "Attempt quiz now"
 127  
 128      Then I should see "First question"
 129      And I should see "Second question"
 130      And I should not see "This question cannot be attempted until the previous question has been completed."
 131  
 132    @javascript
 133    Scenario: Questions cannot be blocked in a shuffled section (despite what is set in the DB).
 134      Given the following "questions" exist:
 135        | questioncategory | qtype       | name  | questiontext    |
 136        | Test questions   | truefalse   | TF1   | First question  |
 137        | Test questions   | truefalse   | TF2   | Second question |
 138      And the following "activities" exist:
 139        | activity   | name   | intro              | course | idnumber | preferredbehaviour | questionsperpage |
 140        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | 2                |
 141      And quiz "Quiz 1" contains the following questions:
 142        | question | page | requireprevious |
 143        | TF1      | 1    | 1               |
 144        | TF2      | 2    | 1               |
 145      And quiz "Quiz 1" contains the following sections:
 146        | heading   | firstslot | shuffle |
 147        | Section 1 | 1         | 1       |
 148  
 149      When I log in as "student"
 150      And I follow "Course 1"
 151      And I follow "Quiz 1"
 152      And I press "Attempt quiz now"
 153  
 154      Then I should see "First question"
 155      And I should see "Second question"
 156      And I should not see "This question cannot be attempted until the previous question has been completed."
 157  
 158    @javascript
 159    Scenario: Question dependency cannot apply to the first questions in section when the previous section is shuffled
 160      Given the following "questions" exist:
 161        | questioncategory | qtype       | name  | questiontext    |
 162        | Test questions   | truefalse   | TF1   | First question  |
 163        | Test questions   | truefalse   | TF2   | Second question |
 164      And the following "activities" exist:
 165        | activity   | name   | intro              | course | idnumber | preferredbehaviour | questionsperpage |
 166        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | 2                |
 167      And quiz "Quiz 1" contains the following questions:
 168        | question | page | requireprevious |
 169        | TF1      | 1    | 1               |
 170        | TF2      | 2    | 1               |
 171      And quiz "Quiz 1" contains the following sections:
 172        | heading   | firstslot | shuffle |
 173        | Section 1 | 1         | 1       |
 174        | Section 2 | 2         | 0       |
 175  
 176      When I log in as "student"
 177      And I follow "Course 1"
 178      And I follow "Quiz 1"
 179      And I press "Attempt quiz now"
 180      And I press "Next page"
 181  
 182      Then I should see "Second question"
 183      And I should not see "This question cannot be attempted until the previous question has been completed."
 184  
 185    @javascript
 186    Scenario: A questions cannot be blocked in sequential quiz (despite what is set in the DB).
 187      Given the following "questions" exist:
 188        | questioncategory | qtype       | name  | questiontext    |
 189        | Test questions   | truefalse   | TF1   | First question  |
 190        | Test questions   | truefalse   | TF2   | Second question |
 191      And the following "activities" exist:
 192        | activity   | name   | intro              | course | idnumber | preferredbehaviour | navmethod  |
 193        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | sequential |
 194      And quiz "Quiz 1" contains the following questions:
 195        | question | page | requireprevious |
 196        | TF1      | 1    | 1               |
 197        | TF2      | 1    | 1               |
 198  
 199      When I log in as "student"
 200      And I follow "Course 1"
 201      And I follow "Quiz 1"
 202      And I press "Attempt quiz now"
 203  
 204      Then I should see "First question"
 205      And I should see "Second question"
 206      And I should not see "This question cannot be attempted until the previous question has been completed."
 207  
 208    @javascript
 209    Scenario: A questions not blocked if the previous one cannot finish, e.g. essay (despite what is set in the DB).
 210      Given the following "questions" exist:
 211        | questioncategory | qtype       | name  | questiontext    |
 212        | Test questions   | essay       | Story | First question  |
 213        | Test questions   | truefalse   | TF2   | Second question |
 214      And the following "activities" exist:
 215        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 216        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 217      And quiz "Quiz 1" contains the following questions:
 218        | question | page | requireprevious |
 219        | Story    | 1    | 0               |
 220        | TF2      | 1    | 1               |
 221  
 222      When I log in as "student"
 223      And I follow "Course 1"
 224      And I follow "Quiz 1"
 225      And I press "Attempt quiz now"
 226  
 227      Then I should see "First question"
 228      And I should see "Second question"
 229      And I should not see "This question cannot be attempted until the previous question has been completed."
 230  
 231    @javascript
 232    Scenario: A questions not blocked if the previous one cannot finish, e.g. description (despite what is set in the DB).
 233      Given the following "questions" exist:
 234        | questioncategory | qtype       | name | questiontext   |
 235        | Test questions   | description | Info | Read me        |
 236        | Test questions   | truefalse   | TF1  | First question |
 237      And the following "activities" exist:
 238        | activity   | name   | intro              | course | idnumber | preferredbehaviour |
 239        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  |
 240      And quiz "Quiz 1" contains the following questions:
 241        | question | page | requireprevious |
 242        | Info     | 1    | 0               |
 243        | TF1      | 1    | 1               |
 244  
 245      When I log in as "student"
 246      And I follow "Course 1"
 247      And I follow "Quiz 1"
 248      And I press "Attempt quiz now"
 249  
 250      Then I should see "Read me"
 251      And I should see "First question"
 252      And I should not see "This question cannot be attempted until the previous question has been completed."


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