Merge branch 'MDL-53140-master' of git://github.com/rezaies/moodle
[moodle.git] / completion / tests / behat / default_activity_completion.feature
CommitLineData
8db355c5 1@core @core_completion
273d3106
JD
2Feature: Allow teachers to edit the default activity completion rules in a course.
3 In order to set the activity completion defaults for new activities
8db355c5
JD
4 As a teacher
5 I need to be able to edit the completion rules for a group of activities.
6
7 # Given I am a teacher in a course with completion tracking enabled and activities present.
8 # When I edit activity completion defaults for activity types.
9 # Then the completion rule defaults should apply only to activities created from that point onwards.
10 @javascript
273d3106 11 Scenario: Bulk edit activity completion default rules
8db355c5
JD
12 Given the following "courses" exist:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "users" exist:
16 | username | firstname | lastname | email |
17 | teacher1 | Teacher | Frist | teacher1@example.com |
18 | student1 | Student | First | student1@example.com |
19 And the following "course enrolments" exist:
20 | user | course | role |
21 | teacher1 | C1 | editingteacher |
22 | student1 | C1 | student |
23 And the following "activities" exist:
24 | activity | course | idnumber | name | intro | grade |
25 | assign | C1 | a1 | Test assignment one | Submit something! | 300 |
26 And I log in as "teacher1"
197e2bca 27 And I am on "Course 1" course homepage with editing mode on
8db355c5
JD
28 And I navigate to "Edit settings" in current page administration
29 And I set the following fields to these values:
30 | Enable completion tracking | Yes |
31 And I press "Save and display"
32 When I navigate to "Course completion" in current page administration
33 And I follow "Default activity completion"
34 And I click on "Assignments" "checkbox"
35 And I click on "Edit" "button"
36 And I should see "Completion tracking"
2df7f223 37 And I should see "The changes will affect the following 1 activities or resources:"
8db355c5 38 And I should see "Student must submit to this activity to complete it"
32b93ea7
MG
39 And I set the following fields to these values:
40 | completion | Show activity as complete when conditions are met|
41 | completionview | 1 |
42 | completionusegrade | 1 |
43 | completionsubmit | 1 |
8db355c5 44 And I click on "Save changes" "button"
22002ed7 45 Then I should see "Changes saved"
8db355c5
JD
46 And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
47 And I should see "Student must view this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
48 And I should see "Student must receive a grade to complete this activity" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
49 And I should see "Student must submit to this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
50 And I should not see "Completion expected on" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"