[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/lesson/tests/behat/ -> lesson_question_attempts.feature (source)

   1  @mod @mod_lesson
   2  Feature: In a lesson activity, students can not re-attempt a question more than the allowed amount
   3    In order to check a lesson question can not be attempted more than the allowed amount
   4    As a student I need to check I cannot reattempt a question more than I should be allowed
   5  
   6    Background:
   7      Given the following "users" exist:
   8        | username | firstname | lastname | email |
   9        | teacher1 | Teacher | 1 | teacher1@example.com |
  10        | student1 | Student | 1 | student1@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        | student1 | C1 | student |
  18      And I log in as "teacher1"
  19      And I follow "Course 1"
  20      And I turn editing mode on
  21      And I add a "Lesson" to section "1"
  22      And I set the following fields to these values:
  23        | Name | Test lesson name |
  24        | Description | Test lesson description |
  25        | Re-takes allowed | Yes |
  26        | Minimum number of questions | 3 |
  27      And I press "Save and return to course"
  28      And I follow "Test lesson name"
  29      And I follow "Add a content page"
  30      And I set the following fields to these values:
  31        | Page title | First page name |
  32        | Page contents | First page contents |
  33        | id_answer_editor_0 | Next page |
  34        | id_jumpto_0 | Next page |
  35      And I press "Save page"
  36      And I select "Add a content page" from the "qtype" singleselect
  37      And I set the following fields to these values:
  38        | Page title | Third page name |
  39        | Page contents | Third page contents |
  40        | id_answer_editor_0 | Previous page |
  41        | id_jumpto_0 | Previous page |
  42        | id_answer_editor_1 | Next page |
  43        | id_jumpto_1 | Next page |
  44      And I press "Save page"
  45      And I select "Question" from the "qtype" singleselect
  46      And I set the field "Select a question type" to "True/false"
  47      And I press "Add a question page"
  48      And I set the following fields to these values:
  49        | Page title | True/false question 3 |
  50        | Page contents | Paper is made from trees. |
  51        | id_answer_editor_0 | True |
  52        | id_response_editor_0 | Correct |
  53        | id_jumpto_0 | Next page |
  54        | id_answer_editor_1 | False |
  55        | id_response_editor_1 | Wrong |
  56        | id_jumpto_1 | This page |
  57      And I press "Save page"
  58      And I select "Add a content page" from the "qtype" singleselect
  59      And I set the following fields to these values:
  60        | Page title | Second page name |
  61        | Page contents | Second page contents |
  62        | id_answer_editor_0 | Previous page |
  63        | id_jumpto_0 | Previous page |
  64        | id_answer_editor_1 | Next page |
  65        | id_jumpto_1 | Next page |
  66      And I press "Save page"
  67      And I select "Question" from the "qtype" singleselect
  68      And I set the field "Select a question type" to "True/false"
  69      And I press "Add a question page"
  70      And I set the following fields to these values:
  71        | Page title | True/false question 2 |
  72        | Page contents | Kermit is a frog |
  73        | id_answer_editor_0 | True |
  74        | id_response_editor_0 | Correct |
  75        | id_jumpto_0 | Next page |
  76        | id_answer_editor_1 | False |
  77        | id_response_editor_1 | Wrong |
  78        | id_jumpto_1 | This page |
  79      And I press "Save page"
  80      And I select "Question" from the "qtype" singleselect
  81      And I set the field "Select a question type" to "True/false"
  82      And I press "Add a question page"
  83      And I set the following fields to these values:
  84        | Page title | True/false question 1 |
  85        | Page contents | The earth is round. |
  86        | id_answer_editor_0 | True |
  87        | id_response_editor_0 | Correct |
  88        | id_jumpto_0 | Next page |
  89        | id_answer_editor_1 | False |
  90        | id_response_editor_1 | Wrong |
  91        | id_jumpto_1 | This page |
  92      And I press "Save page"
  93      And I log out
  94  
  95    Scenario: Check that we can leave a quiz and when we re-enter we can not re-attempt the question again
  96      Given I log in as "student1"
  97      And I follow "Course 1"
  98      And I follow "Test lesson name"
  99      And I should see "First page contents"
 100      And I press "Next page"
 101      And I should see "The earth is round"
 102      And I set the following fields to these values:
 103        | False| 1 |
 104      And I press "Submit"
 105      And I should see "Wrong"
 106      And I follow "Course 1"
 107      And I follow "Test lesson name"
 108      And I should see "Do you want to start at the last page you saw?"
 109      And I follow "No"
 110      And I should see "First page contents"
 111      And I press "Next page"
 112      And I should see "The earth is round"
 113      And I set the following fields to these values:
 114        | False| 1 |
 115      When I press "Submit"
 116      Then I should see "Maximum number of attempts reached - Moving to next page"
 117  
 118    @javascript @_bug_phantomjs
 119    Scenario: Check that we can not click back on the browser at the last quiz result page and re-attempt the last question to get full marks
 120      Given I log in as "student1"
 121      And I follow "Course 1"
 122      And I follow "Test lesson name"
 123      And I should see "First page contents"
 124      And I press "Next page"
 125      And I should see "The earth is round"
 126      And I set the following fields to these values:
 127        | True| 1 |
 128      And I press "Submit"
 129      And I should see "Correct"
 130      And I press "Continue"
 131      And I should see "Kermit is a frog"
 132      And I set the following fields to these values:
 133        | True| 1 |
 134      And I press "Submit"
 135      And I should see "Correct"
 136      And I press "Continue"
 137      And I should see "Second page contents"
 138      And I press "Next page"
 139      And I should see "Paper is made from trees"
 140      And I set the following fields to these values:
 141        | False | 1 |
 142      And I press "Submit"
 143      And I should see "Wrong"
 144      And I press "Continue"
 145      And I should see "Third page contents"
 146      And I press "Next page"
 147      And I should see "Congratulations - end of lesson reached"
 148      And I should see "Your score is 2 (out of 3)"
 149      And I press the "back" button in the browser
 150      And I press the "back" button in the browser
 151      And I press the "back" button in the browser
 152      And I should see "Paper is made from trees"
 153      And I set the following fields to these values:
 154        | True | 1 |
 155      And I press "Submit"
 156      And I should see "Correct"
 157      And I press "Continue"
 158      And I should see "Third page contents"
 159      When I press "Next page"
 160      Then I should see "Number of questions answered: 1 (You should answer at least 3)"
 161  
 162    @javascript
 163    Scenario: Check that we can not click back on the browser and re-attempt a question
 164      Given I log in as "student1"
 165      And I follow "Course 1"
 166      And I follow "Test lesson name"
 167      And I should see "First page contents"
 168      And I press "Next page"
 169      And I should see "The earth is round"
 170      And I set the following fields to these values:
 171        | False | 1 |
 172      And I press "Submit"
 173      And I should see "Wrong"
 174      And I press the "back" button in the browser
 175      And I set the following fields to these values:
 176        | True | 1 |
 177      When I press "Submit"
 178      Then I should see "Maximum number of attempts reached - Moving to next page"
 179      And I press "Continue"
 180      And I should see "Kermit is a frog"
 181      And I set the following fields to these values:
 182        | False | 1 |
 183      And I press "Submit"
 184      And I should see "Wrong"
 185      And I press the "back" button in the browser
 186      And I set the following fields to these values:
 187        | True | 1 |
 188      And I press "Submit"
 189      And I should see "Maximum number of attempts reached - Moving to next page"
 190      And I press "Continue"
 191      And I should see "Second page contents"
 192      And I press "Next page"
 193      And I should see "Paper is made from trees"
 194      And I set the following fields to these values:
 195        | True | 1 |
 196      And I press "Submit"
 197      And I should see "Correct"
 198      And I press the "back" button in the browser
 199      And I set the following fields to these values:
 200        | False | 1 |
 201      And I press "Submit"
 202      And I should see "Maximum number of attempts reached - Moving to next page"
 203      And I press "Continue"
 204      And I should see "Third page contents"
 205      And I press "Next page"
 206      And I should see "Congratulations - end of lesson reached"
 207      And I should see "Your score is 1 (out of 3)"


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