Commit | Line | Data |
---|---|---|
dd47f210 | 1 | @tool @tool_behat @_only_local |
bedc20aa DM |
2 | Feature: Set up contextual data for tests |
3 | In order to write tests quickly | |
5d7b6307 | 4 | As a developer |
bedc20aa DM |
5 | I need to fill the database with fixtures |
6 | ||
7 | Scenario: Add a bunch of users | |
8 | Given the following "users" exists: | |
9 | | username | password | firstname | lastname | | |
10 | | testuser | testuser | | | | |
11 | | testuser2 | testuser2 | TestFirstname | TestLastname | | |
12 | And I log in as "testuser" | |
13 | And I log out | |
14 | When I log in as "testuser2" | |
15 | Then I should see "TestFirstname" | |
16 | ||
17 | @javascript | |
18 | Scenario: Add a bunch of courses and categories | |
19 | Given the following "categories" exists: | |
20 | | name | category | idnumber | | |
21 | | Cat 1 | 0 | CAT1 | | |
22 | | Cat 2 | CAT1 | CAT2 | | |
23 | | Cat 3 | CAT1 | CAT3 | | |
24 | And the following "courses" exists: | |
25 | | fullname | shortname | category | | |
26 | | Course 1 | COURSE1 | CAT3 | | |
27 | | Course 2 | COURSE2 | CAT3 | | |
28 | | Course 3 | COURSE3 | 0 | | |
29 | When I log in as "admin" | |
30 | Then I should see "Course 1" | |
31 | And I should see "Course 2" | |
32 | And I should see "Course 3" | |
38976081 | 33 | And I go to the courses management page |
4aad6f02 | 34 | And I follow "Cat 1" |
38976081 | 35 | And I should see "Cat 2" |
4aad6f02 | 36 | And I should see "Cat 3" |
38976081 DM |
37 | And I follow "Cat 3" |
38 | And I should see "Course 1" | |
4aad6f02 | 39 | And I should see "Course 2" |
5dc361e1 | 40 | And I follow "Cat 2" |
38976081 | 41 | And I should see "No courses in this category" |
5dc361e1 | 42 | And I follow "Miscellaneous" |
38976081 | 43 | And I should see "Course 3" |
bedc20aa DM |
44 | |
45 | @javascript | |
46 | Scenario: Add a bunch of groups and groupings | |
47 | Given the following "courses" exists: | |
48 | | fullname | shortname | | |
49 | | Course 1 | C1 | | |
50 | And the following "groups" exists: | |
51 | | name | course | idnumber | | |
52 | | Group 1 | C1 | G1 | | |
53 | | Group 2 | C1 | G2 | | |
54 | And the following "groupings" exists: | |
55 | | name | course | idnumber | | |
56 | | Grouping 1 | C1 | GG1 | | |
57 | | Grouping 2 | C1 | GG2 | | |
58 | When I log in as "admin" | |
59 | And I follow "Course 1" | |
60 | And I expand "Users" node | |
61 | And I follow "Groups" | |
62 | Then I should see "Group 1" | |
63 | And I should see "Group 2" | |
64 | And I follow "Groupings" | |
65 | And I should see "Grouping 1" | |
66 | And I should see "Grouping 2" | |
67 | ||
118d53f9 DM |
68 | @javascript |
69 | Scenario: Role overrides | |
70 | Given the following "users" exists: | |
71 | | username | firstname | lastname | email | | |
72 | | teacher1 | Teacher | 1 | teacher1@asd.com | | |
73 | | student1 | Student | 1 | student1@asd.com | | |
74 | And the following "categories" exists: | |
75 | | name | category | idnumber | | |
76 | | Cat 1 | 0 | CAT1 | | |
77 | And the following "courses" exists: | |
78 | | fullname | shortname | | |
79 | | Course 1 | C1 | | |
80 | And the following "course enrolments" exists: | |
81 | | user | course | role | | |
82 | | student1 | C1 | student | | |
83 | | teacher1 | C1 | editingteacher | | |
84 | And the following "permission overrides" exists: | |
85 | | capability | permission | role | contextlevel | reference | | |
86 | | mod/forum:editanypost | Allow | student | Course | C1 | | |
87 | | mod/forum:replynews | Prevent | editingteacher | Course | C1 | | |
88 | When I log in as "admin" | |
89 | And I follow "Course 1" | |
90 | And I expand "Users" node | |
91 | And I follow "Permissions" | |
92 | And I select "Student (1)" from "Advanced role override" | |
93 | Then the "mod/forum:editanypost" field should match "1" value | |
94 | And I press "Cancel" | |
95 | And I select "Teacher (1)" from "Advanced role override" | |
96 | And the "mod/forum:replynews" field should match "-1" value | |
97 | And I press "Cancel" | |
98 | ||
bedc20aa DM |
99 | Scenario: Add course enrolments |
100 | Given the following "users" exists: | |
101 | | username | firstname | lastname | email | | |
102 | | student1 | Student | 1 | student1@asd.com | | |
103 | And the following "courses" exists: | |
104 | | fullname | shortname | format | | |
105 | | Course 1 | C1 | topics | | |
106 | And the following "course enrolments" exists: | |
107 | | user | course | role | | |
108 | | student1 | C1 | student | | |
109 | When I log in as "student1" | |
110 | And I follow "Course 1" | |
111 | Then I should see "Topic 1" | |
112 | ||
72ddc05f DM |
113 | Scenario: Add role assigns |
114 | Given the following "users" exists: | |
115 | | username | firstname | lastname | email | | |
116 | | user1 | User | 1 | user1@moodlemoodle.com | | |
117 | | user2 | User | 2 | user2@moodlemoodle.com | | |
118 | | user3 | User | 3 | user3@moodlemoodle.com | | |
119 | And the following "categories" exists: | |
120 | | name | category | idnumber | | |
121 | | Cat 1 | 0 | CAT1 | | |
122 | And the following "courses" exists: | |
123 | | fullname | shortname | category | | |
124 | | Course 1 | C1 | CAT1 | | |
125 | And the following "role assigns" exists: | |
126 | | user | role | contextlevel | reference | | |
127 | | user1 | manager | System | | | |
128 | | user2 | editingteacher | Category | CAT1 | | |
129 | | user3 | editingteacher | Course | C1 | | |
130 | When I log in as "user1" | |
131 | Then I should see "Front page settings" | |
132 | And I log out | |
133 | And I log in as "user2" | |
134 | And I follow "Course 1" | |
135 | And I should see "Turn editing on" | |
136 | And I log out | |
137 | And I log in as "user3" | |
138 | And I follow "Course 1" | |
139 | And I should see "Turn editing on" | |
140 | ||
a0902967 DM |
141 | Scenario: Add modules |
142 | Given the following "courses" exists: | |
143 | | fullname | shortname | | |
144 | | Course 1 | C1 | | |
145 | And the following "activities" exists: | |
dd47f210 MG |
146 | | activity | name | intro | course | idnumber | |
147 | | assign | Test assignment name | Test assignment description | C1 | assign1 | | |
148 | | assignment | Test assignment22 name | Test assignment22 description | C1 | assignment1 | | |
149 | | book | Test book name | Test book description | C1 | book1 | | |
150 | | chat | Test chat name | Test chat description | C1 | chat1 | | |
151 | | choice | Test choice name | Test choice description | C1 | choice1 | | |
152 | | data | Test database name | Test database description | C1 | data1 | | |
153 | | feedback | Test feedback name | Test feedback description | C1 | feedback1 | | |
154 | | folder | Test folder name | Test folder description | C1 | folder1 | | |
155 | | forum | Test forum name | Test forum description | C1 | forum1 | | |
156 | | glossary | Test glossary name | Test glossary description | C1 | glossary1 | | |
157 | | imscp | Test imscp name | Test imscp description | C1 | imscp1 | | |
158 | | label | Test label name | Test label description | C1 | label1 | | |
159 | | lesson | Test lesson name | Test lesson description | C1 | lesson1 | | |
160 | | lti | Test lti name | Test lti description | C1 | lti1 | | |
161 | | page | Test page name | Test page description | C1 | page1 | | |
162 | | quiz | Test quiz name | Test quiz description | C1 | quiz1 | | |
163 | | resource | Test resource name | Test resource description | C1 | resource1 | | |
164 | | scorm | Test scorm name | Test scorm description | C1 | scorm1 | | |
165 | | survey | Test survey name | Test survey description | C1 | survey1 | | |
166 | | url | Test url name | Test url description | C1 | url1 | | |
167 | | wiki | Test wiki name | Test wiki description | C1 | wiki1 | | |
168 | | workshop | Test workshop name | Test workshop description | C1 | workshop1 | | |
a0902967 DM |
169 | When I log in as "admin" |
170 | And I follow "Course 1" | |
171 | Then I should see "Test assignment name" | |
dd47f210 MG |
172 | # Assignment 2.2 module type is disabled by default |
173 | # And I should see "Test assignment22 name" | |
174 | And I should see "Test book name" | |
175 | And I should see "Test chat name" | |
176 | And I should see "Test choice name" | |
a0902967 | 177 | And I should see "Test database name" |
dd47f210 MG |
178 | # Feedback module type is disabled by default |
179 | # And I should see "Test feedback name" | |
180 | And I should see "Test folder name" | |
181 | And I should see "Test forum name" | |
182 | And I should see "Test glossary name" | |
183 | And I should see "Test imscp name" | |
184 | # We don't see label name, we see only description: | |
185 | And I should see "Test label description" | |
186 | And I should see "Test lesson name" | |
187 | And I should see "Test lti name" | |
188 | And I should see "Test page name" | |
189 | And I should see "Test quiz name" | |
190 | And I should see "Test resource name" | |
191 | And I should see "Test scorm name" | |
192 | And I should see "Test survey name" | |
193 | And I should see "Test url name" | |
194 | And I should see "Test wiki name" | |
195 | And I should see "Test workshop name" | |
a0902967 DM |
196 | And I follow "Test assignment name" |
197 | And I should see "Test assignment description" | |
198 | ||
bedc20aa DM |
199 | @javascript |
200 | Scenario: Add relations between users and groups | |
201 | Given the following "users" exists: | |
202 | | username | firstname | lastname | email | | |
203 | | student1 | Student | 1 | student1@asd.com | | |
204 | | student2 | Student | 2 | student2@asd.com | | |
205 | And the following "courses" exists: | |
206 | | fullname | shortname | | |
207 | | Course 1 | C1 | | |
208 | And the following "groups" exists: | |
209 | | name | course | idnumber | | |
210 | | Group 1 | C1 | G1 | | |
211 | | Group 2 | C1 | G2 | | |
212 | And the following "groupings" exists: | |
213 | | name | course | idnumber | | |
214 | | Grouping 1 | C1 | GG1 | | |
215 | And the following "course enrolments" exists: | |
216 | | user | course | role | | |
217 | | student1 | C1 | student | | |
218 | | student2 | C1 | student | | |
219 | And the following "group members" exists: | |
220 | | user | group | | |
221 | | student1 | G1 | | |
222 | | student2 | G2 | | |
223 | And the following "grouping groups" exists: | |
224 | | grouping | group | | |
225 | | GG1 | G1 | | |
226 | When I log in as "admin" | |
227 | And I follow "Course 1" | |
228 | And I expand "Users" node | |
229 | And I follow "Groups" | |
230 | Then the "groups" select box should contain "Group 1 (1)" | |
231 | And the "groups" select box should contain "Group 2 (1)" | |
232 | And I select "Group 1 (1)" from "groups" | |
bedc20aa DM |
233 | And the "members" select box should contain "Student 1" |
234 | And I select "Group 2 (1)" from "groups" | |
bedc20aa | 235 | And the "members" select box should contain "Student 2" |