MDL-56614 behat: new steps for navigation without blocks
[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
cbd063f4 41 And I follow "Course 2"
8b3090c1
EL
42 And I navigate to "Enrolment methods" node in "Course administration > Users"
43 And I click on "Edit" "link" in the "Guest access" "table_row"
cbd063f4
SH
44 And I set the following fields to these values:
45 | Allow guest access | Yes |
8b3090c1 46 And I press "Save changes"
cbd063f4
SH
47 And I log out
48
49 @javascript
50 Scenario: As an anonymous user I expand the courses node to see courses.
51 When I should see "You are not logged in." in the ".logininfo" "css_element"
52 And I should see "Home" in the "Navigation" "block"
53 And I should see "Courses" in the "Navigation" "block"
54 And I expand "Courses" node
55 And I should see "cat1" in the "Navigation" "block"
56 And I should see "cat2" in the "Navigation" "block"
57 And I should not see "cat3" in the "Navigation" "block"
58 And I expand "cat1" node
59 And I expand "cat2" node
60 And I should see "cat21" in the "Navigation" "block"
61 And I expand "cat21" node
62 And I should see "cat211" in the "Navigation" "block"
63 And I expand "cat211" node
64 Then I should see "c1" in the "Navigation" "block"
65 And I should see "c2" in the "Navigation" "block"
66 And I should see "c3" in the "Navigation" "block"
67 And I should see "c4" in the "Navigation" "block"
68 And I should not see "c5" in the "Navigation" "block"
69 And I should not see "c6" in the "Navigation" "block"
70 And navigation node "c1" should not be expandable
71 And navigation node "c2" should not be expandable
72 And navigation node "c3" should not be expandable
73 And navigation node "c4" should not be expandable
74
75 @javascript
76 Scenario: As the admin user I expand the courses and category nodes to see courses.
77 When I log in as "admin"
46a2fbc4
DW
78 And I am on site homepage
79 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
80 And I should see "Courses" in the "Navigation" "block"
81 And I expand "Courses" node
82 And I should see "cat1" in the "Navigation" "block"
83 And I should see "cat2" in the "Navigation" "block"
84 And I should see "cat3" in the "Navigation" "block"
85 And I expand "cat1" node
86 And I expand "cat2" node
87 And I expand "cat3" node
88 And I should see "cat21" in the "Navigation" "block"
89 And I expand "cat21" node
90 And I should see "cat211" in the "Navigation" "block"
91 And I expand "cat211" node
92 Then I should see "c1" in the "Navigation" "block"
93 And I should see "c2" in the "Navigation" "block"
94 And I should see "c3" in the "Navigation" "block"
95 And I should see "c4" in the "Navigation" "block"
96 And I should see "c5" in the "Navigation" "block"
97 And I should see "c6" in the "Navigation" "block"
98 And I should see "c7" in the "Navigation" "block"
99 And I should see "c8" in the "Navigation" "block"
100 And navigation node "c1" should be expandable
101 And navigation node "c2" should be expandable
102 And navigation node "c3" should be expandable
103 And navigation node "c4" should be expandable
104 And navigation node "c5" should be expandable
105 And navigation node "c6" should be expandable
106 And navigation node "c7" should be expandable
107 And navigation node "c8" should be expandable
108
109 @javascript
110 Scenario: As teacher1 I expand the courses and category nodes to see courses.
111 When I log in as "teacher1"
46a2fbc4
DW
112 And I am on site homepage
113 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
114 And I should see "Courses" in the "Navigation" "block"
115 And I expand "Courses" node
116 And I should see "cat1" in the "Navigation" "block"
117 And I should see "cat2" in the "Navigation" "block"
118 And I should not see "cat3" in the "Navigation" "block"
119 And I expand "cat1" node
120 And I expand "cat2" node
121 And I should see "cat21" in the "Navigation" "block"
122 And I expand "cat21" node
123 And I should see "cat211" in the "Navigation" "block"
124 And I expand "cat211" node
125 Then I should see "c1" in the "Navigation" "block"
126 And I should see "c2" in the "Navigation" "block"
127 And I should see "c3" in the "Navigation" "block"
128 And I should see "c4" in the "Navigation" "block"
129 And I should see "c5" in the "Navigation" "block"
130 And I should not see "c6" in the "Navigation" "block"
131 And I should not see "c7" in the "Navigation" "block"
132 And I should not see "c8" in the "Navigation" "block"
133 And navigation node "c1" should be expandable
134 And navigation node "c2" should be expandable
135 And navigation node "c3" should be expandable
136 And navigation node "c4" should not be expandable
137 And navigation node "c5" should be expandable
138
139 @javascript
140 Scenario: As student1 I expand the courses and category nodes to see courses.
141 When I log in as "student1"
46a2fbc4
DW
142 And I am on site homepage
143 And I should see "Site home" in the "Navigation" "block"
cbd063f4
SH
144 And I should see "Courses" in the "Navigation" "block"
145 And I expand "Courses" node
146 And I should see "cat1" in the "Navigation" "block"
147 And I should see "cat2" in the "Navigation" "block"
148 And I should not see "cat3" in the "Navigation" "block"
149 And I expand "cat1" node
150 And I expand "cat2" node
151 And I should see "cat21" in the "Navigation" "block"
152 And I expand "cat21" node
153 And I should see "cat211" in the "Navigation" "block"
154 And I expand "cat211" node
155 Then I should see "c1" in the "Navigation" "block"
156 And I should see "c2" in the "Navigation" "block"
157 And I should see "c3" in the "Navigation" "block"
158 And I should see "c4" in the "Navigation" "block"
159 And I should not see "c5" in the "Navigation" "block"
160 And I should not see "c6" in the "Navigation" "block"
161 And I should not see "c7" in the "Navigation" "block"
162 And I should not see "c8" in the "Navigation" "block"
163 And navigation node "c1" should be expandable
164 And navigation node "c2" should be expandable
165 And navigation node "c3" should not be expandable
166 And navigation node "c4" should be expandable
167
168 @javascript
169 Scenario: As guest I expand the courses and category nodes to see courses.
170 When I log in as "guest"
46a2fbc4 171 And I am on site homepage
cbd063f4
SH
172 And I should see "Home" in the "Navigation" "block"
173 And I should see "Courses" in the "Navigation" "block"
174 And I expand "Courses" node
175 And I should see "cat1" in the "Navigation" "block"
176 And I should see "cat2" in the "Navigation" "block"
177 And I should not see "cat3" in the "Navigation" "block"
178 And I expand "cat1" node
179 And I expand "cat2" node
180 And I should see "cat21" in the "Navigation" "block"
181 And I expand "cat21" node
182 And I should see "cat211" in the "Navigation" "block"
183 And I expand "cat211" node
184 Then I should see "c1" in the "Navigation" "block"
185 And I should see "c2" in the "Navigation" "block"
186 And I should see "c3" in the "Navigation" "block"
187 And I should see "c4" in the "Navigation" "block"
188 And I should not see "c5" in the "Navigation" "block"
189 And I should not see "c6" in the "Navigation" "block"
190 And I should not see "c7" in the "Navigation" "block"
191 And I should not see "c8" in the "Navigation" "block"
192 And navigation node "c1" should not be expandable
193 And navigation node "c2" should be expandable
194 And navigation node "c3" should not be expandable
46a2fbc4 195 And navigation node "c4" should not be expandable