MDL-54640 behat: add 1 sec delay before running tasks
[moodle.git] / blocks / completionstatus / tests / behat / block_completionstatus_manual_self.feature
CommitLineData
d83d1e34
SB
1@block @block_completionstatus @block_selfcompletion
2Feature: Enable Block Completion in a course using manual self completion
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 self completion
6
7 Scenario: Add the block to a the course and manually complete the course
8 Given the following "users" exist:
9 | username | firstname | lastname | email | idnumber |
10 | teacher1 | Teacher | 1 | teacher1@example.com | T1 |
11 | student1 | Student | 1 | student1@example.com | S1 |
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 I log in as "teacher1"
20 And I follow "Course 1"
21 And I turn editing mode on
22 And I add the "Course completion status" block
23 And I add the "Self completion" block
24 And I navigate to "Course completion" node in "Course administration"
25 And I expand all fieldsets
26 And I set the following fields to these values:
27 | id_criteria_self | 1 |
28 And I press "Save changes"
29 And I log out
30 When I log in as "student1"
31 And I follow "Course 1"
32 And I should see "Status: Not yet started" in the "Course completion status" "block"
33 And I should see "No" in the "Self completion" "table_row"
34 And I follow "Complete course"
35 And I should see "Confirm self completion"
36 And I press "Yes"
37 And I should see "Status: In progress" in the "Course completion status" "block"
442a3651
RT
38 # Running completion task just after clicking sometimes fail, as record
39 # should be created before the task runs.
40 And I wait "1" seconds
41 And I run the scheduled task "core\task\completion_regular_task"
d83d1e34
SB
42 And I am on site homepage
43 And I follow "Course 1"
44 Then I should see "Status: Complete" in the "Course completion status" "block"
45 And I should see "Yes" in the "Self completion" "table_row"
46 And I follow "More details"
47 And I should see "Yes" in the "Self completion" "table_row"