1 |
efrain |
1 |
@ewallah @availability @availability_coursecompleted
|
|
|
2 |
Feature: availability_coursecompleted
|
|
|
3 |
In order to control student access to activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set course completion conditions which prevent student access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | format | enablecompletion | numsections |
|
|
|
10 |
| Course 1 | C1 | topics | 1 | 4 |
|
|
|
11 |
And the following "activities" exist:
|
|
|
12 |
| activity | name | intro | course | idnumber | section | visible |
|
|
|
13 |
| page | Page A | page description | C1 | page1 | 1 | 1 |
|
|
|
14 |
| page | Page B | page description | C1 | page2 | 1 | 1 |
|
|
|
15 |
| page | Page C | page description | C1 | page3 | 1 | 1 |
|
|
|
16 |
| page | Page D | page description | C1 | page4 | 1 | 1 |
|
|
|
17 |
And the following "users" exist:
|
|
|
18 |
| username | firstname | lastname | email |
|
|
|
19 |
| student1 | Student | First | student1@example.com |
|
|
|
20 |
| student2 | Student | Second | student2@example.com |
|
|
|
21 |
| teacher1 | Teacher | First | teacher1@example.com |
|
|
|
22 |
And the following "course enrolments" exist:
|
|
|
23 |
| user | course | role |
|
|
|
24 |
| teacher1 | C1 | editingteacher |
|
|
|
25 |
| student1 | C1 | student |
|
|
|
26 |
| student2 | C1 | student |
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Complete a course
|
|
|
30 |
Given I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
31 |
And I navigate to "Course completion" in current page administration
|
|
|
32 |
And I expand all fieldsets
|
|
|
33 |
And I set the field "Teacher" to "1"
|
|
|
34 |
And I click on "Save changes" "button"
|
|
|
35 |
|
|
|
36 |
# Configure Page A for users who did not completed this course.
|
|
|
37 |
When I am on the "page1" "page activity editing" page
|
|
|
38 |
And I expand all fieldsets
|
|
|
39 |
And I click on "Add restriction..." "button"
|
|
|
40 |
And I click on "Course completed" "button" in the "Add restriction..." "dialogue"
|
|
|
41 |
Then I should see "Please set" in the "region-main" "region"
|
|
|
42 |
And I set the field "Course completed" to "No"
|
|
|
43 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
44 |
And I click on "Save and return to course" "button"
|
|
|
45 |
|
|
|
46 |
# Configure page B for users who did not completed the course.
|
|
|
47 |
When I am on the "page2" "page activity editing" page
|
|
|
48 |
And I expand all fieldsets
|
|
|
49 |
And I click on "Add restriction..." "button"
|
|
|
50 |
And I click on "Course completed" "button"
|
|
|
51 |
Then I should see "Please set" in the "region-main" "region"
|
|
|
52 |
And I set the field "Course completed" to "No"
|
|
|
53 |
But I should not see "Please set" in the "region-main" "region"
|
|
|
54 |
And I click on "Save and return to course" "button"
|
|
|
55 |
|
|
|
56 |
# Configure page C for users who completed the course.
|
|
|
57 |
When I am on the "page3" "page activity editing" page
|
|
|
58 |
And I expand all fieldsets
|
|
|
59 |
And I click on "Add restriction..." "button"
|
|
|
60 |
And I click on "Course completed" "button"
|
|
|
61 |
And I set the field "Course completed" to "Yes"
|
|
|
62 |
And I click on "Save and return to course" "button"
|
|
|
63 |
|
|
|
64 |
# Configure page D for users who completed the course hidden.
|
|
|
65 |
When I am on the "page4" "page activity editing" page
|
|
|
66 |
And I expand all fieldsets
|
|
|
67 |
And I click on "Add restriction..." "button"
|
|
|
68 |
And I click on "Course completed" "button"
|
|
|
69 |
And I set the field "Course completed" to "Yes"
|
|
|
70 |
And I click on ".availability-item .availability-eye img" "css_element"
|
|
|
71 |
And I click on "Save and return to course" "button"
|
|
|
72 |
And I log out
|
|
|
73 |
|
|
|
74 |
# Log in as student.
|
|
|
75 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
76 |
Then I should see "Page A" in the "region-main" "region"
|
|
|
77 |
And I should see "Page B" in the "region-main" "region"
|
|
|
78 |
And I should see "Page C" in the "region-main" "region"
|
|
|
79 |
And I should not see "Page D" in the "region-main" "region"
|
|
|
80 |
And I log out
|
|
|
81 |
|
|
|
82 |
When I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
83 |
And I mark course "C1" completed for user "student1"
|
|
|
84 |
And I run all adhoc tasks
|
|
|
85 |
And I log out
|
|
|
86 |
|
|
|
87 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
88 |
And I should see "Page B" in the "region-main" "region"
|
|
|
89 |
And I should see "Page C" in the "region-main" "region"
|
|
|
90 |
And I should see "Page D" in the "region-main" "region"
|
|
|
91 |
But I should not see "Page A" in the "region-main" "region"
|
|
|
92 |
|
|
|
93 |
@javascript
|
|
|
94 |
Scenario: See restricted feedback users who have not responded
|
|
|
95 |
Given I am on the "C1" "Course" page logged in as "teacher1"
|
|
|
96 |
And I navigate to "Course completion" in current page administration
|
|
|
97 |
And I expand all fieldsets
|
|
|
98 |
And I set the field "Teacher" to "1"
|
|
|
99 |
And I click on "Save changes" "button"
|
|
|
100 |
|
|
|
101 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
102 |
And I add a feedback activity to course "Course 1" section "2" and I fill the form with:
|
|
|
103 |
| Name | Frogs |
|
|
|
104 |
| Description | x |
|
|
|
105 |
| Record user names | User's name will be logged and shown with answers |
|
|
|
106 |
And I am on the "Frogs" "feedback activity editing" page
|
|
|
107 |
And I expand all fieldsets
|
|
|
108 |
And I click on "Add restriction..." "button"
|
|
|
109 |
And I click on "Course completed" "button"
|
|
|
110 |
And I set the field "Course completed" to "No"
|
|
|
111 |
And I click on "Save and return to course" "button"
|
|
|
112 |
|
|
|
113 |
And I am on the Frogs "feedback activity" page
|
|
|
114 |
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
|
|
115 |
And I add a "Short text answer" question to the feedback with:
|
|
|
116 |
| Question | Y/N? |
|
|
|
117 |
And I log out
|
|
|
118 |
|
|
|
119 |
# Go in as student 1 and do the feedback.
|
|
|
120 |
When I am on the Frogs "feedback activity" page logged in as student1
|
|
|
121 |
And I follow "Answer the questions"
|
|
|
122 |
And I set the field "Y/N?" to "Y"
|
|
|
123 |
And I press "Submit your answers"
|
|
|
124 |
And I log out
|
|
|
125 |
|
|
|
126 |
# Go in as teacher and check the users who haven't completed it.
|
|
|
127 |
And I am on the Frogs "feedback activity" page logged in as teacher1
|
|
|
128 |
And I navigate to "Responses" in current page administration
|
|
|
129 |
Then I select "Show non-respondents" from the "jump" singleselect
|
|
|
130 |
But I should not see "Student 2"
|
|
|
131 |
And I should not see "Student 1"
|