1aaed0a398997a9b6917485930727fccdadbc5bf
[moodle.git] / blocks / completionstatus / tests / behat / block_completionstatus_manual_other.feature
1 @block @block_completionstatus
2 Feature: Enable Block Completion in a course using manual completion by others
3   In order to view the completion block in a course
4   As a teacher
5   I can add completion block to a course and set up manual completion by others
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email | idnumber |
10       | teacher1 | Teacher | 1 | teacher1@example.com | T1 |
11       | teacher2 | Teacher | 2 | teacher1@example.com | T2 |
12       | student1 | Student | 1 | student1@example.com | S1 |
13     And the following "courses" exist:
14       | fullname | shortname | category | enablecompletion |
15       | Course 1 | C1        | 0        | 1                |
16     And the following "course enrolments" exist:
17       | user     | course | role           |
18       | teacher1 | C1     | editingteacher |
19       | teacher2 | C1     | teacher        |
20       | student1 | C1     | student        |
22   Scenario: Add the block to a the course and mark a student complete.
23     Given I log in as "teacher1"
24     And I follow "Course 1"
25     And I turn editing mode on
26     And I add the "Course completion status" block
27     And I navigate to "Course completion" node in "Course administration"
28     And I expand all fieldsets
29     And I set the following fields to these values:
30       | Teacher | 1 |
31     And I press "Save changes"
32     And I log out
33     When I log in as "student1"
34     And I follow "Course 1"
35     And I should see "Status: Not yet started" in the "Course completion status" "block"
36     And I should see "No" in the "Teacher" "table_row"
37     And I log out
38     And I log in as "teacher1"
39     And I follow "Course 1"
40     And I navigate to "Course completion" node in "Reports"
41     And I follow "Click to mark user complete"
42     And I trigger cron
43     And I am on site homepage
44     And I log out
45     And I log in as "student1"
46     And I follow "Course 1"
47     Then I should see "Status: Complete" in the "Course completion status" "block"
48     And I should see "Yes" in the "Teacher" "table_row"
49     And I follow "More details"
50     And I should see "Yes" in the "Marked complete by Teacher" "table_row"
53   Scenario: Add the block to a the course and require multiple roles to mark a student complete.
54     Given I log in as "teacher1"
55     And I follow "Course 1"
56     And I turn editing mode on
57     And I add the "Course completion status" block
58     And I navigate to "Course completion" node in "Course administration"
59     And I expand all fieldsets
60     And I set the following fields to these values:
61       | Teacher             | 1 |
62       | Non-editing teacher | 1 |
63       | id_role_aggregation | ALL selected roles to mark when the condition is met |
64     And I press "Save changes"
65     And I log out
66     When I log in as "student1"
67     And I follow "Course 1"
68     And I should see "Status: Not yet started" in the "Course completion status" "block"
69     And I should see "No" in the "Teacher" "table_row"
70     And I should see "No" in the "Non-editing teacher" "table_row"
71     And I log out
72     And I log in as "teacher1"
73     And I follow "Course 1"
74     And I navigate to "Course completion" node in "Reports"
75     And I follow "Click to mark user complete"
76     And I log out
77     And I log in as "student1"
78     And I follow "Course 1"
79     And I should see "Status: In progress" in the "Course completion status" "block"
80     And I should see "Yes" in the "Teacher" "table_row"
81     And I should see "No" in the "Non-editing teacher" "table_row"
82     And I follow "More details"
83     And I should see "Yes" in the "Marked complete by Teacher" "table_row"
84     And I should see "No" in the "Marked complete by Non-editing teacher" "table_row"
85     And I log out
86     And I log in as "teacher2"
87     And I follow "Course 1"
88     And I navigate to "Course completion" node in "Reports"
89     And I follow "Click to mark user complete"
90     And I trigger cron
91     And I am on site homepage
92     And I log out
93     And I log in as "student1"
94     And I follow "Course 1"
95     Then I should see "Status: Complete" in the "Course completion status" "block"
96     And I should see "Yes" in the "Teacher" "table_row"
97     And I should see "Yes" in the "Non-editing teacher" "table_row"
98     And I follow "More details"
99     And I should see "Yes" in the "Marked complete by Teacher" "table_row"
100     And I should see "Yes" in the "Marked complete by Non-editing teacher" "table_row"