Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
@core @core_reportbuilder @javascript
1 efrain 2
Feature: Manage custom reports
3
  In order to manage custom reports
4
  As an admin
5
  I need to create new and edit existing reports
6
 
7
  Scenario: Create custom report with default setup
8
    Given the following "users" exist:
9
      | username  | firstname | lastname | suspended |
10
      | user1     | User      | 1        | 1         |
11
      | user2     | User      | 2        | 0         |
12
    And I log in as "admin"
13
    And I change window size to "large"
14
    When I navigate to "Reports > Report builder > Custom reports" in site administration
15
    And I click on "New report" "button"
16
    And I set the following fields in the "New report" "dialogue" to these values:
17
      | Name                  | My report |
18
      | Report source         | Users     |
19
      | Include default setup | 1         |
20
    And I click on "Save" "button" in the "New report" "dialogue"
21
    Then I should see "My report"
22
    # Confirm we see the default columns in the report.
23
    And I should see "Full name" in the "Users" "table"
24
    And I should see "Username" in the "Users" "table"
25
    And I should see "Email address" in the "Users" "table"
26
    # Confirm we see the default sorting in the report
27
    And "Admin User" "table_row" should appear before "User 2" "table_row"
28
    And I click on "Show/hide 'Sorting'" "button"
29
    And "Disable initial sorting for column 'Full name'" "checkbox" should exist in the "#settingssorting" "css_element"
30
    And I click on "Show/hide 'Sorting'" "button"
31
    # Confirm we only see not suspended users in the report.
32
    And I should see "Admin User" in the "Users" "table"
33
    And I should see "User 2" in the "Users" "table"
34
    And I should not see "User 1" in the "Users" "table"
35
    # Confirm we see the default conditions in the report.
36
    And I click on "Show/hide 'Conditions'" "button"
37
    Then I should see "Full name" in the "[data-region='settings-conditions']" "css_element"
38
    Then I should see "Username" in the "[data-region='settings-conditions']" "css_element"
39
    Then I should see "Email address" in the "[data-region='settings-conditions']" "css_element"
40
    Then I should see "Suspended" in the "[data-region='settings-conditions']" "css_element"
41
    And the following fields in the "Suspended" "core_reportbuilder > Condition" match these values:
42
      | Suspended operator | No |
43
    # Confirm we see the default filters in the report.
44
    And I click on "Switch to preview mode" "button"
45
    And I click on "Filters" "button" in the "[data-region='core_reportbuilder/report-header']" "css_element"
46
    Then I should see "Full name" in the "[data-region='report-filters']" "css_element"
47
    Then I should see "Username" in the "[data-region='report-filters']" "css_element"
48
    Then I should see "Email address" in the "[data-region='report-filters']" "css_element"
49
    And I click on "Close 'My report' editor" "button"
50
    And the following should exist in the "Reports list" table:
51
      | Name      | Report source | Modified by |
52
      | My report | Users         | Admin User  |
53
 
54
  Scenario: Create custom report without default setup
55
    Given I log in as "admin"
56
    When I navigate to "Reports > Report builder > Custom reports" in site administration
57
    And I click on "New report" "button"
58
    And I set the following fields in the "New report" "dialogue" to these values:
59
      | Report source         | Users     |
60
      | Include default setup | 0         |
61
    # Try to set the report name to some blank spaces.
62
    And I set the field "Name" in the "New report" "dialogue" to "   "
63
    And I click on "Save" "button" in the "New report" "dialogue"
64
    And I should see "Required"
65
    And I set the field "Name" in the "New report" "dialogue" to "My report"
66
    And I click on "Save" "button" in the "New report" "dialogue"
67
    Then I should see "My report"
68
    And I should see "Nothing to display"
69
    And I click on "Close 'My report' editor" "button"
70
    And the following should exist in the "Reports list" table:
71
      | Name      | Report source |
72
      | My report | Users         |
73
 
74
  Scenario: Create custom report as a manager
75
    # Create a report that our manager can access, but not edit.
76
    Given the following "core_reportbuilder > Report" exists:
77
      | name    | My report                                |
78
      | source  | core_user\reportbuilder\datasource\users |
79
    And the following "core_reportbuilder > Audience" exists:
80
      | report     | My report                                          |
81
      | classname  | core_reportbuilder\reportbuilder\audience\allusers |
