[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_lesson
   2  Feature: In a lesson activity a student should
   3    be able to close the lesson and then later resume.
   4  
   5    Background:
   6      Given the following "users" exist:
   7        | username | firstname | lastname | email |
   8        | teacher1 | Teacher | 1 | teacher1@example.com |
   9        | student1 | Student | 1 | student1@example.com |
  10      And the following "courses" exist:
  11        | fullname | shortname | category |
  12        | Course 1 | C1 | 0 |
  13      And the following "course enrolments" exist:
  14        | user | course | role |
  15        | teacher1 | C1 | editingteacher |
  16        | student1 | C1 | student |
  17      And I log in as "teacher1"
  18      And I follow "Course 1"
  19      And I turn editing mode on
  20      And I add a "Lesson" to section "1"
  21      And I set the following fields to these values:
  22        | Name | Test lesson name |
  23        | Description | Test lesson description |
  24        | Re-takes allowed | Yes |
  25      And I press "Save and return to course"
  26      And I follow "Test lesson name"
  27  
  28    Scenario: resume a lesson with both content then question pages
  29      Given 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 "Question" from the "qtype" singleselect
  37      And I set the field "Select a question type" to "True/false"
  38      And I press "Add a question page"
  39      And I set the following fields to these values:
  40        | Page title | True/false question 2 |
  41        | Page contents | Kermit is a frog |
  42        | id_answer_editor_0 | True |
  43        | id_response_editor_0 | Correct |
  44        | id_jumpto_0 | Next page |
  45        | id_answer_editor_1 | False |
  46        | id_response_editor_1 | Wrong |
  47        | id_jumpto_1 | This page |
  48      And I press "Save page"
  49      And I select "Question" from the "qtype" singleselect
  50      And I set the field "Select a question type" to "True/false"
  51      And I press "Add a question page"
  52      And I set the following fields to these values:
  53        | Page title | True/false question 1 |
  54        | Page contents | Paper is made from trees. |
  55        | id_answer_editor_0 | True |
  56        | id_response_editor_0 | Correct |
  57        | id_jumpto_0 | Next page |
  58        | id_answer_editor_1 | False |
  59        | id_response_editor_1 | Wrong |
  60        | id_jumpto_1 | This page |
  61      And I press "Save page"
  62      And I select "Add a content page" from the "qtype" singleselect
  63      And I set the following fields to these values:
  64        | Page title | Third page name |
  65        | Page contents | Third page contents |
  66        | id_answer_editor_0 | Previous page |
  67        | id_jumpto_0 | Previous page |
  68        | id_answer_editor_1 | Next page |
  69        | id_jumpto_1 | Next page |
  70      And I press "Save page"
  71      And I select "Add a content page" from the "qtype" singleselect
  72      And I set the following fields to these values:
  73        | Page title | Second page name |
  74        | Page contents | Second page contents |
  75        | id_answer_editor_0 | Previous page |
  76        | id_jumpto_0 | Previous page |
  77        | id_answer_editor_1 | Next page |
  78        | id_jumpto_1 | Next page |
  79      And I press "Save page"
  80      And I log out
  81      When I log in as "student1"
  82      And I follow "Course 1"
  83      And I follow "Test lesson name"
  84      And I should see "First page contents"
  85      And I press "Next page"
  86      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
  87      And I wait "1" seconds
  88      And I should see "Second page contents"
  89      And I press "Next page"
  90      And I should see "Third page contents"
  91      And I follow "Test lesson name"
  92      And I should see "You have seen more than one page of this lesson already."
  93      And I should see "Do you want to start at the last page you saw?"
  94      And I follow "Yes"
  95      Then I should see "Third page contents"
  96      # Add 1 sec delay so lesson knows differentiate 3rd and paper attempts.
  97      And I wait "1" seconds
  98      And I press "Next page"
  99      And I should see "Paper is made from trees."
 100      And I follow "Test lesson name"
 101      And I should see "You have seen more than one page of this lesson already."
 102      And I should see "Do you want to start at the last page you saw?"
 103      And I follow "Yes"
 104      And I should see "Paper is made from trees."
 105      And I set the following fields to these values:
 106        | True | 1 |
 107      And I press "Submit"
 108      And I press "Continue"
 109      And I should see "Kermit is a frog"
 110      And I follow "Test lesson name"
 111      And I should see "You have seen more than one page of this lesson already."
 112      And I should see "Do you want to start at the last page you saw?"
 113      And I follow "Yes"
 114      And I should see "Kermit is a frog"
 115      And I set the following fields to these values:
 116        | True | 1 |
 117      And I press "Submit"
 118      And I press "Continue"
 119      And I should see "Congratulations - end of lesson reached"
 120  
 121    Scenario: resume a lesson with only content pages
 122      Given I follow "Add a content page"
 123      And I set the following fields to these values:
 124        | Page title | First page name |
 125        | Page contents | First page contents |
 126        | id_answer_editor_0 | Next page |
 127        | id_jumpto_0 | Next page |
 128      And I press "Save page"
 129      And I select "Add a content page" from the "qtype" singleselect
 130      And I set the following fields to these values:
 131        | Page title | Fourth page name |
 132        | Page contents | Fourth page contents |
 133        | id_answer_editor_0 | Previous page |
 134        | id_jumpto_0 | Previous page |
 135        | id_answer_editor_1 | End of lesson |
 136        | id_jumpto_1 | End of lesson |
 137      And I press "Save page"
 138      And I select "Add a content page" from the "qtype" singleselect
 139      And I set the following fields to these values:
 140        | Page title | Third page name |
 141        | Page contents | Third page contents |
 142        | id_answer_editor_0 | Previous page |
 143        | id_jumpto_0 | Previous page |
 144        | id_answer_editor_1 | Next page |
 145        | id_jumpto_1 | Next page |
 146      And I press "Save page"
 147      And I select "Add a content page" from the "qtype" singleselect
 148      And I set the following fields to these values:
 149        | Page title | Second page name |
 150        | Page contents | Second page contents |
 151        | id_answer_editor_0 | Previous page |
 152        | id_jumpto_0 | Previous page |
 153        | id_answer_editor_1 | Next page |
 154        | id_jumpto_1 | Next page |
 155      And I press "Save page"
 156      And I log out
 157      When I log in as "student1"
 158      And I follow "Course 1"
 159      And I follow "Test lesson name"
 160      And I should see "First page contents"
 161      And I press "Next page"
 162      And I should see "Second page contents"
 163      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 164      And I wait "1" seconds
 165      And I press "Next page"
 166      And I should see "Third page contents"
 167      And I follow "Test lesson name"
 168      Then I should see "You have seen more than one page of this lesson already."
 169      And I should see "Do you want to start at the last page you saw?"
 170      And I follow "Yes"
 171      And I should see "Third page contents"
 172      And I press "Next page"
 173      And I should see "Fourth page contents"
 174      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 175      And I wait "1" seconds
 176      And I press "End of lesson"
 177      And I log out
 178      And I log in as "student1"
 179      And I follow "Course 1"
 180      And I follow "Test lesson name"
 181      And I should see "First page contents"
 182      And I log out
 183  
 184    Scenario: resume a lesson with both question then content pages
 185      Given I follow "Add a question page"
 186      And I set the field "Select a question type" to "True/false"
 187      And I press "Add a question page"
 188      And I set the following fields to these values:
 189        | Page title | True/false question 1 |
 190        | Page contents | Cat is an amphibian |
 191        | id_answer_editor_0 | False |
 192        | id_response_editor_0 | Correct |
 193        | id_jumpto_0 | Next page |
 194        | id_answer_editor_1 | True |
 195        | id_response_editor_1 | Wrong |
 196        | id_jumpto_1 | This page |
 197      And I press "Save page"
 198      And I select "Question" from the "qtype" singleselect
 199      And I set the field "Select a question type" to "True/false"
 200      And I press "Add a question page"
 201      And I set the following fields to these values:
 202        | Page title | True/false question 5 |
 203        | Page contents | Kermit is a frog |
 204        | id_answer_editor_0 | True |
 205        | id_response_editor_0 | Correct |
 206        | id_jumpto_0 | Next page |
 207        | id_answer_editor_1 | False |
 208        | id_response_editor_1 | Wrong |
 209        | id_jumpto_1 | This page |
 210      And I press "Save page"
 211      And I select "Add a content page" from the "qtype" singleselect
 212      And I set the following fields to these values:
 213        | Page title | Content page 2 |
 214        | Page contents | Second content page |
 215        | id_answer_editor_0 | Next page |
 216        | id_jumpto_0 | Next page |
 217      And I press "Save page"
 218      And I select "Question" from the "qtype" singleselect
 219      And I set the field "Select a question type" to "True/false"
 220      And I press "Add a question page"
 221      And I set the following fields to these values:
 222        | Page title | True/false question 4 |
 223        | Page contents | 2+2=4 |
 224        | id_answer_editor_0 | True |
 225        | id_response_editor_0 | Correct |
 226        | id_jumpto_0 | Next page |
 227        | id_answer_editor_1 | False |
 228        | id_response_editor_1 | Wrong |
 229        | id_jumpto_1 | This page |
 230      And I press "Save page"
 231      And I select "Question" from the "qtype" singleselect
 232      And I set the field "Select a question type" to "True/false"
 233      And I press "Add a question page"
 234      And I set the following fields to these values:
 235        | Page title | True/false question 3 |
 236        | Page contents | 1+1=2 |
 237        | id_answer_editor_0 | True |
 238        | id_response_editor_0 | Correct |
 239        | id_jumpto_0 | Next page |
 240        | id_answer_editor_1 | False |
 241        | id_response_editor_1 | Wrong |
 242        | id_jumpto_1 | This page |
 243      And I press "Save page"
 244      And I select "Question" from the "qtype" singleselect
 245      And I set the field "Select a question type" to "True/false"
 246      And I press "Add a question page"
 247      And I set the following fields to these values:
 248        | Page title | True/false question 2 |
 249        | Page contents | Paper is made from trees. |
 250        | id_answer_editor_0 | True |
 251        | id_response_editor_0 | Correct |
 252        | id_jumpto_0 | Next page |
 253        | id_answer_editor_1 | False |
 254        | id_response_editor_1 | Wrong |
 255        | id_jumpto_1 | This page |
 256      And I press "Save page"
 257      And I select "Add a content page" from the "qtype" singleselect
 258      And I set the following fields to these values:
 259        | Page title | Content page 1 |
 260        | Page contents | First content page |
 261        | id_answer_editor_0 | Next page |
 262        | id_jumpto_0 | Next page |
 263      And I press "Save page"
 264      And I log out
 265      When I log in as "student1"
 266      And I follow "Course 1"
 267      And I follow "Test lesson name"
 268      And I should see "Cat is an amphibian"
 269      And I set the following fields to these values:
 270        | False | 1 |
 271      And I press "Submit"
 272      And I press "Continue"
 273      And I should see "First content page"
 274      And I press "Next page"
 275      And I should see "Paper is made from trees."
 276      And I set the following fields to these values:
 277        | True | 1 |
 278      And I press "Submit"
 279      And I press "Continue"
 280      And I should see "1+1=2"
 281      And I set the following fields to these values:
 282        | True | 1 |
 283      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 284      And I wait "1" seconds
 285      And I press "Submit"
 286      And I press "Continue"
 287      And I should see "2+2=4"
 288      And I follow "Test lesson name"
 289      And I should see "You have seen more than one page of this lesson already."
 290      Then I should see "Do you want to start at the last page you saw?"
 291      And I follow "Yes"
 292      And I should see "2+2=4"
 293      And I set the following fields to these values:
 294        | True | 1 |
 295      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 296      And I wait "1" seconds
 297      And I press "Submit"
 298      And I press "Continue"
 299      And I should see "Second content page"
 300      And I follow "Test lesson name"
 301      And I should see "You have seen more than one page of this lesson already."
 302      And I should see "Do you want to start at the last page you saw?"
 303      And I follow "Yes"
 304      And I should see "Second content page"
 305      And I press "Next page"
 306      And I should see "Kermit is a frog"
 307      And I set the following fields to these values:
 308        | True | 1 |
 309      And I press "Submit"
 310      And I press "Continue"
 311      And I should see "Congratulations - end of lesson reached"
 312  
 313    Scenario: resume a lesson with only question pages
 314      Given I follow "Add a question page"
 315      And I set the field "Select a question type" to "True/false"
 316      And I press "Add a question page"
 317      And I set the following fields to these values:
 318        | Page title | True/false question 1 |
 319        | Page contents | Cat is an amphibian |
 320        | id_answer_editor_0 | False |
 321        | id_response_editor_0 | Correct |
 322        | id_jumpto_0 | Next page |
 323        | id_answer_editor_1 | True |
 324        | id_response_editor_1 | Wrong |
 325        | id_jumpto_1 | This page |
 326      And I press "Save page"
 327      And I select "Question" from the "qtype" singleselect
 328      And I set the field "Select a question type" to "True/false"
 329      And I press "Add a question page"
 330      And I set the following fields to these values:
 331        | Page title | True/false question 5 |
 332        | Page contents | Kermit is a frog |
 333        | id_answer_editor_0 | True |
 334        | id_response_editor_0 | Correct |
 335        | id_jumpto_0 | Next page |
 336        | id_answer_editor_1 | False |
 337        | id_response_editor_1 | Wrong |
 338        | id_jumpto_1 | This page |
 339      And I press "Save page"
 340      And I select "Question" from the "qtype" singleselect
 341      And I set the field "Select a question type" to "True/false"
 342      And I press "Add a question page"
 343      And I set the following fields to these values:
 344        | Page title | True/false question 4 |
 345        | Page contents | 2+2=4 |
 346        | id_answer_editor_0 | True |
 347        | id_response_editor_0 | Correct |
 348        | id_jumpto_0 | Next page |
 349        | id_answer_editor_1 | False |
 350        | id_response_editor_1 | Wrong |
 351        | id_jumpto_1 | This page |
 352      And I press "Save page"
 353      And I select "Question" from the "qtype" singleselect
 354      And I set the field "Select a question type" to "True/false"
 355      And I press "Add a question page"
 356      And I set the following fields to these values:
 357        | Page title | True/false question 3 |
 358        | Page contents | 1+1=2 |
 359        | id_answer_editor_0 | True |
 360        | id_response_editor_0 | Correct |
 361        | id_jumpto_0 | Next page |
 362        | id_answer_editor_1 | False |
 363        | id_response_editor_1 | Wrong |
 364        | id_jumpto_1 | This page |
 365      And I press "Save page"
 366      And I select "Question" from the "qtype" singleselect
 367      And I set the field "Select a question type" to "True/false"
 368      And I press "Add a question page"
 369      And I set the following fields to these values:
 370        | Page title | True/false question 2 |
 371        | Page contents | Paper is made from trees. |
 372        | id_answer_editor_0 | True |
 373        | id_response_editor_0 | Correct |
 374        | id_jumpto_0 | Next page |
 375        | id_answer_editor_1 | False |
 376        | id_response_editor_1 | Wrong |
 377        | id_jumpto_1 | This page |
 378      And I press "Save page"
 379      And I log out
 380      When I log in as "student1"
 381      And I follow "Course 1"
 382      And I follow "Test lesson name"
 383      And I should see "Cat is an amphibian"
 384      And I set the following fields to these values:
 385        | False | 1 |
 386      And I press "Submit"
 387      And I press "Continue"
 388      And I should see "Paper is made from trees."
 389      And I set the following fields to these values:
 390        | True | 1 |
 391      And I press "Submit"
 392      And I press "Continue"
 393      And I should see "1+1=2"
 394      And I set the following fields to these values:
 395        | True | 1 |
 396      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 397      And I wait "1" seconds
 398      And I press "Submit"
 399      And I press "Continue"
 400      And I should see "2+2=4"
 401      And I follow "Test lesson name"
 402      Then I should see "You have seen more than one page of this lesson already."
 403      And I should see "Do you want to start at the last page you saw?"
 404      And I follow "Yes"
 405      And I should see "2+2=4"
 406      And I set the following fields to these values:
 407        | True | 1 |
 408      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
 409      And I wait "1" seconds
 410      And I press "Submit"
 411      And I press "Continue"
 412      And I should see "Kermit is a frog"
 413      And I set the following fields to these values:
 414        | True | 1 |
 415      And I press "Submit"
 416      And I press "Continue"
 417      And I should see "Congratulations - end of lesson reached"


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