Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_behat @javascript
2
Feature: Set up contextual data for tests
3
  In order to write tests quickly
4
  As a developer
5
  I need to fill the database with fixtures
6
 
7
  Scenario: Add a bunch of users
8
    Given the following "users" exist:
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
  Scenario: Add a bunch of courses and categories
18
    Given the following "categories" exist:
19
      | name | category | idnumber |
20
      | Cat 1 | 0 | CAT1 |
21
      | Cat 2 | CAT1 | CAT2 |
22
      | Cat 3 | CAT1 | CAT3 |
23
    And the following "courses" exist:
24
      | fullname | shortname | category |
25
      | Course 1 | COURSE1 | CAT3 |
26
      | Course 2 | COURSE2 | CAT3 |
27
      | Course 3 | COURSE3 | 0 |
28
    When I log in as "admin"
29
    And I am on site homepage
30
    Then I should see "Course 1"
31
    And I should see "Course 2"
32
    And I should see "Course 3"
33
    And I go to the courses management page
34
    And I follow "Cat 1"
35
    And I should see "Cat 2"
36
    And I should see "Cat 3"
37
    And I follow "Cat 3"
38
    And I should see "Course 1"
39
    And I should see "Course 2"
40
    And I follow "Cat 2"
41
    And I should see "No courses in this category"
42
    And I follow "Category 1"
43
    And I should see "Course 3"
44
 
45
  Scenario: Add a bunch of groups and groupings
46
    Given the following "courses" exist:
47
      | fullname | shortname |
48
      | Course 1 | C1 |
49
    And the following "groups" exist:
50
      | name | course | idnumber |
51
      | Group 1 | C1 | G1 |
52
      | Group 2 | C1 | G2 |
53
    And the following "groupings" exist:
54
      | name | course | idnumber |
55
      | Grouping 1 | C1 | GG1 |
56
      | Grouping 2 | C1 | GG2 |
57
    When I log in as "admin"
58
    And I am on the "Course 1" "groups" page
59
    Then I should see "Group 1"
60
    And I should see "Group 2"
61
    And I set the field "Participants tertiary navigation" to "Groupings"
62
    And I should see "Grouping 1"
63
    And I should see "Grouping 2"
64
 
65
  Scenario: Role overrides
66
    Given the following "users" exist:
67
      | username | firstname | lastname | email |
68
      | teacher1 | Teacher | 1 | teacher1@example.com |
69
      | student1 | Student | 1 | student1@example.com |
70
    And the following "categories" exist:
71
      | name | category | idnumber |
72
      | Cat 1 | 0 | CAT1 |
73
    And the following "courses" exist:
74
      | fullname | shortname |
75
      | Course 1 | C1 |
76
    And the following "course enrolments" exist:
77
      | user | course | role |
78
      | student1 | C1 | student |
79
      | teacher1 | C1 | editingteacher |
80
    And the following "permission overrides" exist:
81
      | capability | permission | role | contextlevel | reference |
82
      | mod/forum:editanypost | Allow | student | Course | C1 |
83
      | mod/forum:replynews | Prevent | editingteacher | Course | C1 |
84
    When I log in as "admin"
85
    And I am on the "Course 1" "permissions" page
86
    And I set the field "Advanced role override" to "Student (1)"
87
    Then "mod/forum:editanypost" capability has "Allow" permission
88
    And I press "Cancel"
89
    And I set the field "Advanced role override" to "Teacher (1)"
90
    And "mod/forum:replynews" capability has "Prevent" permission
91
    And I press "Cancel"
92
 
93
  Scenario: Add course enrolments
94
    Given the following "users" exist:
95
      | username | firstname | lastname | email |
96
      | student1 | Student | 1 | student1@example.com |
97
    And the following "courses" exist:
98
      | fullname | shortname | format |
99
      | Course 1 | C1 | topics |
100
    And the following "course enrolments" exist:
101
      | user | course | role |
102
      | student1 | C1 | student |
103
    When I am on the "Course 1" course page logged in as student1
104
    Then I should see "New section"
105
 
106
  Scenario: Add role assigns
107
    Given the following "roles" exist:
108
      | name                   | shortname | description      | archetype      |
109
      | Custom editing teacher | custom1   | My custom role 1 | editingteacher |
110
      | Custom student         | custom2   |                  |                |
111
    And the following "users" exist:
112
      | username | firstname | lastname | email |
113
      | user1 | User | 1 | user1@example.com |
114
      | user2 | User | 2 | user2@example.com |
115
      | user3 | User | 3 | user3@example.com |
