MDL-81601 core_course: Add course index completion status behats
[moodle.git] / completion / tests / behat / enable_completion_on_pass_grade.feature
blobcb8b1b182aedd97df09dd93bed98952365ca8bf4
1 @core @core_completion @javascript
2 Feature: Students will be marked as completed if they have achieved a passing grade.
4   Background:
5     Given the following "courses" exist:
6       | fullname | shortname | category | enablecompletion |
7       | Course 1 | C1        | 0        | 1                |
8     And the following "users" exist:
9       | username | firstname | lastname | email                |
10       | teacher1 | Teacher   | First    | teacher1@example.com |
11       | student1 | Student   | First    | student1@example.com |
12       | student2 | Student   | Second   | student2@example.com |
13     And the following "course enrolments" exist:
14       | user     | course | role           |
15       | teacher1 | C1     | editingteacher |
16       | student1 | C1     | student        |
17       | student2 | C1     | student        |
18     And the following "activity" exists:
19       | idnumber                            | a1                      |
20       | activity                            | assign                  |
21       | course                              | C1                      |
22       | name                                | Test assignment name    |
23       | intro                               | Submit your online text |
24       | assignsubmission_onlinetext_enabled | 1                       |
25       | assignsubmission_file_enabled       | 0                       |
26       | completion                          | 2                       |
27       | completionpassgrade                 | 1                       |
28       | completionusegrade                  | 1                       |
29       | gradepass                           | 50                      |
30     And I am on the "Course 1" course page logged in as teacher1
31     And "Student First" user has not completed "Test assignment name" activity
33   Scenario: Passing grade completion
34     Given I am on the "Course 1" "grades > Grader report > View" page
35     And I turn editing mode on
36     And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
37     And I give the grade "50" to the user "Student Second" for the grade item "Test assignment name"
38     And I press "Save changes"
39     When I am on the "Course 1" course page logged in as student1
40     Then the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
41     And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "failed"
42     And I am on the "Course 1" course page logged in as student2
43     And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done"
44     And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "done"