82
      | configdata |                                                    |
83
    And the following "users" exist:
84
      | username  | firstname | lastname |
85
      | manager1  | Manager   | One        |
86
    And the following "role assigns" exist:
87
      | user     | role    | contextlevel   | reference |
88
      | manager1 | manager | System         |           |
89
    And I log in as "manager1"
90
    When I navigate to "Reports > Report builder > Custom reports" in site administration
91
    And I click on "New report" "button"
92
    And I set the following fields in the "New report" "dialogue" to these values:
93
      | Name          | Manager report |
94
      | Report source | Users          |
95
      | Tags          | Cat, Dog       |
96
    And I click on "Save" "button" in the "New report" "dialogue"
97
    And I click on "Close 'Manager report' editor" "button"
98
    And the following should exist in the "Reports list" table:
1441 ariadna 99
      | Name           | Tags    | Report source |
100
      | Manager report | Cat Dog | Users         |
1 efrain 101
    # Manager can edit their own report, but not those of other users.
102
    And I set the field "Edit report name" in the "Manager report" "table_row" to "Manager report (renamed)"
103
    Then the "Edit report content" item should exist in the "Actions" action menu of the "Manager report (renamed)" "table_row"
104
    And "Edit report name" "link" should not exist in the "My report" "table_row"
105
    And "Actions" "actionmenu" should not exist in the "My report" "table_row"
106
 
107
  Scenario: Rename custom report
108
    Given the following "core_reportbuilder > Reports" exist:
109
      | name      | source                                   |
110
      | My report | core_user\reportbuilder\datasource\users |
111
    And I log in as "admin"
112
    When I navigate to "Reports > Report builder > Custom reports" in site administration
113
    # Try to set the report name to some blank spaces. It should simply ignore the change.
114
    And I set the field "Edit report name" in the "My report" "table_row" to "   "
115
    And I set the field "Edit report name" in the "My report" "table_row" to "My renamed report"
116
    And I reload the page
117
    Then the following should exist in the "Reports list" table:
118
      | Name              | Report source |
119
      | My renamed report | Users         |
120
 
121
  Scenario: Rename custom report using filters
122
    Given the "multilang" filter is "on"
123
    And the "multilang" filter applies to "content and headings"
124
    And the following "core_reportbuilder > Reports" exist:
125
      | name      | source                                   |
126
      | My report | core_user\reportbuilder\datasource\users |
127
    And I log in as "admin"
128
    When I navigate to "Reports > Report builder > Custom reports" in site administration
129
    And I set the field "Edit report name" in the "My report" "table_row" to "<span class=\"multilang\" lang=\"en\">English</span><span class=\"multilang\" lang=\"es\">Spanish</span>"
130
    And I reload the page
131
    Then I should see "English" in the "Reports list" "table"
132
    And I should not see "Spanish" in the "Reports list" "table"
133
    # Confirm report name is correctly shown in action.
134
    And I press "Delete report" action in the "English" report row
135
    And I should see "Are you sure you want to delete the report 'English' and all associated data?" in the "Delete report" "dialogue"
136
    And I click on "Cancel" "button" in the "Delete report" "dialogue"
137
 
138
  Scenario: Edit custom report from the custom reports page
139
    Given the following "core_reportbuilder > Reports" exist:
140
      | name      | source                                   |
141
      | My report | core_user\reportbuilder\datasource\users |
142
    And I log in as "admin"
143
    When I navigate to "Reports > Report builder > Custom reports" in site administration
144
    When I press "Edit report details" action in the "My report" report row
145
    And I set the following fields in the "Edit report details" "dialogue" to these values:
146
      | Name | My renamed report |
147
      | Tags | Cat, Dog          |
148
    And I click on "Save" "button" in the "Edit report details" "dialogue"
149
    Then I should see "Report updated"
150
    And the following should exist in the "Reports list" table:
1441 ariadna 151
      | Name              | Tags    | Report source |
152
      | My renamed report | Cat Dog | Users         |
1 efrain 153
 
154
  Scenario Outline: Filter custom reports
155
    Given the following "core_reportbuilder > Reports" exist:
156
      | name       | source                                       | tags     |
157
      | My users   | core_user\reportbuilder\datasource\users     | Cat, Dog |
158
      | My courses | core_course\reportbuilder\datasource\courses |          |
159
    And I log in as "admin"
