Merge branch 'MDL-58490-master' of git://github.com/lameze/moodle
[moodle.git] / blocks / navigation / tests / behat / expand_courses_node.feature
CommitLineData
cbd063f4
SH
1@block @block_navigation
2Feature: Expand the courses nodes within the navigation block
3 In order to navigate the site
4 As an anonymous user, a guest, a student, and an admin
5 I need to expand the courses node in the navigation block and check the display of courses and categories.
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
cbd063f4
SH
12 And the following "categories" exist:
13 | name | category | idnumber | visible |
14 | cat1 | 0 | cat1 | 1 |
15 | cat2 | 0 | cat2 | 1 |
16 | cat21 | cat2 | cat21 | 1 |
17 | cat211 | cat21 | cat211 | 1 |
18 | cat3 | 0 | cat3 | 0 |
19 And the following "courses" exist:
20 | fullname | shortname | category | visible |
21 | Course 1 | c1 | cat1 | 1 |
22 | Course 2 | c2 | cat2 | 1 |
23 | Course 3 | c3 | cat21 | 1 |
24 | Course 4 | c4 | cat211 | 1 |
25 | Course 5 | c5 | cat211 | 0 |
26 | Course 6 | c6 | cat211 | 0 |
27 | Course 7 | c7 | cat3 | 1 |
28 | Course 8 | c8 | cat3 | 0 |
29 And the following "course enrolments" exist:
30 | user | course | role |
31 | teacher1 | c1 | teacher |
32 | teacher1 | c3 | teacher |
33 | teacher1 | c5 | teacher |
34 | student1 | c1 | student |
35 | student1 | c2 | student |
36 | student1 | c4 | student |
345c6a1a 37 And the following config values are set as admin:
bed97c39 38 | navshowallcourses | 1 |
cbd063f4 39 And I log in as "admin"
46a2fbc4 40 And I am on site homepage
50bd633d
MG
41 And I turn editing mode on
42 And I add the "Navigation" block if not present
43 And I configure the "Navigation" block
44 And I set the following fields to these values:
45 | Page contexts | Display throughout the entire site |
46 And I press "Save changes"
47 And I turn editing mode off
fdeeaff9 48 And I am on "Course 2" course homepage
8b3090c1
EL
49 And I navigate to "Enrolment methods" node in "Course administration > Users"
50 And I click on "Edit" "link" in the "Guest access" "table_row"
cbd063f4
SH
51 And I set the following fields to these values:
52 | Allow guest access | Yes |
8b3090c1 53 And I press "Save changes"
cbd063f4
SH
54 And I log out
55
56 @javascript
57 Scenario: As an anonymous user I expand the courses node to see courses.
58 When I should see "You are not logged in." in the ".logininfo" "css_element"
59 And I should see "Home" in the "Navigation" "block"
60 And I should see "Courses" in the "Navigation" "block"
61 And I expand "Courses" node
62 And I should see "cat1" in the "Navigation" "block"
63 And I should see "cat2" in the "Navigation" "block"
64 And I should not see "cat3" in the "Navigation" "block"
65 And I expand "cat1" node
66 And I expand "cat2" node
67 And I should see "cat21" in the "Navigation" "block"
68 And I expand "cat21" node
69 And I should see "cat211" in the "Navigation" "block"
70 And I expand "cat211" node
71 Then I should see "c1" in the "Navigation" "block"
72 And I should see "c2" in the "Navigation" "block"
73 And I should see "c3" in the "Navigation" "block"
74 And I should see "c4" in the "Navigation" "block"
75 And I should not see "c5" in the "Navigation" "block"
76 And I should not see "c6" in the "Navigation" "block"
77 And navigation node "c1" should not be expandable
78 And navigation node "c2" should not be expandable
79 And navigation node "c3" should not be expandable
80 And navigation node "c4" should not be expandable
81
82 @javascript
83 Scenario: As the admin user I expand the courses and category nodes to see courses.
84 When I log in as "admin"
46a2fbc4
DW
85 And I am on site homepage
86 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
87 And I should see "Courses" in the "Navigation" "block"
88 And I expand "Courses" node
89 And I should see "cat1" in the "Navigation" "block"
90 And I should see "cat2" in the "Navigation" "block"
91 And I should see "cat3" in the "Navigation" "block"
92 And I expand "cat1" node
93 And I expand "cat2" node
94 And I expand "cat3" node
95 And I should see "cat21" in the "Navigation" "block"
96 And I expand "cat21" node
97 And I should see "cat211" in the "Navigation" "block"
98 And I expand "cat211" node
99 Then I should see "c1" in the "Navigation" "block"
100 And I should see "c2" in the "Navigation" "block"
101 And I should see "c3" in the "Navigation" "block"
102 And I should see "c4" in the "Navigation" "block"
103 And I should see "c5" in the "Navigation" "block"
104 And I should see "c6" in the "Navigation" "block"
105 And I should see "c7" in the "Navigation" "block"
106 And I should see "c8" in the "Navigation" "block"
107 And navigation node "c1" should be expandable
108 And navigation node "c2" should be expandable
109 And navigation node "c3" should be expandable
110 And navigation node "c4" should be expandable
111 And navigation node "c5" should be expandable
112 And navigation node "c6" should be expandable
113 And navigation node "c7" should be expandable
114 And navigation node "c8" should be expandable
115
116 @javascript
117 Scenario: As teacher1 I expand the courses and category nodes to see courses.
118 When I log in as "teacher1"
46a2fbc4
DW
119 And I am on site homepage
120 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
121 And I should see "Courses" in the "Navigation" "block"
122 And I expand "Courses" node
123 And I should see "cat1" in the "Navigation" "block"
124 And I should see "cat2" in the "Navigation" "block"
125 And I should not see "cat3" in the "Navigation" "block"
126 And I expand "cat1" node
127 And I expand "cat2" node
128 And I should see "cat21" in the "Navigation" "block"
129 And I expand "cat21" node
130 And I should see "cat211" in the "Navigation" "block"
131 And I expand "cat211" node
132 Then I should see "c1" in the "Navigation" "block"
133 And I should see "c2" in the "Navigation" "block"
134 And I should see "c3" in the "Navigation" "block"
135 And I should see "c4" in the "Navigation" "block"
136 And I should see "c5" in the "Navigation" "block"
137 And I should not see "c6" in the "Navigation" "block"
138 And I should not see "c7" in the "Navigation" "block"
139 And I should not see "c8" in the "Navigation" "block"
140 And navigation node "c1" should be expandable
141 And navigation node "c2" should be expandable
142 And navigation node "c3" should be expandable
143 And navigation node "c4" should not be expandable
144 And navigation node "c5" should be expandable
145
146 @javascript
147 Scenario: As student1 I expand the courses and category nodes to see courses.
148 When I log in as "student1"
46a2fbc4
DW
149 And I am on site homepage
150 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
151 And I should see "Courses" in the "Navigation" "block"
152 And I expand "Courses" node
153 And I should see "cat1" in the "Navigation" "block"
154 And I should see "cat2" in the "Navigation" "block"
155 And I should not see "cat3" in the "Navigation" "block"
156 And I expand "cat1" node
157 And I expand "cat2" node
158 And I should see "cat21" in the "Navigation" "block"
159 And I expand "cat21" node
160 And I should see "cat211" in the "Navigation" "block"
161 And I expand "cat211" node
162 Then I should see "c1" in the "Navigation" "block"
163 And I should see "c2" in the "Navigation" "block"
164 And I should see "c3" in the "Navigation" "block"
165 And I should see "c4" in the "Navigation" "block"
166 And I should not see "c5" in the "Navigation" "block"
167 And I should not see "c6" in the "Navigation" "block"
168 And I should not see "c7" in the "Navigation" "block"
169 And I should not see "c8" in the "Navigation" "block"
170 And navigation node "c1" should be expandable
171 And navigation node "c2" should be expandable
172 And navigation node "c3" should not be expandable
173 And navigation node "c4" should be expandable
174
175 @javascript
176 Scenario: As guest I expand the courses and category nodes to see courses.
177 When I log in as "guest"
46a2fbc4 178 And I am on site homepage
cbd063f4
SH
179 And I should see "Home" in the "Navigation" "block"
180 And I should see "Courses" in the "Navigation" "block"
181 And I expand "Courses" node
182 And I should see "cat1" in the "Navigation" "block"
183 And I should see "cat2" in the "Navigation" "block"
184 And I should not see "cat3" in the "Navigation" "block"
185 And I expand "cat1" node
186 And I expand "cat2" node
187 And I should see "cat21" in the "Navigation" "block"
188 And I expand "cat21" node
189 And I should see "cat211" in the "Navigation" "block"
190 And I expand "cat211" node
191 Then I should see "c1" in the "Navigation" "block"
192 And I should see "c2" in the "Navigation" "block"
193 And I should see "c3" in the "Navigation" "block"
194 And I should see "c4" in the "Navigation" "block"
195 And I should not see "c5" in the "Navigation" "block"
196 And I should not see "c6" in the "Navigation" "block"
197 And I should not see "c7" in the "Navigation" "block"
198 And I should not see "c8" in the "Navigation" "block"
199 And navigation node "c1" should not be expandable
200 And navigation node "c2" should be expandable
201 And navigation node "c3" should not be expandable
46a2fbc4 202 And navigation node "c4" should not be expandable