[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_lesson
   2  Feature: Set time spent as a completion condition for a lesson
   3    In order to ensure students spend the needed time to study lessons
   4    As a teacher
   5    I need to set time spent to mark the lesson activity as completed
   6  
   7    Scenario: Set time spent as a condition
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email |
  10        | student1 | Student | 1 | student1@example.com |
  11        | teacher1 | Teacher | 1 | teacher1@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        | teacher1 | C1 | editingteacher |
  18        | student1 | C1 | student |
  19      And I log in as "teacher1"
  20      And I follow "Course 1"
  21      And I turn editing mode on
  22      And I click on "Edit settings" "link" in the "Administration" "block"
  23      And I set the following fields to these values:
  24        | Enable completion tracking | Yes |
  25      And I press "Save and display"
  26      And I add a "Lesson" to section "1" and I fill the form with:
  27        | Name | Test lesson |
  28        | Description | Test lesson description |
  29        | Completion tracking | Show activity as complete when conditions are met |
  30        | completiontimespentenabled | 1 |
  31        | completiontimespent[timeunit] | 1 |
  32        | completiontimespent[number] | 10 |
  33      And I follow "Test lesson"
  34      And I follow "Add a content page"
  35      And I set the following fields to these values:
  36        | Page title | First page name |
  37        | Page contents | First page contents |
  38        | id_answer_editor_0 | Next page |
  39        | id_jumpto_0 | Next page |
  40      And I press "Save page"
  41      And I select "Add a content page" from the "qtype" singleselect
  42      And I set the following fields to these values:
  43        | Page title | Second page name |
  44        | Page contents | Second page contents |
  45        | id_answer_editor_0 | Previous page |
  46        | id_jumpto_0 | Previous page |
  47        | id_answer_editor_1 | Next page |
  48        | id_jumpto_1 | Next page |
  49      And I press "Save page"
  50      And I log out
  51      When I log in as "student1"
  52      And I follow "Course 1"
  53      Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
  54      And I follow "Test lesson"
  55      And I press "Next page"
  56      # Add 1 sec delay so lesson knows a valid attempt has been made in past.
  57      And I wait "1" seconds
  58      And I press "Next page"
  59      And I should see "You completed this lesson in"
  60      And I should see ", which is less than the required time of 10 secs. You might need to attempt the lesson again."
  61      And I follow "Course 1"
  62      And the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
  63      And I follow "Course 1"
  64      And I follow "Test lesson"
  65      And I press "Next page"
  66      And I wait "11" seconds
  67      And I press "Next page"
  68      And I should not see "You might need to attempt the lesson again."
  69      And I follow "Course 1"
  70      And the "Test lesson" "lesson" activity with "auto" completion should be marked as complete
  71      And I log out
  72      And I log in as "teacher1"
  73      And I follow "Course 1"
  74      And "Student 1" user has completed "Test lesson" activity


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