160
    When I navigate to "Reports > Report builder > Custom reports" in site administration
1441 ariadna 161
    And the following should exist in the "Reports list" table:
162
      | Name       | Tags    | Report source |
163
      | My users   | Cat Dog | Users         |
164
      | My courses |         | Courses       |
1 efrain 165
    And I click on "Filters" "button"
166
    And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
167
      | <filter> operator | Is equal to |
168
      | <filter> value    | <value>     |
169
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
170
    Then I should see "Filters applied"
171
    And the following should exist in the "Reports list" table:
1441 ariadna 172
      | Name     | Tags    | Report source |
173
      | My users | Cat Dog | Users         |
1 efrain 174
    And I should not see "My courses" in the "Reports list" "table"
175
    Examples:
176
      | filter        | value    |
177
      | Name          | My users |
178
      | Report source | Users    |
179
      | Tags          | Cat      |
180
 
1441 ariadna 181
  Scenario: Filter custom reports by user
182
    Given the following "users" exist:
183
      | username  | firstname | lastname |
184
      | user1     | User      | 1        |
185
    And the following "core_reportbuilder > Report" exists:
186
      | name    | My report                                |
187
      | source  | core_user\reportbuilder\datasource\users |
188
    And I log in as "admin"
189
    When I navigate to "Reports > Report builder > Custom reports" in site administration
190
    And I click on "Filters" "button"
191
    And I set the following fields in the "Modified by" "core_reportbuilder > Filter" to these values:
192
      | Modified by operator | Select     |
193
      | Modified by value    | Admin User |
194
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
195
    Then I should see "Filters applied"
196
    And I should see "My report" in the "Reports list" "table"
197
    And I set the field "Modified by value" in the "Modified by" "core_reportbuilder > Filter" to "User 1"
198
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
199
    And I should see "Nothing to display"
200
    And "Reports list" "table" should not exist
201
 
202
  Scenario Outline: Filter custom reports by date
203
    Given the following "core_reportbuilder > Report" exists:
204
      | name    | My report                                |
205
      | source  | core_user\reportbuilder\datasource\users |
206
    And I log in as "admin"
207
    When I navigate to "Reports > Report builder > Custom reports" in site administration
208
    And I click on "Filters" "button"
209
    And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
210
      | <filter> operator | Range          |
211
      | <filter> from     | ##2 days ago## |
212
      | <filter> to       | ##tomorrow##   |
213
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
214
    Then I should see "Filters applied"
215
    And I should see "My report" in the "Reports list" "table"
216
    And I set the field "<filter> to" in the "<filter>" "core_reportbuilder > Filter" to "##yesterday##"
217
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
218
    And I should see "Nothing to display"
219
    And "Reports list" "table" should not exist
220
    Examples:
221
      | filter        |
222
      | Time created  |
223
      | Time modified |
224
 
225
  Scenario: Filter custom reports by schedule presence
226
    Given the following "core_reportbuilder > Reports" exist:
227
      | name       | source                                       |
228
      | My users   | core_user\reportbuilder\datasource\users     |
229
      | My courses | core_course\reportbuilder\datasource\courses |
230
    And the following "core_reportbuilder > Schedules" exist:
231
      | report   | name        |
232
      | My users | My schedule |
233
    And I log in as "admin"
234
    When I navigate to "Reports > Report builder > Custom reports" in site administration
235
    And I click on "Filters" "button"
236
    And I set the field "Schedules operator" in the "Schedules" "core_reportbuilder > Filter" to "Yes"
237
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
238
    Then I should see "Filters applied"
239
    And I should see "My users" in the "Reports list" "table"
240
    And I should not see "My courses" in the "Reports list" "table"
241
    And I set the field "Schedules operator" in the "Schedules" "core_reportbuilder > Filter" to "No"
242
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
243
    And I should see "My courses" in the "Reports list" "table"
244
    And I should not see "My users" in the "Reports list" "table"
245
 
246
  Scenario: Reset filters in system report
247
    Given the following "core_reportbuilder > Report" exists:
248
      | name    | My report                                |
249
      | source  | core_user\reportbuilder\datasource\users |
250
    And I log in as "admin"
251
    When I navigate to "Reports > Report builder > Custom reports" in site administration
252
    And I click on "Filters" "button"
253
    And I set the following fields in the "Name" "core_reportbuilder > Filter" to these values:
