Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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 the following "activities" exist:
154
      | activity   | name                   | intro                         | course | idnumber    |
155
      | assign     | Test assignment name   | Test assignment description   | C1     | assign1     |
156
      | book       | Test book name         | Test book description         | C1     | book1       |
157
      | choice     | Test choice name       | Test choice description       | C1     | choice1     |
158
      | data       | Test database name     | Test database description     | C1     | data1       |
159
      | feedback   | Test feedback name     | Test feedback description     | C1     | feedback1   |
160
      | folder     | Test folder name       | Test folder description       | C1     | folder1     |
161
      | forum      | Test forum name        | Test forum description        | C1     | forum1      |
162
      | glossary   | Test glossary name     | Test glossary description     | C1     | glossary1   |
163
      | imscp      | Test imscp name        | Test imscp description        | C1     | imscp1      |
164
      | label      | Test label name        | Test label description        | C1     | label1      |
165
      | lesson     | Test lesson name       | Test lesson description       | C1     | lesson1     |
166
      | lti        | Test lti name          | Test lti description          | C1     | lti1        |
167
      | page       | Test page name         | Test page description         | C1     | page1       |
168
      | quiz       | Test quiz name         | Test quiz description         | C1     | quiz1       |
169
      | resource   | Test resource name     | Test resource description     | C1     | resource1   |
170
      | scorm      | Test scorm name        | Test scorm description        | C1     | scorm1      |
171
      | url        | Test url name          | Test url description          | C1     | url1        |
172
      | wiki       | Test wiki name         | Test wiki description         | C1     | wiki1       |
173
      | workshop   | Test workshop name     | Test workshop description     | C1     | workshop1   |
174
    And the following "scales" exist:
175
      | name | scale |
176
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
177
    And the following "activities" exist:
178
      | activity   | name                            | intro                         | course | idnumber    | grade |
179
      | assign     | Test assignment name with scale | Test assignment description   | C1     | assign1     | Test Scale 1 |
180
    When I am on the "Course 1" course page logged in as admin
181
    Then I should see "Test assignment name"
182
    # Assignment 2.2 module type is disabled by default
183
    # And I should see "Test assignment22 name"
184
    And I should see "Test book name"
185
    And I should see "Test choice name"
186
    And I should see "Test database name"
187
    # Feedback module type is disabled by default
188
    # And I should see "Test feedback name"
189
    And I should see "Test folder name"
190
    And I should see "Test forum name"
191
    And I should see "Test glossary name"
192
    And I should see "Test imscp name"
193
    # We don't see label name, we see only description:
194
    And I should see "Test label description"
195
    And I should see "Test lesson name"
196
    And I should see "Test lti name"
197
    And I should see "Test page name"
198
    And I should see "Test quiz name"
199
    And I should see "Test resource name"
200
    And I should see "Test scorm name"
201
    And I should see "Test url name"
202
    And I should see "Test wiki name"
203
    And I should see "Test workshop name"
204
    And I follow "Test assignment name"
205
    And I should see "Test assignment description"
206
    And I am on "Course 1" course homepage
207
    And I follow "Test assignment name with scale"
208
    And I follow "Settings"
209
    And the field "Type" matches value "Scale"
210
 
211
  Scenario: Add relations between users and groups
212
    Given the following "users" exist:
213
      | username | firstname | lastname | email |
214
      | student1 | Student | 1 | student1@example.com |
215
      | student2 | Student | 2 | student2@example.com |
216
    And the following "courses" exist:
217
      | fullname | shortname |
218
      | Course 1 | C1 |
219
    And the following "groups" exist:
220
      | name | course | idnumber |
221
      | Group 1 | C1 | G1 |
222
      | Group 2 | C1 | G2 |
223
    And the following "groupings" exist:
224
      | name | course | idnumber |
225
      | Grouping 1 | C1 | GG1 |
226
    And the following "course enrolments" exist:
227
      | user | course | role |
228
      | student1 | C1 | student |