116
      | user4 | User | 4 | user4@example.com |
117
      | user5 | User | 5 | user5@example.com |
118
    And the following "categories" exist:
119
      | name | category | idnumber |
120
      | Cat 1 | 0 | CAT1 |
121
    And the following "courses" exist:
122
      | fullname | shortname | category |
123
      | Course 1 | C1 | CAT1 |
124
    And the following "course enrolments" exist:
125
      | user | course | role |
126
      | user4 | C1 | custom1 |
127
      | user2 | C1 | student |
128
      | user3 | C1 | editingteacher |
129
    And the following "role assigns" exist:
130
      | user  | role           | contextlevel | reference |
131
      | user1 | manager        | System       |           |
132
      | user2 | editingteacher | Category     | CAT1      |
133
      | user5 | custom2        | System       |           |
134
    When I log in as "user1"
135
    And I am on site homepage
136
    Then edit mode should be available on the current page
137
    And I am on the "Course 1" course page logged in as user2
138
    Then edit mode should be available on the current page
139
    And I am on the "Course 1" course page logged in as user3
140
    Then edit mode should be available on the current page
141
    And I am on the "Course 1" course page logged in as user4
142
    Then edit mode should be available on the current page
143
    And I log out
144
    And I log in as "user5"
145
    And I should see "You are logged in as"
146
    And I am on "Course 1" course homepage
147
    And I should see "You cannot enrol yourself in this course."
148
 
149
  Scenario: Add modules
150
    Given the following "courses" exist:
151
      | fullname | shortname |
152
      | Course 1 | C1 |
153
    And I enable "chat" "mod" plugin
154
    And I enable "survey" "mod" plugin
155
    And the following "activities" exist:
156
      | activity   | name                   | intro                         | course | idnumber    |
157
      | assign     | Test assignment name   | Test assignment description   | C1     | assign1     |
158
      | book       | Test book name         | Test book description         | C1     | book1       |
159
      | chat       | Test chat name         | Test chat description         | C1     | chat1       |
160
      | choice     | Test choice name       | Test choice description       | C1     | choice1     |
161
      | data       | Test database name     | Test database description     | C1     | data1       |
162
      | feedback   | Test feedback name     | Test feedback description     | C1     | feedback1   |
163
      | folder     | Test folder name       | Test folder description       | C1     | folder1     |
164
      | forum      | Test forum name        | Test forum description        | C1     | forum1      |
165
      | glossary   | Test glossary name     | Test glossary description     | C1     | glossary1   |
166
      | imscp      | Test imscp name        | Test imscp description        | C1     | imscp1      |
167
      | label      | Test label name        | Test label description        | C1     | label1      |
168
      | lesson     | Test lesson name       | Test lesson description       | C1     | lesson1     |
169
      | lti        | Test lti name          | Test lti description          | C1     | lti1        |
170
      | page       | Test page name         | Test page description         | C1     | page1       |
171
      | quiz       | Test quiz name         | Test quiz description         | C1     | quiz1       |
172
      | resource   | Test resource name     | Test resource description     | C1     | resource1   |
173
      | scorm      | Test scorm name        | Test scorm description        | C1     | scorm1      |
174
      | survey     | Test survey name       | Test survey description       | C1     | survey1     |
175
      | url        | Test url name          | Test url description          | C1     | url1        |
176
      | wiki       | Test wiki name         | Test wiki description         | C1     | wiki1       |
177
      | workshop   | Test workshop name     | Test workshop description     | C1     | workshop1   |
178
    And the following "scales" exist:
179
      | name | scale |
180
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
181
    And the following "activities" exist:
182
      | activity   | name                            | intro                         | course | idnumber    | grade |
183
      | assign     | Test assignment name with scale | Test assignment description   | C1     | assign1     | Test Scale 1 |
184
    When I am on the "Course 1" course page logged in as admin
185
    Then I should see "Test assignment name"
186
    # Assignment 2.2 module type is disabled by default
187
    # And I should see "Test assignment22 name"
188
    And I should see "Test book name"
189
    And I should see "Test chat name"
190
    And I should see "Test choice name"
191
    And I should see "Test database name"
192
    # Feedback module type is disabled by default
193
    # And I should see "Test feedback name"
194
    And I should see "Test folder name"
195
    And I should see "Test forum name"
196
    And I should see "Test glossary name"
197
    And I should see "Test imscp name"
198
    # We don't see label name, we see only description:
199
    And I should see "Test label description"
200
    And I should see "Test lesson name"
201
    And I should see "Test lti name"
202
    And I should see "Test page name"