254
      | Name operator | Contains |
255
      | Name value    | Lionel   |
256
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
257
    And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
258
    And I should see "Nothing to display"
259
    And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
260
    And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
261
    And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
262
    And "[data-region='report-filters']" "css_element" should be visible
263
    Then I should see "Filters reset"
264
    And the following fields in the "Name" "core_reportbuilder > Filter" match these values:
265
      | Name operator | Is any value |
266
    And I should see "My report" in the "Reports list" "table"
267
 
1 efrain 268
  Scenario: Custom report tags are not displayed if tagging is disabled
269
    Given the following config values are set as admin:
270
      | usetags | 0 |
271
    And the following "core_reportbuilder > Reports" exist:
272
      | name      | source                                   |
273
      | My report | core_user\reportbuilder\datasource\users |
274
    And I log in as "admin"
275
    When I navigate to "Reports > Report builder > Custom reports" in site administration
276
    Then the following should exist in the "Reports list" table:
277
      | Name      | Report source |
278
      | My report | Users         |
279
    And "Tags" "link" should not exist in the "Reports list" "table"
280
    And I click on "Filters" "button"
281
    And "Tags" "core_reportbuilder > Filter" should not exist
282
 
1441 ariadna 283
  Scenario: Duplicate custom report
284
    Given the following "users" exist:
285
      | username  | firstname | lastname | email             | suspended |
286
      | user1     | User      | 1        | user1@example.com | 1         |
287
      | user2     | User      | 2        | user2@example.com | 0         |
288
    And the following "custom field categories" exist:
289
      | name   | component          | area   | itemid |
290
      | Newcat | core_reportbuilder | report | 0      |
291
    And the following "custom fields" exist:
292
      | name        | category | type     | shortname | description | configdata |
293
      | Myshorttext | Newcat   | text     | f1        | d1          |            |
294
    And the following "core_reportbuilder > Report" exists:
295
      | name           | My report                                |
296
      | source         | core_user\reportbuilder\datasource\users |
297
      | default        | 1                                        |
298
      | customfield_f1 | My short text                            |
299
    And the following "core_reportbuilder > Audience" exists:
300
      | report     | My report                                          |
301
      | classname  | core_reportbuilder\reportbuilder\audience\allusers |
302
      | configdata |                                                    |
303
    And the following "core_reportbuilder > Schedule" exists:
304
      | report | My report   |
305
      | name   | My schedule |
306
    When I log in as "admin"
307
    And I navigate to "Reports > Report builder > Custom reports" in site administration
308
    And I press "Duplicate report" action in the "My report" report row
309
    And I set the following fields in the "Duplicate report" "dialogue" to these values:
310
      | Name                | My duplicated report |
311
      | Duplicate audiences | 1                    |
312
      | Duplicate schedules | 1                    |
313
    And I click on "Save" "button" in the "Duplicate report" "dialogue"
314
    Then I should see "My duplicated report"
315
    # Confirm we see the same columns in the report.
316
    And I should see "Full name" in the "Users" "table"
317
    And I should see "Username" in the "Users" "table"
318
    And I should see "Email address" in the "Users" "table"
319
    # Confirm we only see not suspended users in the report.
320
    And I should see "Admin User" in the "Users" "table"
321
    And I should see "User 2" in the "Users" "table"
322
    And I should not see "User 1" in the "Users" "table"
323
    And I click on the "Audience" dynamic tab
324
    And "All users" "core_reportbuilder > Audience" should exist
325
    And I click on the "Schedules" dynamic tab
326
    And I should see "My schedule" in the "Report schedules" "table"
327
    And I press "Edit details"
328
    And the field "Myshorttext" matches value "My short text"
329
 
1 efrain 330
  Scenario: Delete custom report
331
    Given the following "core_reportbuilder > Reports" exist:
332
      | name      | source                                   |
333
      | My report | core_user\reportbuilder\datasource\users |
334
    And I log in as "admin"
335
    When I navigate to "Reports > Report builder > Custom reports" in site administration
336
    And I press "Delete report" action in the "My report" report row
337
    And I click on "Delete" "button" in the "Delete report" "dialogue"
338
    Then I should see "Report deleted"
339
    And I should see "Nothing to display"
340
 
341
  Scenario: Switch between Preview and Edit mode
342
    Given the following "core_reportbuilder > Reports" exist:
