MDL-58138 tests: unit and behat tests covering bulk and default tabs
[moodle.git] / completion / tests / behat / default_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 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
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 And I log in as "teacher1"
27 And I am on site homepage
28 And I follow "Course 1"
29 And I turn editing mode on
30 And I navigate to "Edit settings" in current page administration
31 And I set the following fields to these values:
32 | Enable completion tracking | Yes |
33 And I press "Save and display"
34 When I navigate to "Course completion" in current page administration
35 And I follow "Default activity completion"
36 And I click on "Assignments" "checkbox"
37 And I click on "Edit" "button"
38 And I should see "Completion tracking"
39 And I should see "The changes will affect the following 1 Activities/Resources"
40 And I should see "Student must submit to this activity to complete it"
41 And I select "Show activity as complete when conditions are met" from the "completion" singleselect
42 And I click on "completionview" "checkbox"
43 And I click on "completionusegrade" "checkbox"
44 And I click on "completionsubmit" "checkbox"
45 And I click on "Save changes" "button"
46 #Then I should see "Updated completion for activity Test assignment one"
47 #And I should see "Updated completion for activity Test assignment two"
48 And I should see "With conditions" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
49 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"
50 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"
51 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"
52 And I should not see "Completion expected on" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' row ')][.//*[text() = 'Assignments']]" "xpath_element"
53