229
      | student2 | C1 | student |
230
    And the following "group members" exist:
231
      | user | group |
232
      | student1 | G1 |
233
      | student2 | G2 |
234
    And the following "grouping groups" exist:
235
      | grouping | group |
236
      | GG1 | G1 |
237
    When I log in as "admin"
238
    And I am on the "Course 1" "groups" page
239
    Then the "groups" select box should contain "Group 1 (1)"
240
    And the "groups" select box should contain "Group 2 (1)"
241
    And I set the field "groups" to "Group 1 (1)"
242
    And the "members" select box should contain "Student 1 (student1@example.com)"
243
    And I set the field "groups" to "Group 2 (1)"
244
    And the "members" select box should contain "Student 2 (student2@example.com)"
245
 
246
  Scenario: Add cohorts and cohort members with data generator
247
    Given the following "categories" exist:
248
      | name  | category | idnumber |
249
      | Cat 1 | 0        | CAT1     |
250
    And the following "users" exist:
251
      | username | firstname | lastname | email |
252
      | student1 | Student | 1 | student1@example.com |
253
      | student2 | Student | 2 | student2@example.com |
254
    And the following "cohorts" exist:
255
      | name            | idnumber |
256
      | System cohort A | CHSA     |
257
    And the following "cohorts" exist:
258
      | name                 | idnumber | contextlevel | reference |
259
      | System cohort B      | CHSB     | System       |           |
260
      | Cohort in category   | CHC      | Category     | CAT1      |
261
      | Empty cohort         | CHE      | Category     | CAT1      |
262
    And the following "cohort members" exist:
263
      | user     | cohort |
264
      | student1 | CHSA   |
265
      | student2 | CHSB   |
266
      | student1 | CHSB   |
267
      | student1 | CHC    |
268
    When I log in as "admin"
269
    And I navigate to "Users > Accounts > Cohorts" in site administration
270
    Then the following should exist in the "reportbuilder-table" table:
271
      | Name            | Cohort size |
272
      | System cohort A | 1           |
273
      | System cohort B | 2           |
274
    And I should not see "Cohort in category"
275
    And I am on course index
276
    And I follow "Cat 1"
277
    And I navigate to "Cohorts" in current page administration
278
    And I should not see "System cohort"
279
    And the following should exist in the "reportbuilder-table" table:
280
      | Name               | Cohort size |
281
      | Cohort in category | 1           |
282
      | Empty cohort       | 0           |
283
 
284
  Scenario: Add grade categories with data generator
285
    Given the following "courses" exist:
286
      | fullname | shortname |
287
      | Course 1 | C1 |
288
    And the following "grade categories" exist:
289
      | fullname | course |
290
      | Grade category 1 | C1 |
291
    And the following "grade categories" exist:
292
      | fullname | course | gradecategory |
293
      | Grade sub category 2 | C1 | Grade category 1 |
294
    When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
295
    Then I should see "Grade category 1"
296
    And I should see "Grade sub category 2"
297
 
298
  Scenario: Add a bunch of grade items
299
    Given the following "courses" exist:
300
      | fullname | shortname |
301
      | Course 1 | C1 |
302
    And the following "grade categories" exist:
303
      | fullname | course |
304
      | Grade category 1 | C1 |
305
    And the following "grade categories" exist:
306
      | fullname | course | gradecategory |
307
      | Grade sub category 2 | C1 | Grade category 1 |
308
    And the following "grade items" exist:
309
      | itemname    | course |
310
      | Test Grade Item 1 | C1 |
311
    And the following "grade items" exist:
312
      | itemname    | course | gradecategory |
313
      | Test Grade Item 2 | C1 | Grade category 1 |
314
      | Test Grade Item 3 | C1 | Grade sub category 2 |
315
    When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
316
    Then I should see "Test Grade Item 1"
317
    And I click on grade item menu "Test Grade Item 1" of type "gradeitem" on "setup" page
318
    And I choose "Edit grade item" in the open action menu
319
    And I expand all fieldsets
