1 |
efrain |
1 |
@mod @mod_lesson @javascript
|
|
|
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 | enablecompletion |
|
|
|
14 |
| Course 1 | C1 | 0 | 1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activity" exist:
|
|
|
20 |
| activity | name | course | idnumber | completion | completionview | completiontimespentenabled | completiontimespent |
|
|
|
21 |
| lesson | Test lesson | C1 | 0001 | 2 | 0 | 1 | 5 |
|
|
|
22 |
And the following "mod_lesson > pages" exist:
|
|
|
23 |
| lesson | qtype | title | content |
|
|
|
24 |
| Test lesson | content | First page name | First page contents |
|
|
|
25 |
| Test lesson | content | Second page name | Second page contents |
|
|
|
26 |
And the following "mod_lesson > answers" exist:
|
|
|
27 |
| page | answer | jumpto |
|
|
|
28 |
| First page name | Next page | Next page |
|
|
|
29 |
| Second page name | Previous page | Previous page |
|
|
|
30 |
| Second page name | Next page | Next page |
|
|
|
31 |
|
|
|
32 |
When I am on the "Course 1" course page logged in as student1
|
|
|
33 |
Then the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
|
|
|
34 |
And I follow "Test lesson"
|
|
|
35 |
And I press "Next page"
|
|
|
36 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
37 |
And I wait "1" seconds
|
|
|
38 |
And I press "Next page"
|
|
|
39 |
And I should see "You completed this lesson in"
|
|
|
40 |
And I should see ", which is less than the required time of 5 secs. You might need to attempt the lesson again."
|
|
|
41 |
And I am on "Course 1" course homepage
|
|
|
42 |
And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
|
|
|
43 |
And I am on the "Test lesson" "lesson activity" page
|
|
|
44 |
And I press "Next page"
|
|
|
45 |
And I wait "5" seconds
|
|
|
46 |
And I press "Next page"
|
|
|
47 |
And I should not see "You might need to attempt the lesson again."
|
|
|
48 |
And I am on "Course 1" course homepage
|
|
|
49 |
And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "done"
|
|
|
50 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
51 |
And "Student 1" user has completed "Test lesson" activity
|