203
    And I should see "Test quiz name"
204
    And I should see "Test resource name"
205
    And I should see "Test scorm name"
206
    And I should see "Test survey name"
207
    And I should see "Test url name"
208
    And I should see "Test wiki name"
209
    And I should see "Test workshop name"
210
    And I follow "Test assignment name"
211
    And I should see "Test assignment description"
212
    And I am on "Course 1" course homepage
213
    And I follow "Test assignment name with scale"
214
    And I follow "Settings"
215
    And the field "Type" matches value "Scale"
216
 
217
  Scenario: Add relations between users and groups
218
    Given the following "users" exist:
219
      | username | firstname | lastname | email |
220
      | student1 | Student | 1 | student1@example.com |
221
      | student2 | Student | 2 | student2@example.com |
222
    And the following "courses" exist:
223
      | fullname | shortname |
224
      | Course 1 | C1 |
225
    And the following "groups" exist:
226
      | name | course | idnumber |
227
      | Group 1 | C1 | G1 |
228
      | Group 2 | C1 | G2 |
229
    And the following "groupings" exist:
230
      | name | course | idnumber |
231
      | Grouping 1 | C1 | GG1 |
232
    And the following "course enrolments" exist:
233
      | user | course | role |
234
      | student1 | C1 | student |
235
      | student2 | C1 | student |
236
    And the following "group members" exist:
237
      | user | group |
238
      | student1 | G1 |
239
      | student2 | G2 |
240
    And the following "grouping groups" exist:
241
      | grouping | group |
242
      | GG1 | G1 |
243
    When I log in as "admin"
244
    And I am on the "Course 1" "groups" page
245
    Then the "groups" select box should contain "Group 1 (1)"
246
    And the "groups" select box should contain "Group 2 (1)"
247
    And I set the field "groups" to "Group 1 (1)"
248
    And the "members" select box should contain "Student 1 (student1@example.com)"
249
    And I set the field "groups" to "Group 2 (1)"
250
    And the "members" select box should contain "Student 2 (student2@example.com)"
251
 
252
  Scenario: Add cohorts and cohort members with data generator
253
    Given the following "categories" exist:
254
      | name  | category | idnumber |
255
      | Cat 1 | 0        | CAT1     |
256
    And the following "users" exist:
257
      | username | firstname | lastname | email |
258
      | student1 | Student | 1 | student1@example.com |
259
      | student2 | Student | 2 | student2@example.com |
260
    And the following "cohorts" exist:
261
      | name            | idnumber |
262
      | System cohort A | CHSA     |
263
    And the following "cohorts" exist:
264
      | name                 | idnumber | contextlevel | reference |
265
      | System cohort B      | CHSB     | System       |           |
266
      | Cohort in category   | CHC      | Category     | CAT1      |
267
      | Empty cohort         | CHE      | Category     | CAT1      |
268
    And the following "cohort members" exist:
269
      | user     | cohort |
270
      | student1 | CHSA   |
271
      | student2 | CHSB   |
272
      | student1 | CHSB   |
273
      | student1 | CHC    |
274
    When I log in as "admin"
275
    And I navigate to "Users > Accounts > Cohorts" in site administration
276
    Then the following should exist in the "reportbuilder-table" table:
277
      | Name            | Cohort size |
278
      | System cohort A | 1           |
279
      | System cohort B | 2           |
280
    And I should not see "Cohort in category"
281
    And I am on course index
282
    And I follow "Cat 1"
283
    And I navigate to "Cohorts" in current page administration
284
    And I should not see "System cohort"
285
    And the following should exist in the "reportbuilder-table" table:
286
      | Name               | Cohort size |
287
      | Cohort in category | 1           |
288
      | Empty cohort       | 0           |
289
 
290
  Scenario: Add grade categories with data generator
291
    Given the following "courses" exist:
292
      | fullname | shortname |
293
      | Course 1 | C1 |
294
    And the following "grade categories" exist:
295
      | fullname | course |
296
      | Grade category 1 | C1 |
297
    And the following "grade categories" exist:
298
      | fullname | course | gradecategory |
299
      | Grade sub category 2 | C1 | Grade category 1 |
300
    When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
301
    Then I should see "Grade category 1"
302
    And I should see "Grade sub category 2"
303
 
304
  Scenario: Add a bunch of grade items
305
    Given the following "courses" exist:
306
      | fullname | shortname |
307
      | Course 1 | C1 |
308
    And the following "grade categories" exist:
309
      | fullname | course |
310
      | Grade category 1 | C1 |
311
    And the following "grade categories" exist:
