1 |
efrain |
1 |
@mod @mod_subcourse
|
|
|
2 |
Feature: Completing the referenced course can lead to completing the subcourse activity
|
|
|
3 |
In order to complete to Subcourse activity
|
|
|
4 |
As a student
|
|
|
5 |
I need to complete the referenced course, given such a rule is enabled
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category | enablecompletion |
|
|
|
14 |
| MainCourse | M | 0 | 1 |
|
|
|
15 |
| RefCourse | R | 0 | 1 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | M | editingteacher |
|
|
|
19 |
| student1 | M | student |
|
|
|
20 |
| teacher1 | R | editingteacher |
|
|
|
21 |
| student1 | R | student |
|
|
|
22 |
And I enable "selfcompletion" "block" plugin
|
|
|
23 |
# Create the subcourse instance.
|
|
|
24 |
When I am on the "MainCourse" course page logged in as "teacher1"
|
|
|
25 |
And I turn editing mode on
|
|
|
26 |
And I add a "Subcourse" to section "1" and I fill the form with:
|
|
|
27 |
| Subcourse name | Unit course 1 |
|
|
|
28 |
| Fetch grades from | RefCourse (R) |
|
|
|
29 |
| Redirect to the referenced course | 0 |
|
|
|
30 |
| Completion tracking | Show activity as complete when conditions are met |
|
|
|
31 |
| Require view | 0 |
|
|
|
32 |
| Require course completed | 1 |
|
|
|
33 |
| id_completionexpected_enabled | 1 |
|
|
|
34 |
# Add the block to a the referenced course to allow students to manually complete it
|
|
|
35 |
And I am on "RefCourse" course homepage with editing mode on
|
|
|
36 |
And I add the "Self completion" block
|
|
|
37 |
And I navigate to "Course completion" in current page administration
|
|
|
38 |
And I expand all fieldsets
|
|
|
39 |
And I set the following fields to these values:
|
|
|
40 |
| id_criteria_self | 1 |
|
|
|
41 |
And I press "Save changes"
|
|
|
42 |
And I log out
|
|
|
43 |
|
|
|
44 |
@javascript
|
|
|
45 |
Scenario: Student is informed about a subcourse to be completed
|
|
|
46 |
When I log in as "student1"
|
|
|
47 |
Then I should see "Unit course 1 should be completed"
|
|
|
48 |
|
|
|
49 |
@javascript
|
|
|
50 |
Scenario: Completing the referenced course leads to completing the subcourse
|
|
|
51 |
Given I am on the "RefCourse" course page logged in as "student1"
|
|
|
52 |
And I follow "Complete course"
|
|
|
53 |
And I should see "Confirm self completion"
|
|
|
54 |
And I press "Yes"
|
|
|
55 |
# Running completion task just after clicking sometimes fail, as record should be created before the task runs.
|
|
|
56 |
And I wait "1" seconds
|
|
|
57 |
When I run the scheduled task "core\task\completion_regular_task"
|
|
|
58 |
And I am on "MainCourse" course homepage
|
|
|
59 |
Then the "Complete the activity" completion condition of "Unit course 1" is displayed as "done"
|
|
|
60 |
And I log out
|
|
|
61 |
And I log in as "teacher1"
|
|
|
62 |
And I am on "MainCourse" course homepage
|
|
|
63 |
And I navigate to "Reports > Activity completion" in current page administration
|
|
|
64 |
And "//img[contains(@title, 'Unit course 1') and contains(@title, 'Completed')]" "xpath_element" should exist in the "Student 1" "table_row"
|