Merge branch 'MDL-53140-master' of git://github.com/rezaies/moodle
[moodle.git] / completion / tests / behat / bulk_edit_activity_completion.feature
CommitLineData
8db355c5
JD
1@core @core_completion
2Feature: Allow teachers to bulk edit activity completion rules in a course.
3 In order to avoid editing single activities
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 bulk edit activity completion rules for activities of the same kind.
9 # Then the completion rules should be updated for all selected activities.
10 @javascript
11 Scenario: Bulk edit activity completion rules
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 | assign | C1 | a2 | Test assignment two | Submit something! | 100 |
27 | assign | C1 | a3 | Test assignment three | Submit something! | 150 |
28 | assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
29 And I log in as "teacher1"
197e2bca 30 And I am on "Course 1" course homepage with editing mode on
8db355c5
JD
31 And I navigate to "Edit settings" in current page administration
32 And I set the following fields to these values:
33 | Enable completion tracking | Yes |
34 And I press "Save and display"
35 When I navigate to "Course completion" in current page administration
36 And I follow "Bulk edit activity completion"
37 And I click on "Test assignment one" "checkbox"
38 And I click on "Test assignment two" "checkbox"
39 And I click on "Edit" "button"
40 And I should see "Completion tracking"
2df7f223 41 And I should see "The changes will affect the following 2 activities or resources:"
8db355c5
JD
42 And I should see "Student must submit to this activity to complete it"
43 And I select "Show activity as complete when conditions are met" from the "completion" singleselect
44 And I click on "completionview" "checkbox"
45 And I click on "completionusegrade" "checkbox"
46 And I click on "completionsubmit" "checkbox"
47 And I click on "Save changes" "button"
22002ed7 48 Then I should see "Changes saved"
8db355c5
JD
49 And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
50 And I should see "Student must view this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
51 And I should see "Student must receive a grade to complete this activity" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
52 And I should see "Student must submit to this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
53 And I should not see "Completion expected on" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment one']]" "xpath_element"
54 And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element"
55 And I should see "Student must view this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element"
56 And I should see "Student must receive a grade to complete this activity" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element"
57 And I should see "Student must submit to this activity to complete it" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element"
58 And I should not see "Completion expected on" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Test assignment two']]" "xpath_element"