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