MDL-54640 behat: add 1 sec delay before running tasks
[moodle.git] / blocks / completionstatus / tests / behat / block_completionstatus_manual_other.feature
CommitLineData
d83d1e34
SB
1@block @block_completionstatus
2Feature: 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
6
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 |
21
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"
442a3651
RT
42 # Running completion task just after clicking sometimes fail, as record
43 # should be created before the task runs.
44 And I wait "1" seconds
45 And I run the scheduled task "core\task\completion_regular_task"
d83d1e34
SB
46 And I am on site homepage
47 And I log out
48 And I log in as "student1"
49 And I follow "Course 1"
50 Then I should see "Status: Complete" in the "Course completion status" "block"
51 And I should see "Yes" in the "Teacher" "table_row"
52 And I follow "More details"
53 And I should see "Yes" in the "Marked complete by Teacher" "table_row"
54
55
56 Scenario: Add the block to a the course and require multiple roles to mark a student complete.
57 Given I log in as "teacher1"
58 And I follow "Course 1"
59 And I turn editing mode on
60 And I add the "Course completion status" block
61 And I navigate to "Course completion" node in "Course administration"
62 And I expand all fieldsets
63 And I set the following fields to these values:
64 | Teacher | 1 |
65 | Non-editing teacher | 1 |
66 | id_role_aggregation | ALL selected roles to mark when the condition is met |
67 And I press "Save changes"
68 And I log out
69 When I log in as "student1"
70 And I follow "Course 1"
71 And I should see "Status: Not yet started" in the "Course completion status" "block"
72 And I should see "No" in the "Teacher" "table_row"
73 And I should see "No" in the "Non-editing teacher" "table_row"
74 And I log out
75 And I log in as "teacher1"
76 And I follow "Course 1"
77 And I navigate to "Course completion" node in "Reports"
78 And I follow "Click to mark user complete"
79 And I log out
80 And I log in as "student1"
81 And I follow "Course 1"
82 And I should see "Status: In progress" in the "Course completion status" "block"
83 And I should see "Yes" in the "Teacher" "table_row"
84 And I should see "No" in the "Non-editing teacher" "table_row"
85 And I follow "More details"
86 And I should see "Yes" in the "Marked complete by Teacher" "table_row"
87 And I should see "No" in the "Marked complete by Non-editing teacher" "table_row"
88 And I log out
89 And I log in as "teacher2"
90 And I follow "Course 1"
91 And I navigate to "Course completion" node in "Reports"
92 And I follow "Click to mark user complete"
442a3651
RT
93 # Running completion task just after clicking sometimes fail, as record
94 # should be created before the task runs.
95 And I wait "1" seconds
96 And I run the scheduled task "core\task\completion_regular_task"
d83d1e34
SB
97 And I am on site homepage
98 And I log out
99 And I log in as "student1"
100 And I follow "Course 1"
101 Then I should see "Status: Complete" in the "Course completion status" "block"
102 And I should see "Yes" in the "Teacher" "table_row"
103 And I should see "Yes" in the "Non-editing teacher" "table_row"
104 And I follow "More details"
105 And I should see "Yes" in the "Marked complete by Teacher" "table_row"
106 And I should see "Yes" in the "Marked complete by Non-editing teacher" "table_row"