1 |
efrain |
1 |
@core @core_course @core_courseformat
|
|
|
2 |
Feature: Collapse course sections
|
|
|
3 |
In order to quickly access the course structure
|
|
|
4 |
As a user
|
|
|
5 |
I need to collapse/extend sections for course formats.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category | format | enablecompletion | numsections | startdate | enablecompletion | hiddensections | initsections |
|
|
|
14 |
| Course 1 | C1 | 0 | topics | 1 | 5 | 957139200 | 1 | 0 | 1 |
|
|
|
15 |
| Course 2 | C2 | 0 | weeks | 1 | 5 | 957139200 | 1 | 0 | 0 |
|
|
|
16 |
And the following "activities" exist:
|
|
|
17 |
| activity | name | intro | course | idnumber | section | completion |
|
|
|
18 |
| assign | Assignment 1 | Test assignment description1 | C1 | assign1 | 1 | 1 |
|
|
|
19 |
| assign | Assignment 2 | Test assignment description2 | C1 | assign2 | 2 | 1 |
|
|
|
20 |
| book | Book 2 | | C1 | book2 | 2 | 1 |
|
|
|
21 |
| book | Book 3 | | C1 | book3 | 3 | 1 |
|
|
|
22 |
| forum | Forum 4 | | C1 | forum4 | 4 | 1 |
|
|
|
23 |
| forum | Forum 5 | | C1 | forum5 | 5 | 1 |
|
|
|
24 |
| assign | Assignment 1 | Test assignment description1 | C2 | assign1 | 1 | 1 |
|
|
|
25 |
| assign | Assignment 2 | Test assignment description2 | C2 | assign2 | 2 | 1 |
|
|
|
26 |
| book | Book 2 | | C2 | book2 | 2 | 1 |
|
|
|
27 |
| book | Book 3 | | C2 | book3 | 3 | 1 |
|
|
|
28 |
| forum | Forum 4 | | C2 | forum4 | 4 | 1 |
|
|
|
29 |
| forum | Forum 5 | | C2 | forum5 | 5 | 1 |
|
|
|
30 |
And the following "course enrolments" exist:
|
|
|
31 |
| user | course | role |
|
|
|
32 |
| student1 | C1 | student |
|
|
|
33 |
| teacher1 | C1 | editingteacher |
|
|
|
34 |
| student1 | C2 | student |
|
|
|
35 |
| teacher1 | C2 | editingteacher |
|
|
|
36 |
And I log in as "admin"
|
|
|
37 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
38 |
And I hide section "5"
|
|
|
39 |
And I edit the section "4"
|
|
|
40 |
And I expand all fieldsets
|
|
|
41 |
And I press "Add restriction..."
|
|
|
42 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
43 |
And I set the field "direction" to "until"
|
|
|
44 |
And I set the field "x[year]" to "2013"
|
|
|
45 |
And I press "Save changes"
|
|
|
46 |
And I am on "Course 2" course homepage with editing mode on
|
|
|
47 |
And I hide section "5"
|
|
|
48 |
And I edit the section "4"
|
|
|
49 |
And I expand all fieldsets
|
|
|
50 |
And I press "Add restriction..."
|
|
|
51 |
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
|
|
52 |
And I set the field "direction" to "until"
|
|
|
53 |
And I set the field "x[year]" to "2013"
|
|
|
54 |
And I press "Save changes"
|
|
|
55 |
|
|
|
56 |
@javascript
|
|
|
57 |
Scenario: No chevron on site home
|
|
|
58 |
Given the following "activity" exists:
|
|
|
59 |
| activity | forum |
|
|
|
60 |
| course | Acceptance test site |
|
|
|
61 |
| section | 1 |
|
|
|
62 |
| name | Test forum post backup name |
|
|
|
63 |
And I log in as "admin"
|
|
|
64 |
And I am on site homepage
|
|
|
65 |
And I turn editing mode on
|
|
|
66 |
And I click on "Edit" "link" in the "region-main" "region"
|
|
|
67 |
And I set the field "Section name" to "New section name"
|
|
|
68 |
When I press "Save changes"
|
|
|
69 |
Then "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
|
|
70 |
|
|
|
71 |
@javascript
|
|
|
72 |
Scenario: Expand/collapse sections for Custom sections format.
|
|
|
73 |
Given I am on the "Course 1" course page logged in as student1
|
|
|
74 |
And "[data-toggle=collapse]" "css_element" should exist in the "region-main" "region"
|
|
|
75 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
76 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
77 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
78 |
And I should see "Book 3" in the "region-main" "region"
|
|
|
79 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
80 |
And I should see "2013" in the "section-4" "core_availability > Section availability"
|
|
|
81 |
And I should not see "Forum 4"
|
|
|
82 |
And I should see "Not available" in the "#section-5" "css_element"
|
|
|
83 |
And I should not see "Forum 5"
|
|
|
84 |
When I click on "#collapssesection3" "css_element"
|
|
|
85 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
86 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
87 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
88 |
And I should not see "Book 3" in the "region-main" "region"
|
|
|
89 |
And I click on "#collapssesection1" "css_element"
|
|
|
90 |
And I click on "#collapssesection2" "css_element"
|
|
|
91 |
And I click on "#collapssesection4" "css_element"
|
|
|
92 |
And I click on "#collapssesection5" "css_element"
|
|
|
93 |
Then I should not see "Assignment 1" in the "region-main" "region"
|
|
|
94 |
And I should not see "Assignment 2" in the "region-main" "region"
|
|
|
95 |
And I should not see "Book 2" in the "region-main" "region"
|
|
|
96 |
And I should not see "Book 3" in the "region-main" "region"
|
|
|
97 |
And I should not see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
98 |
And I click on "#collapssesection1" "css_element"
|
|
|
99 |
And I click on "#collapssesection2" "css_element"
|
|
|
100 |
And I click on "#collapssesection3" "css_element"
|
|
|
101 |
And I click on "#collapssesection4" "css_element"
|
|
|
102 |
And I click on "#collapssesection5" "css_element"
|
|
|
103 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
104 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
105 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
106 |
And I should see "Book 3" in the "region-main" "region"
|
|
|
107 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
108 |
|
|
|
109 |
@javascript
|
|
|
110 |
Scenario: Expand/collapse sections for Weeks format.
|
|
|
111 |
Given I am on the "Course 2" course page logged in as teacher1
|
|
|
112 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
113 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
114 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
115 |
And I should see "Book 3" in the "region-main" "region"
|
|
|
116 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
117 |
And I should see "2013" in the "section-4" "core_availability > Section availability"
|
|
|
118 |
And I should see "Forum 4"
|
|
|
119 |
And I should see "Hidden from students" in the "#section-5" "css_element"
|
|
|
120 |
And I should see "Forum 5"
|
|
|
121 |
When I click on "#collapssesection3" "css_element"
|
|
|
122 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
123 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
124 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
125 |
And I should not see "Book 3" in the "region-main" "region"
|
|
|
126 |
And I click on "#collapssesection1" "css_element"
|
|
|
127 |
And I click on "#collapssesection2" "css_element"
|
|
|
128 |
And I click on "#collapssesection4" "css_element"
|
|
|
129 |
And I click on "#collapssesection5" "css_element"
|
|
|
130 |
Then I should not see "Assignment 1" in the "region-main" "region"
|
|
|
131 |
And I should not see "Assignment 2" in the "region-main" "region"
|
|
|
132 |
And I should not see "Book 2" in the "region-main" "region"
|
|
|
133 |
And I should not see "Book 3" in the "region-main" "region"
|
|
|
134 |
And I should not see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
135 |
And I should not see "Not available" in the "#section-5" "css_element"
|
|
|
136 |
And I click on "#collapssesection1" "css_element"
|
|
|
137 |
And I click on "#collapssesection2" "css_element"
|
|
|
138 |
And I click on "#collapssesection3" "css_element"
|
|
|
139 |
And I click on "#collapssesection4" "css_element"
|
|
|
140 |
And I click on "#collapssesection5" "css_element"
|
|
|
141 |
And I should see "Assignment 1" in the "region-main" "region"
|
|
|
142 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
143 |
And I should see "Book 2" in the "region-main" "region"
|
|
|
144 |
And I should see "Book 3" in the "region-main" "region"
|
|
|
145 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
146 |
And I should see "2013" in the "section-4" "core_availability > Section availability"
|
|
|
147 |
And I should see "Forum 4"
|
|
|
148 |
And I should see "Hidden from students" in the "#section-5" "css_element"
|
|
|
149 |
And I should see "Forum 5"
|
|
|
150 |
|
|
|
151 |
@javascript
|
|
|
152 |
Scenario: Users don't see chevron on one section per page for Custom sections format
|
|
|
153 |
Given I am on the "Course 1" course page logged in as teacher1
|
|
|
154 |
When I navigate to "Settings" in current page administration
|
|
|
155 |
And I expand all fieldsets
|
|
|
156 |
And I set the following fields to these values:
|
|
|
157 |
| Course layout | Show one section per page |
|
|
|
158 |
And I press "Save and display"
|
|
|
159 |
And "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
|
|
160 |
And I click on "Section 2" "link" in the "region-main" "region"
|
|
|
161 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
162 |
And "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
|
|
163 |
Then "Section 1" "section" should not exist
|
|
|
164 |
And "Section 3" "section" should not exist
|
|
|
165 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
166 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
167 |
And I should see "2013" in the "section-4" "core_availability > Section availability"
|
|
|
168 |
And I should see "Forum 4"
|
|
|
169 |
And I should see "Hidden from students" in the "#section-5" "css_element"
|
|
|
170 |
And I should see "Forum 5"
|
|
|
171 |
|
|
|
172 |
@javascript
|
|
|
173 |
Scenario: Users don't see chevron on one section per page for Weeks format
|
|
|
174 |
Given I am on the "Course 2" course page logged in as teacher1
|
|
|
175 |
When I navigate to "Settings" in current page administration
|
|
|
176 |
And I expand all fieldsets
|
|
|
177 |
And I set the following fields to these values:
|
|
|
178 |
| Course layout | Show one section per page |
|
|
|
179 |
And I press "Save and display"
|
|
|
180 |
And "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
|
|
181 |
And I click on "8 May - 14 May" "link" in the "region-main" "region"
|
|
|
182 |
And I should see "Assignment 2" in the "region-main" "region"
|
|
|
183 |
And "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
|
|
184 |
Then "1 May - 7 May" "section" should not exist
|
|
|
185 |
And "15 May - 21 May" "section" should not exist
|
|
|
186 |
And I am on the "Course 1" course page logged in as student1
|
|
|
187 |
And I should see "Available until" in the "section-4" "core_availability > Section availability"
|
|
|
188 |
And I should see "2013" in the "section-4" "core_availability > Section availability"
|
|
|
189 |
And I should not see "Forum 4"
|
|
|
190 |
And I should see "Not available" in the "#section-5" "css_element"
|
|
|
191 |
And I should not see "Forum 5"
|