312
      | fullname | course | gradecategory |
313
      | Grade sub category 2 | C1 | Grade category 1 |
314
    And the following "grade items" exist:
315
      | itemname    | course |
316
      | Test Grade Item 1 | C1 |
317
    And the following "grade items" exist:
318
      | itemname    | course | gradecategory |
319
      | Test Grade Item 2 | C1 | Grade category 1 |
320
      | Test Grade Item 3 | C1 | Grade sub category 2 |
321
    When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
322
    Then I should see "Test Grade Item 1"
323
    And I click on grade item menu "Test Grade Item 1" of type "gradeitem" on "setup" page
324
    And I choose "Edit grade item" in the open action menu
325
    And I expand all fieldsets
326
    And I should see "Course 1"
327
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
328
    And I should see "Grade category 1"
329
    And I should see "Test Grade Item 2"
330
    And I click on grade item menu "Test Grade Item 2" of type "gradeitem" on "setup" page
331
    And I choose "Edit grade item" in the open action menu
332
    And I expand all fieldsets
333
    And I should see "Grade category 1"
334
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
335
    And I should see "Grade sub category 2"
336
    And I should see "Test Grade Item 3"
337
    And I click on grade item menu "Test Grade Item 3" of type "gradeitem" on "setup" page
338
    And I choose "Edit grade item" in the open action menu
339
    And I expand all fieldsets
340
    And I should see "Grade sub category 2"
341
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
342
 
343
  Scenario: Add a bunch of scales
344
    Given the following "courses" exist:
345
      | fullname | shortname |
346
      | Course 1 | C1 |
347
    And the following "scales" exist:
348
      | name | scale |
349
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
350
    When I am on the "Course 1" "grades > scales" page logged in as admin
351
    Then I should see "Test Scale 1"
352
    And I should see "Disappointing,  Good,  Very good,  Excellent"
353
 
354
  Scenario: Add a bunch of outcomes
355
    Given the following "courses" exist:
356
      | fullname | shortname |
357
      | Course 1 | C1        |
358
    And the following "scales" exist:
359
      | name | scale |
360
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
361
    And the following "grade outcomes" exist:
362
      | fullname        | shortname | scale        |
363
      | Grade outcome 1 | OT1       | Test Scale 1 |
364
    And the following "grade outcomes" exist:
365
      | fullname        | shortname | course | scale        |
366
      | Grade outcome 2 | OT2       | C1     | Test Scale 1 |
367
    And the following config values are set as admin:
368
      | enableoutcomes | 1 |
369
    When I am on the "Course 1" "grades > outcomes" page logged in as admin
370
    Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
371
    And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
372
    And I press "Manage outcomes"
373
    And the following should exist in the "generaltable" table:
374
      | Full name       | Short name | Scale        |
375
      | Grade outcome 2 | OT2        | Test Scale 1 |
376
 
377
  Scenario: Add a bunch of outcome grade items
378
    Given the following "courses" exist:
379
      | fullname | shortname |
380
      | Course 1 | C1        |
381
    And the following "scales" exist:
382
      | name         | scale                                     |
383
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
384
    And the following "grade outcomes" exist:
385
      | fullname        | shortname | course | scale        |
386
      | Grade outcome 1 | OT1       | C1     | Test Scale 1 |
387
    And the following "grade categories" exist:
388
      | fullname         | course |
389
      | Grade category 1 | C1     |
390
    And the following "grade items" exist:
391
      | itemname                  | course | outcome | gradecategory    |
392
      | Test Outcome Grade Item 1 | C1     | OT1     | Grade category 1 |
393
    And the following config values are set as admin:
394
      | enableoutcomes | 1 |
395
    When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
396
    Then I should see "Test Outcome Grade Item 1"
397
    And I click on grade item menu "Test Outcome Grade Item 1" of type "gradeitem" on "setup" page
398
    And I choose "Edit grade item" in the open action menu
399
    And I click on "Show more..." "link" in the "Edit outcome item" "dialogue"
400
    And the field "Outcome" matches value "Grade outcome 1"
401
    And I should see "Grade category 1" in the "Grade category" "form_row"
402
    And I press "Cancel"
403
 
404
  Scenario: Add a block
405
    Given the following "courses" exist:
406
      | fullname | shortname |
407
      | Course 1 | C1        |
408
    And the following "blocks" exist:
409
      | blockname    | contextlevel | reference | pagetypepattern | defaultregion |
410
      | online_users | Course       | C1        | course-view-*   | site-pre      |
411
    When I am on the "Course 1" course page logged in as admin
412
    Then I should see "Online users"