[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_lesson
   2  Feature: Lesson user override
   3    In order to grant a student special access to a lesson
   4    As a teacher
   5    I need to create an override for that user.
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | teacher1 | Tina | Teacher1 | teacher1@example.com |
  11        | student1 | Sam1 | Student1 | student1@example.com |
  12        | student2 | Sam2 | Student2 | student2@example.com |
  13      And the following "courses" exist:
  14        | fullname | shortname | category |
  15        | Course 1 | C1 | 0 |
  16      And the following "course enrolments" exist:
  17        | user | course | role |
  18        | teacher1 | C1 | editingteacher |
  19        | student1 | C1 | student |
  20        | student2 | C1 | student |
  21      And the following "groups" exist:
  22        | name    | course | idnumber |
  23        | Group 1 | C1     | G1       |
  24        | Group 2 | C1     | G2       |
  25      And the following "activities" exist:
  26        | activity | name             | intro                   | course | idnumber |
  27        | lesson   | Test lesson name | Test lesson description | C1     | lesson1  |
  28      And I log in as "teacher1"
  29      And I follow "Course 1"
  30      And I turn editing mode on
  31      And I follow "Test lesson name"
  32      And I follow "Add a question page"
  33      And I set the field "Select a question type" to "True/false"
  34      And I press "Add a question page"
  35      And I set the following fields to these values:
  36        | Page title           | True/false question 1 |
  37        | Page contents        | Cat is an amphibian |
  38        | id_answer_editor_0   | False |
  39        | id_response_editor_0 | Correct |
  40        | id_jumpto_0          | Next page |
  41        | id_answer_editor_1   | True |
  42        | id_response_editor_1 | Wrong |
  43        | id_jumpto_1          | This page |
  44      And I press "Save page"
  45  
  46    Scenario: Add, modify then delete a user override
  47      When I follow "Test lesson name"
  48      And I navigate to "User overrides" node in "Lesson administration"
  49      And I press "Add user override"
  50      And I set the following fields to these values:
  51        | Override user       | Student1 |
  52        | id_deadline_enabled | 1 |
  53        | deadline[day]       | 1 |
  54        | deadline[month]     | January |
  55        | deadline[year]      | 2020 |
  56        | deadline[hour]      | 08 |
  57        | deadline[minute]    | 00 |
  58      And I press "Save"
  59      And I should see "Wednesday, 1 January 2020, 8:00"
  60      Then I click on "Edit" "link"
  61      And I set the following fields to these values:
  62        | deadline[year] | 2030 |
  63      And I press "Save"
  64      And I should see "Tuesday, 1 January 2030, 8:00"
  65      And I click on "Delete" "link"
  66      And I press "Continue"
  67      And I should not see "Sam1 Student1"
  68  
  69    Scenario: Duplicate a user override
  70      When I follow "Test lesson name"
  71      And I navigate to "User overrides" node in "Lesson administration"
  72      And I press "Add user override"
  73      And I set the following fields to these values:
  74        | Override user       | Student1 |
  75        | id_deadline_enabled | 1 |
  76        | deadline[day]       | 1 |
  77        | deadline[month]     | January |
  78        | deadline[year]      | 2020 |
  79        | deadline[hour]      | 08 |
  80        | deadline[minute]    | 00 |
  81      And I press "Save"
  82      And I should see "Wednesday, 1 January 2020, 8:00"
  83      Then I click on "copy" "link"
  84      And I set the following fields to these values:
  85        | Override user  | Student2  |
  86        | deadline[year] | 2030 |
  87      And I press "Save"
  88      And I should see "Tuesday, 1 January 2030, 8:00"
  89      And I should see "Sam2 Student2"
  90  
  91    Scenario: Allow a single user to have re-take the lesson
  92      When I follow "Test lesson name"
  93      And I navigate to "Edit settings" node in "Lesson administration"
  94      And I set the following fields to these values:
  95        | Re-takes allowed | 0 |
  96      And I press "Save and display"
  97      And I navigate to "User overrides" node in "Lesson administration"
  98      And I press "Add user override"
  99      And I set the following fields to these values:
 100        | Override user    | Student1  |
 101        | Re-takes allowed | 1 |
 102      And I press "Save"
 103      And I should see "Re-takes allowed"
 104      And I log out
 105      And I log in as "student1"
 106      And I follow "Course 1"
 107      And I follow "Test lesson name"
 108      And I should see "Cat is an amphibian"
 109      And I set the following fields to these values:
 110        | False | 1 |
 111      And I press "Submit"
 112      And I press "Continue"
 113      And I should see "Congratulations - end of lesson reached"
 114      And I follow "Test lesson name"
 115      Then I should not see "You are not allowed to retake this lesson."
 116      And I should see "Cat is an amphibian"
 117      And I log out
 118      And I log in as "student2"
 119      And I follow "Course 1"
 120      And I follow "Test lesson name"
 121      And I should see "Cat is an amphibian"
 122      And I set the following fields to these values:
 123        | False | 1 |
 124      And I press "Submit"
 125      And I press "Continue"
 126      And I should see "Congratulations - end of lesson reached"
 127      And I follow "Test lesson name"
 128      And I should see "You are not allowed to retake this lesson."
 129  
 130    Scenario: Allow a single user to have a different password
 131      When I follow "Test lesson name"
 132      And I navigate to "Edit settings" node in "Lesson administration"
 133      And I set the following fields to these values:
 134        | Password protected lesson | Yes |
 135        | id_password               | moodle_rules |
 136      And I press "Save and display"
 137      And I navigate to "User overrides" node in "Lesson administration"
 138      And I press "Add user override"
 139      And I set the following fields to these values:
 140        | Override user             | Student1  |
 141        | Password protected lesson | 12345 |
 142      And I press "Save"
 143      And I should see "Password protected lesson"
 144      And I log out
 145      And I log in as "student1"
 146      And I follow "Course 1"
 147      And I follow "Test lesson name"
 148      Then I should see "Test lesson name is a password protected lesson"
 149      And I should not see "Cat is an amphibian"
 150      And I set the field "userpassword" to "moodle_rules"
 151      And I press "Continue"
 152      And I should see "Login failed, please try again..."
 153      And I should see "Test lesson name is a password protected lesson"
 154      And I set the field "userpassword" to "12345"
 155      And I press "Continue"
 156      And I should see "Cat is an amphibian"
 157      And I set the following fields to these values:
 158        | False | 1 |
 159      And I press "Submit"
 160      And I press "Continue"
 161      And I should see "Congratulations - end of lesson reached"
 162      And I log out
 163      And I log in as "student2"
 164      And I follow "Course 1"
 165      And I follow "Test lesson name"
 166      And I should see "Test lesson name is a password protected lesson"
 167      And I should not see "Cat is an amphibian"
 168      And I set the field "userpassword" to "12345"
 169      And I press "Continue"
 170      And I should see "Login failed, please try again..."
 171      And I should see "Test lesson name is a password protected lesson"
 172      And I set the field "userpassword" to "moodle_rules"
 173      And I press "Continue"
 174  
 175    Scenario: Allow a user to have a different due date
 176      When I follow "Test lesson name"
 177      And I navigate to "Edit settings" node in "Lesson administration"
 178      And I set the following fields to these values:
 179        | id_deadline_enabled | 1 |
 180        | deadline[day]       | 1 |
 181        | deadline[month]     | January |
 182        | deadline[year]      | 2000 |
 183        | deadline[hour]      | 08 |
 184        | deadline[minute]    | 00 |
 185      And I press "Save and display"
 186      And I navigate to "User overrides" node in "Lesson administration"
 187      And I press "Add user override"
 188      And I set the following fields to these values:
 189        | Override user       | Student1 |
 190        | id_deadline_enabled | 1 |
 191        | deadline[day]       | 1 |
 192        | deadline[month]     | January |
 193        | deadline[year]      | 2020 |
 194        | deadline[hour]      | 08 |
 195        | deadline[minute]    | 00 |
 196      And I press "Save"
 197      And I should see "Lesson closes"
 198      And I log out
 199      And I log in as "student2"
 200      And I follow "Course 1"
 201      And I follow "Test lesson"
 202      Then I should see "This lesson closed on Saturday, 1 January 2000, 8:00"
 203      And I should not see "Cat is an amphibian"
 204      And I log out
 205      And I log in as "student1"
 206      And I follow "Course 1"
 207      And I follow "Test lesson"
 208      And I should see "Cat is an amphibian"
 209  
 210    Scenario: Allow a user to have a different start date
 211      When I follow "Test lesson name"
 212      And I navigate to "Edit settings" node in "Lesson administration"
 213      And I set the following fields to these values:
 214        | id_available_enabled | 1 |
 215        | available[day]       | 1 |
 216        | available[month]     | January |
 217        | available[year]      | 2020 |
 218        | available[hour]      | 08 |
 219        | available[minute]    | 00 |
 220      And I press "Save and display"
 221      And I navigate to "User overrides" node in "Lesson administration"
 222      And I press "Add user override"
 223      And I set the following fields to these values:
 224        | Override user        | Student1 |
 225        | id_available_enabled | 1 |
 226        | available[day]       | 1 |
 227        | available[month]     | January |
 228        | available[year]      | 2015 |
 229        | available[hour]      | 08 |
 230        | available[minute]    | 00 |
 231      And I press "Save"
 232      And I should see "Lesson opens"
 233      And I log out
 234      And I log in as "student2"
 235      And I follow "Course 1"
 236      And I follow "Test lesson"
 237      Then  I should see "This lesson will be open on Wednesday, 1 January 2020, 8:00"
 238      And I should not see "Cat is an amphibian"
 239      And I log out
 240      And I log in as "student1"
 241      And I follow "Course 1"
 242      And I follow "Test lesson"
 243      And I should see "Cat is an amphibian"
 244  
 245    Scenario: Allow a single user to have multiple attempts at each question
 246      When I follow "Test lesson name"
 247      And I navigate to "Edit settings" node in "Lesson administration"
 248      And I set the following fields to these values:
 249        | Re-takes allowed | 1 |
 250      And I press "Save and display"
 251      And I navigate to "User overrides" node in "Lesson administration"
 252      And I press "Add user override"
 253      And I set the following fields to these values:
 254        | Override user              | Student1  |
 255        | Maximum number of attempts | 2 |
 256      And I press "Save"
 257      And I should see "Maximum number of attempts"
 258      And I log out
 259      And I log in as "student1"
 260      And I follow "Course 1"
 261      And I follow "Test lesson name"
 262      And I should see "Cat is an amphibian"
 263      And I set the following fields to these values:
 264        | True | 1 |
 265      And I press "Submit"
 266      And I press "Continue"
 267      And I should see "Cat is an amphibian"
 268      And I set the following fields to these values:
 269        | True | 1 |
 270      And I press "Submit"
 271      And I press "Continue"
 272      And I should see "Congratulations - end of lesson reached"
 273      And I log out
 274      And I log in as "student2"
 275      And I follow "Course 1"
 276      And I follow "Test lesson name"
 277      And I should see "Cat is an amphibian"
 278      And I set the following fields to these values:
 279        | True | 1 |
 280      And I press "Submit"
 281      Then I press "Continue"
 282      And I should see "Congratulations - end of lesson reached"


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