1 |
efrain |
1 |
@block @block_myoverview @javascript
|
|
|
2 |
Feature: My overview block pagination
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email | idnumber |
|
|
|
7 |
| student1 | Student | X | student1@example.com | S1 |
|
|
|
8 |
And the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 01 | C1 | 0 |
|
|
|
11 |
| Course 02 | C2 | 0 |
|
|
|
12 |
| Course 03 | C3 | 0 |
|
|
|
13 |
| Course 04 | C4 | 0 |
|
|
|
14 |
| Course 05 | C5 | 0 |
|
|
|
15 |
| Course 06 | C6 | 0 |
|
|
|
16 |
| Course 07 | C7 | 0 |
|
|
|
17 |
| Course 08 | C8 | 0 |
|
|
|
18 |
| Course 09 | C9 | 0 |
|
|
|
19 |
| Course 10 | C10 | 0 |
|
|
|
20 |
| Course 11 | C11 | 0 |
|
|
|
21 |
| Course 12 | C12 | 0 |
|
|
|
22 |
| Course 13 | C13 | 0 |
|
|
|
23 |
| Course 14 | C14 | 0 |
|
|
|
24 |
| Course 15 | C15 | 0 |
|
|
|
25 |
| Course 16 | C16 | 0 |
|
|
|
26 |
| Course 17 | C17 | 0 |
|
|
|
27 |
| Course 18 | C18 | 0 |
|
|
|
28 |
| Course 19 | C19 | 0 |
|
|
|
29 |
| Course 20 | C20 | 0 |
|
|
|
30 |
| Course 21 | C21 | 0 |
|
|
|
31 |
| Course 22 | C22 | 0 |
|
|
|
32 |
| Course 23 | C23 | 0 |
|
|
|
33 |
| Course 24 | C24 | 0 |
|
|
|
34 |
| Course 25 | C25 | 0 |
|
|
|
35 |
|
|
|
36 |
Scenario: The pagination controls should be hidden if I am not enrolled in any courses
|
|
|
37 |
When I am on the "My courses" page logged in as "student1"
|
|
|
38 |
Then I should see "You're not enrolled in any course" in the "Course overview" "block"
|
|
|
39 |
And I should not see "Show" in the "Course overview" "block"
|
|
|
40 |
And ".block_myoverview .dropdown-menu.show" "css_element" should not be visible
|
|
|
41 |
And ".block_myoverview [data-control='next']" "css_element" should not be visible
|
|
|
42 |
And ".block_myoverview [data-control='previous']" "css_element" should not be visible
|
|
|
43 |
And I log out
|
|
|
44 |
|
|
|
45 |
Scenario: The pagination controls should be hidden if I am enrolled in 12 courses or less
|
|
|
46 |
Given the following "course enrolments" exist:
|
|
|
47 |
| user | course | role |
|
|
|
48 |
| student1 | C1 | student |
|
|
|
49 |
| student1 | C2 | student |
|
|
|
50 |
| student1 | C3 | student |
|
|
|
51 |
| student1 | C4 | student |
|
|
|
52 |
| student1 | C5 | student |
|
|
|
53 |
| student1 | C6 | student |
|
|
|
54 |
| student1 | C7 | student |
|
|
|
55 |
| student1 | C8 | student |
|
|
|
56 |
| student1 | C9 | student |
|
|
|
57 |
| student1 | C10 | student |
|
|
|
58 |
| student1 | C11 | student |
|
|
|
59 |
| student1 | C12 | student |
|
|
|
60 |
When I am on the "My courses" page logged in as "student1"
|
|
|
61 |
Then I should not see "Show" in the "Course overview" "block"
|
|
|
62 |
And ".block_myoverview .dropdown-menu.show" "css_element" should not be visible
|
|
|
63 |
And ".block_myoverview [data-control='next']" "css_element" should not be visible
|
|
|
64 |
And ".block_myoverview [data-control='previous']" "css_element" should not be visible
|
|
|
65 |
And I log out
|
|
|
66 |
|
|
|
67 |
Scenario: The default pagination should be 12 courses
|
|
|
68 |
Given the following "course enrolments" exist:
|
|
|
69 |
| user | course | role |
|
|
|
70 |
| student1 | C1 | student |
|
|
|
71 |
| student1 | C2 | student |
|
|
|
72 |
| student1 | C3 | student |
|
|
|
73 |
| student1 | C4 | student |
|
|
|
74 |
| student1 | C5 | student |
|
|
|
75 |
| student1 | C6 | student |
|
|
|
76 |
| student1 | C7 | student |
|
|
|
77 |
| student1 | C8 | student |
|
|
|
78 |
| student1 | C9 | student |
|
|
|
79 |
| student1 | C10 | student |
|
|
|
80 |
| student1 | C11 | student |
|
|
|
81 |
| student1 | C12 | student |
|
|
|
82 |
| student1 | C13 | student |
|
|
|
83 |
When I am on the "My courses" page logged in as "student1"
|
|
|
84 |
Then I should see "12" in the ".block_myoverview [data-action='limit-toggle']" "css_element"
|
|
|
85 |
And I log out
|
|
|
86 |
|
|
|
87 |
Scenario: I should only see pagination limit options less than total number of enrolled courses
|
|
|
88 |
Given the following "course enrolments" exist:
|
|
|
89 |
| user | course | role |
|
|
|
90 |
| student1 | C1 | student |
|
|
|
91 |
| student1 | C2 | student |
|
|
|
92 |
| student1 | C3 | student |
|
|
|
93 |
| student1 | C4 | student |
|
|
|
94 |
| student1 | C5 | student |
|
|
|
95 |
| student1 | C6 | student |
|
|
|
96 |
| student1 | C7 | student |
|
|
|
97 |
| student1 | C8 | student |
|
|
|
98 |
| student1 | C9 | student |
|
|
|
99 |
| student1 | C10 | student |
|
|
|
100 |
| student1 | C11 | student |
|
|
|
101 |
| student1 | C12 | student |
|
|
|
102 |
| student1 | C13 | student |
|
|
|
103 |
And I am on the "My courses" page logged in as "student1"
|
|
|
104 |
When I click on "[data-action='limit-toggle']" "css_element" in the "Course overview" "block"
|
|
|
105 |
Then I should see "All" in the ".dropdown-menu.show" "css_element"
|
|
|
106 |
And I should see "12" in the ".dropdown-menu.show" "css_element"
|
|
|
107 |
And ".block_myoverview [data-control='next']" "css_element" should be visible
|
|
|
108 |
And ".block_myoverview [data-control='previous']" "css_element" should be visible
|
|
|
109 |
But I should not see "24" in the ".block_myoverview .dropdown-menu.show" "css_element"
|
|
|
110 |
And I log out
|
|
|
111 |
|
|
|
112 |
Scenario: Previous page button should be disabled when on the first page of courses
|
|
|
113 |
Given the following "course enrolments" exist:
|
|
|
114 |
| user | course | role |
|
|
|
115 |
| student1 | C1 | student |
|
|
|
116 |
| student1 | C2 | student |
|
|
|
117 |
| student1 | C3 | student |
|
|
|
118 |
| student1 | C4 | student |
|
|
|
119 |
| student1 | C5 | student |
|
|
|
120 |
| student1 | C6 | student |
|
|
|
121 |
| student1 | C7 | student |
|
|
|
122 |
| student1 | C8 | student |
|
|
|
123 |
| student1 | C9 | student |
|
|
|
124 |
| student1 | C10 | student |
|
|
|
125 |
| student1 | C11 | student |
|
|
|
126 |
| student1 | C12 | student |
|
|
|
127 |
| student1 | C13 | student |
|
|
|
128 |
When I am on the "My courses" page logged in as "student1"
|
|
|
129 |
Then the "class" attribute of ".block_myoverview [data-control='previous']" "css_element" should contain "disabled"
|
|
|
130 |
And I log out
|
|
|
131 |
|
|
|
132 |
Scenario: Next page button should be disabled when on the last page of courses
|
|
|
133 |
Given the following "course enrolments" exist:
|
|
|
134 |
| user | course | role |
|
|
|
135 |
| student1 | C1 | student |
|
|
|
136 |
| student1 | C2 | student |
|
|
|
137 |
| student1 | C3 | student |
|
|
|
138 |
| student1 | C4 | student |
|
|
|
139 |
| student1 | C5 | student |
|
|
|
140 |
| student1 | C6 | student |
|
|
|
141 |
| student1 | C7 | student |
|
|
|
142 |
| student1 | C8 | student |
|
|
|
143 |
| student1 | C9 | student |
|
|
|
144 |
| student1 | C10 | student |
|
|
|
145 |
| student1 | C11 | student |
|
|
|
146 |
| student1 | C12 | student |
|
|
|
147 |
| student1 | C13 | student |
|
|
|
148 |
When I am on the "My courses" page logged in as "student1"
|
|
|
149 |
And I wait until ".block_myoverview [data-control='next']" "css_element" exists
|
|
|
150 |
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
|
|
|
151 |
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should contain "disabled"
|
|
|
152 |
And I log out
|
|
|
153 |
|
|
|
154 |
Scenario: Next and previous page buttons should both be enabled when not on last or first page of courses
|
|
|
155 |
Given the following "course enrolments" exist:
|
|
|
156 |
| user | course | role |
|
|
|
157 |
| student1 | C1 | student |
|
|
|
158 |
| student1 | C2 | student |
|
|
|
159 |
| student1 | C3 | student |
|
|
|
160 |
| student1 | C4 | student |
|
|
|
161 |
| student1 | C5 | student |
|
|
|
162 |
| student1 | C6 | student |
|
|
|
163 |
| student1 | C7 | student |
|
|
|
164 |
| student1 | C8 | student |
|
|
|
165 |
| student1 | C9 | student |
|
|
|
166 |
| student1 | C10 | student |
|
|
|
167 |
| student1 | C11 | student |
|
|
|
168 |
| student1 | C12 | student |
|
|
|
169 |
| student1 | C13 | student |
|
|
|
170 |
| student1 | C14 | student |
|
|
|
171 |
| student1 | C15 | student |
|
|
|
172 |
| student1 | C16 | student |
|
|
|
173 |
| student1 | C17 | student |
|
|
|
174 |
| student1 | C18 | student |
|
|
|
175 |
| student1 | C19 | student |
|
|
|
176 |
| student1 | C20 | student |
|
|
|
177 |
| student1 | C21 | student |
|
|
|
178 |
| student1 | C22 | student |
|
|
|
179 |
| student1 | C23 | student |
|
|
|
180 |
| student1 | C24 | student |
|
|
|
181 |
| student1 | C25 | student |
|
|
|
182 |
When I am on the "My courses" page logged in as "student1"
|
|
|
183 |
And I wait until ".block_myoverview [data-control='next']" "css_element" exists
|
|
|
184 |
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
|
|
|
185 |
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should not contain "disabled"
|
|
|
186 |
And the "class" attribute of ".block_myoverview [data-control='previous']" "css_element" should not contain "disabled"
|
|
|
187 |
And I should see "Course 13" in the "Course overview" "block"
|
|
|
188 |
And I should see "Course 24" in the "Course overview" "block"
|
|
|
189 |
But I should not see "Course 12" in the "Course overview" "block"
|
|
|
190 |
And I should not see "Course 25" in the "Course overview" "block"
|
|
|
191 |
And I log out
|