343
      | name      | source                                   |
344
      | My report | core_user\reportbuilder\datasource\users |
345
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
346
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
347
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
348
    And I should not see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
349
    And I should see "Full name" in the ".reportbuilder-sidebar-menu" "css_element"
350
    Then I click on "Switch to preview mode" "button"
351
    Then I should not see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
352
    And I should see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
353
    And I should see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
354
    Then I click on "Switch to edit mode" "button"
355
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
356
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
357
 
358
  Scenario: Access report clicking on the report name
359
    Given the following "core_reportbuilder > Reports" exist:
360
      | name      | source                                   |
361
      | My report | core_user\reportbuilder\datasource\users |
362
    When I log in as "admin"
363
    And I navigate to "Reports > Report builder > Custom reports" in site administration
364
    And I click on "My report" "link" in the "My report" "table_row"
365
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
366
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
367
    And "button[title='Filters']" "css_element" should not exist in the "[data-region='core_reportbuilder/report']" "css_element"
368
 
369
  Scenario: Access report clicking on the view icon
370
    Given the following "core_reportbuilder > Reports" exist:
371
      | name      | source                                   |
372
      | My report | core_user\reportbuilder\datasource\users |
373
    When I log in as "admin"
374
    And I navigate to "Reports > Report builder > Custom reports" in site administration
375
    And I press "View" action in the "My report" report row
376
    Then I should not see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
377
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
378
    And "button[title='Filters']" "css_element" should exist in the "[data-region='core_reportbuilder/report']" "css_element"
379
 
380
  Scenario: Special characters in report name are shown correctly
381
    Given the following "core_reportbuilder > Reports" exist:
382
      | name                    | source                                   |
383
      | My fish & chips report  | core_user\reportbuilder\datasource\users |
384
    When I log in as "admin"
385
    And I navigate to "Reports > Report builder > Custom reports" in site administration
386
    And I press "Edit report content" action in the "My fish & chips report" report row
387
    Then I should see "My fish & chips report" in the "#region-main .navbar" "css_element"
388
 
389
  Scenario: Site report limit is observed when creating new reports
390
    Given the following config values are set as admin:
391
      | customreportslimit     | 0 |
392
    And the following "core_reportbuilder > Reports" exist:
393
      | name           | source                                       |
394
      | Report users   | core_user\reportbuilder\datasource\users     |
395
      | Report courses | core_course\reportbuilder\datasource\courses |
396
    When I log in as "admin"
397
    And I navigate to "Reports > Report builder > Custom reports" in site administration
398
    Then "New report" "button" should exist
399
    And the following config values are set as admin:
400
      | customreportslimit     | 2 |
401
    And I reload the page
402
    And "New report" "button" should not exist
403
 
404
  Scenario: Disable live editing of custom reports
405
    Given the following config values are set as admin:
406
      | customreportsliveediting     | 0 |
407
    And the following "core_reportbuilder > Reports" exist:
408
      | name           | source                                       |
409
      | Report users   | core_user\reportbuilder\datasource\users     |
410
    When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
411
    Then I should see "Viewing of report data while editing is disabled by the site administrator. Switch to preview mode to view the report." in the "[data-region='core_table/dynamic']" "css_element"
412
    And I click on "Switch to preview mode" "button"
413
    And I should see "admin" in the "Users" "table"
414
    And I click on "Close 'Report users' editor" "button"
415
    And I press "View" action in the "Report users" report row
416
    And I should see "admin" in the "Users" "table"
417
 
418
  Scenario Outline: Download custom report in different formats
419
    Given the following "users" exist:
420
      | username  | firstname | lastname |
421
      | user1     | User      | 1        |
422
      | user2     | User      | 2        |
423
    And the following "core_reportbuilder > Reports" exist:
424
      | name           | source                                       |
425
      | Report users   | core_user\reportbuilder\datasource\users     |
426
    When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
427
    And I click on "Switch to preview mode" "button"
428
    Then I set the field "Download table data as" to "<format>"
429
    And I press "Download"
430
    Examples:
431
      | format                             |
432
      | Comma separated values (.csv)      |
433
      | Microsoft Excel (.xlsx)            |
434
      | HTML table                         |
435
      | Javascript Object Notation (.json) |
436
      | OpenDocument (.ods)                |
437
      | Portable Document Format (.pdf)    |