1 |
efrain |
1 |
@availability @availability_grade
|
|
|
2 |
Feature: availability_grade
|
|
|
3 |
In order to control student access to activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set date conditions which prevent student access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | format | enablecompletion |
|
|
|
10 |
| Course 1 | C1 | topics | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | email |
|
|
|
13 |
| teacher1 | t@example.com |
|
|
|
14 |
| student1 | s@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
# Add an assignment.
|
|
|
20 |
And the following "activities" exist:
|
|
|
21 |
| activity | course | name | assignsubmission_onlinetext_enabled |
|
|
|
22 |
| assign | C1 | A1 | 1 |
|
|
|
23 |
| page | C1 | P1 | |
|
|
|
24 |
| page | C1 | P2 | |
|
|
|
25 |
| page | C1 | P3 | |
|
|
|
26 |
| page | C1 | P4 | |
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Test condition
|
|
|
30 |
Given I am on the "P2" "page activity editing" page logged in as "teacher1"
|
|
|
31 |
And I expand all fieldsets
|
|
|
32 |
And I click on "Add restriction..." "button"
|
|
|
33 |
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
|
|
34 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
35 |
And I set the field "Grade" to "A1"
|
|
|
36 |
And I press "Save and return to course"
|
|
|
37 |
|
|
|
38 |
# Add a Page with a grade condition for 50%.
|
|
|
39 |
And I am on the "P3" "page activity editing" page
|
|
|
40 |
And I expand all fieldsets
|
|
|
41 |
And I click on "Add restriction..." "button"
|
|
|
42 |
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
|
|
43 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
44 |
And I set the field "Grade" to "A1"
|
|
|
45 |
And I click on "min" "checkbox" in the ".availability-item" "css_element"
|
|
|
46 |
And I set the field "Minimum grade percentage (inclusive)" to "50"
|
|
|
47 |
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
|
|
48 |
And I set the field "Maximum grade percentage (exclusive)" to "80"
|
|
|
49 |
And I press "Save and return to course"
|
|
|
50 |
|
|
|
51 |
# Check if disabling a part of the restriction is get saved.
|
|
|
52 |
And I am on the "P3" "page activity editing" page
|
|
|
53 |
And I expand all fieldsets
|
|
|
54 |
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
|
|
55 |
And I press "Save and return to course"
|
|
|
56 |
And I am on the "P3" "page activity editing" page
|
|
|
57 |
And the field "Maximum grade percentage (exclusive)" matches value ""
|
|
|
58 |
And I am on "Course 1" course homepage
|
|
|
59 |
|
|
|
60 |
# Add a Page with a grade condition for 10%.
|
|
|
61 |
And I am on the "P4" "page activity editing" page
|
|
|
62 |
And I expand all fieldsets
|
|
|
63 |
And I click on "Add restriction..." "button"
|
|
|
64 |
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
|
|
65 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
66 |
And I set the field "Grade" to "A1"
|
|
|
67 |
And I click on "min" "checkbox" in the ".availability-item" "css_element"
|
|
|
68 |
And I set the field "Minimum grade percentage (inclusive)" to "10"
|
|
|
69 |
And I press "Save and return to course"
|
|
|
70 |
|
|
|
71 |
# Log in as student without a grade yet.
|
|
|
72 |
When I am on the "A1" "assign activity" page logged in as student1
|
|
|
73 |
|
|
|
74 |
# Do the assignment.
|
|
|
75 |
And I click on "Add submission" "button"
|
|
|
76 |
And I set the field "Online text" to "Q"
|
|
|
77 |
And I click on "Save changes" "button"
|
|
|
78 |
And I am on "Course 1" course homepage
|
|
|
79 |
|
|
|
80 |
# None of the pages should appear (check assignment though).
|
|
|
81 |
Then I should not see "P2" in the "region-main" "region"
|
|
|
82 |
And I should not see "P3" in the "region-main" "region"
|
|
|
83 |
And I should not see "P4" in the "region-main" "region"
|
|
|
84 |
And I should see "A1" in the "region-main" "region"
|
|
|
85 |
|
|
|
86 |
# Log back in as teacher.
|
|
|
87 |
When I am on the "A1" "assign activity" page logged in as teacher1
|
|
|
88 |
|
|
|
89 |
# Give the assignment 40%.
|
|
|
90 |
And I follow "View all submissions"
|
|
|
91 |
# Pick the grade link in the row that has s@example.com in it.
|
|
|
92 |
And I click on "Grade" "link" in the "s@example.com" "table_row"
|
|
|
93 |
And I set the field "Grade out of 100" to "40"
|
|
|
94 |
And I click on "Save changes" "button"
|
|
|
95 |
And I click on "Edit settings" "link"
|
|
|
96 |
And I log out
|
|
|
97 |
|
|
|
98 |
# Log back in as student.
|
|
|
99 |
And I am on the "Course 1" course page logged in as student1
|
|
|
100 |
|
|
|
101 |
# Check pages are visible.
|
|
|
102 |
Then I should see "P2" in the "region-main" "region"
|
|
|
103 |
And I should see "P4" in the "region-main" "region"
|
|
|
104 |
And I should not see "P3" in the "region-main" "region"
|
|
|
105 |
|
|
|
106 |
@javascript
|
|
|
107 |
Scenario: Condition display with filters
|
|
|
108 |
# Teacher sets up a restriction on group G1, using multilang filter.
|
|
|
109 |
Given the following "activity" exists:
|
|
|
110 |
| activity | assign |
|
|
|
111 |
| name | <span lang="en" class="multilang">A-One</span><span lang="fr" class="multilang">A-Un</span> |
|
|
|
112 |
| intro | Test |
|
|
|
113 |
| course | C1 |
|
|
|
114 |
| idnumber | 0001 |
|
|
|
115 |
| section | 1 |
|
|
|
116 |
And the "multilang" filter is "on"
|
|
|
117 |
And the "multilang" filter applies to "content and headings"
|
|
|
118 |
# The activity names filter is enabled because it triggered a bug in older versions.
|
|
|
119 |
And the "activitynames" filter is "on"
|
|
|
120 |
And the "activitynames" filter applies to "content and headings"
|
|
|
121 |
And I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
122 |
And I turn editing mode on
|
|
|
123 |
And I am on the "P1" "page activity editing" page
|
|
|
124 |
And I expand all fieldsets
|
|
|
125 |
And I click on "Add restriction..." "button"
|
|
|
126 |
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
|
|
127 |
And I set the field "Grade" to "A-One"
|
|
|
128 |
And I click on "min" "checkbox" in the ".availability-item" "css_element"
|
|
|
129 |
And I set the field "Minimum grade percentage (inclusive)" to "10"
|
|
|
130 |
And I press "Save and return to course"
|
|
|
131 |
And I log out
|
|
|
132 |
|
|
|
133 |
# Student sees information about no access to group, with group name in correct language.
|
|
|
134 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
135 |
Then I should see "Not available unless: You achieve higher than a certain score in A-One"
|
|
|
136 |
And I should not see "A-Un"
|