320
    And I should see "Course 1"
321
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
322
    And I should see "Grade category 1"
323
    And I should see "Test Grade Item 2"
324
    And I click on grade item menu "Test Grade Item 2" of type "gradeitem" on "setup" page
325
    And I choose "Edit grade item" in the open action menu
326
    And I expand all fieldsets
327
    And I should see "Grade category 1"
328
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
329
    And I should see "Grade sub category 2"
330
    And I should see "Test Grade Item 3"
331
    And I click on grade item menu "Test Grade Item 3" of type "gradeitem" on "setup" page
332
    And I choose "Edit grade item" in the open action menu
333
    And I expand all fieldsets
334
    And I should see "Grade sub category 2"
335
    And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
336
 
337
  Scenario: Add a bunch of scales
338
    Given the following "courses" exist:
339
      | fullname | shortname |
340
      | Course 1 | C1 |
341
    And the following "scales" exist:
342
      | name | scale |
343
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
344
    When I am on the "Course 1" "grades > scales" page logged in as admin
345
    Then I should see "Test Scale 1"
346
    And I should see "Disappointing,  Good,  Very good,  Excellent"
347
 
348
  Scenario: Add a bunch of outcomes
349
    Given the following "courses" exist:
350
      | fullname | shortname |
351
      | Course 1 | C1        |
352
    And the following "scales" exist:
353
      | name | scale |
354
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
355
    And the following "grade outcomes" exist:
356
      | fullname        | shortname | scale        |
357
      | Grade outcome 1 | OT1       | Test Scale 1 |
358
    And the following "grade outcomes" exist:
359
      | fullname        | shortname | course | scale        |
360
      | Grade outcome 2 | OT2       | C1     | Test Scale 1 |
361
    And the following config values are set as admin:
362
      | enableoutcomes | 1 |
363
    When I am on the "Course 1" "grades > outcomes" page logged in as admin
364
    Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
365
    And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
366
    And I press "Manage outcomes"
367
    And the following should exist in the "generaltable" table:
368
      | Full name       | Short name | Scale        |
369
      | Grade outcome 2 | OT2        | Test Scale 1 |
370
 
371
  Scenario: Add a bunch of outcome grade items
372
    Given the following "courses" exist:
373
      | fullname | shortname |
374
      | Course 1 | C1        |
375
    And the following "scales" exist:
376
      | name         | scale                                     |
377
      | Test Scale 1 | Disappointing, Good, Very good, Excellent |
378
    And the following "grade outcomes" exist:
379
      | fullname        | shortname | course | scale        |
380
      | Grade outcome 1 | OT1       | C1     | Test Scale 1 |
381
    And the following "grade categories" exist:
382
      | fullname         | course |
383
      | Grade category 1 | C1     |
384
    And the following "grade items" exist:
385
      | itemname                  | course | outcome | gradecategory    |
386
      | Test Outcome Grade Item 1 | C1     | OT1     | Grade category 1 |
387
    And the following config values are set as admin:
388
      | enableoutcomes | 1 |
389
    When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
390
    Then I should see "Test Outcome Grade Item 1"
391
    And I click on grade item menu "Test Outcome Grade Item 1" of type "gradeitem" on "setup" page
392
    And I choose "Edit grade item" in the open action menu
393
    And I click on "Show more..." "link" in the "Edit outcome item" "dialogue"
394
    And the field "Outcome" matches value "Grade outcome 1"
395
    And I should see "Grade category 1" in the "Grade category" "form_row"
396
    And I press "Cancel"
397
 
398
  Scenario: Add a block
399
    Given the following "courses" exist:
400
      | fullname | shortname |
401
      | Course 1 | C1        |
402
    And the following "blocks" exist:
403
      | blockname    | contextlevel | reference | pagetypepattern | defaultregion |
404
      | online_users | Course       | C1        | course-view-*   | site-pre      |
405
    When I am on the "Course 1" course page logged in as admin
406
    Then I should see "Online users"