Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core_reportbuilder @javascript
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:
99
      | Name           | Tags     | Report source |
100
      | Manager report | Cat, Dog | Users         |
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:
151
      | Name              | Tags     | Report source |
152
      | My renamed report | Cat, Dog | Users         |
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
161
    And I click on "Filters" "button"
162
    And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
163
      | <filter> operator | Is equal to |
164
      | <filter> value    | <value>     |
165
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
166
    Then I should see "Filters applied"
167
    And the following should exist in the "Reports list" table:
168
      | Name     | Tags     | Report source |
169
      | My users | Cat, Dog | Users         |
170
    And I should not see "My courses" in the "Reports list" "table"
171
    Examples:
172
      | filter        | value    |
173
      | Name          | My users |
174
      | Report source | Users    |
175
      | Tags          | Cat      |
176
 
177
  Scenario: Custom report tags are not displayed if tagging is disabled
178
    Given the following config values are set as admin:
179
      | usetags | 0 |
180
    And the following "core_reportbuilder > Reports" exist:
181
      | name      | source                                   |
182
      | My report | core_user\reportbuilder\datasource\users |
183
    And I log in as "admin"
184
    When I navigate to "Reports > Report builder > Custom reports" in site administration
185
    Then the following should exist in the "Reports list" table:
186
      | Name      | Report source |
187
      | My report | Users         |
188
    And "Tags" "link" should not exist in the "Reports list" "table"
189
    And I click on "Filters" "button"
190
    And "Tags" "core_reportbuilder > Filter" should not exist
191
 
192
  Scenario: Delete custom report
193
    Given the following "core_reportbuilder > Reports" exist:
194
      | name      | source                                   |
195
      | My report | core_user\reportbuilder\datasource\users |
196
    And I log in as "admin"
197
    When I navigate to "Reports > Report builder > Custom reports" in site administration
198
    And I press "Delete report" action in the "My report" report row
199
    And I click on "Delete" "button" in the "Delete report" "dialogue"
200
    Then I should see "Report deleted"
201
    And I should see "Nothing to display"
202
 
203
  Scenario: Switch between Preview and Edit mode
204
    Given the following "core_reportbuilder > Reports" exist:
205
      | name      | source                                   |
206
      | My report | core_user\reportbuilder\datasource\users |
207
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
208
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
209
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
210
    And I should not see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
211
    And I should see "Full name" in the ".reportbuilder-sidebar-menu" "css_element"
212
    Then I click on "Switch to preview mode" "button"
213
    Then I should not see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
214
    And I should see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
215
    And I should see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
216
    Then I click on "Switch to edit mode" "button"
217
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
218
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
219
 
220
  Scenario: Access report clicking on the report name
221
    Given the following "core_reportbuilder > Reports" exist:
222
      | name      | source                                   |
223
      | My report | core_user\reportbuilder\datasource\users |
224
    When I log in as "admin"
225
    And I navigate to "Reports > Report builder > Custom reports" in site administration
226
    And I click on "My report" "link" in the "My report" "table_row"
227
    Then I should see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
228
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
229
    And "button[title='Filters']" "css_element" should not exist in the "[data-region='core_reportbuilder/report']" "css_element"
230
 
231
  Scenario: Access report clicking on the view icon
232
    Given the following "core_reportbuilder > Reports" exist:
233
      | name      | source                                   |
234
      | My report | core_user\reportbuilder\datasource\users |
235
    When I log in as "admin"
236
    And I navigate to "Reports > Report builder > Custom reports" in site administration
237
    And I press "View" action in the "My report" report row
238
    Then I should not see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
239
    And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
240
    And "button[title='Filters']" "css_element" should exist in the "[data-region='core_reportbuilder/report']" "css_element"
241
 
242
  Scenario: Special characters in report name are shown correctly
243
    Given the following "core_reportbuilder > Reports" exist:
244
      | name                    | source                                   |
245
      | My fish & chips report  | core_user\reportbuilder\datasource\users |
246
    When I log in as "admin"
247
    And I navigate to "Reports > Report builder > Custom reports" in site administration
248
    And I press "Edit report content" action in the "My fish & chips report" report row
249
    Then I should see "My fish & chips report" in the "#region-main .navbar" "css_element"
250
 
251
  Scenario: Site report limit is observed when creating new reports
252
    Given the following config values are set as admin:
253
      | customreportslimit     | 0 |
254
    And the following "core_reportbuilder > Reports" exist:
255
      | name           | source                                       |
256
      | Report users   | core_user\reportbuilder\datasource\users     |
257
      | Report courses | core_course\reportbuilder\datasource\courses |
258
    When I log in as "admin"
259
    And I navigate to "Reports > Report builder > Custom reports" in site administration
260
    Then "New report" "button" should exist
261
    And the following config values are set as admin:
262
      | customreportslimit     | 2 |
263
    And I reload the page
264
    And "New report" "button" should not exist
265
 
266
  Scenario: Disable live editing of custom reports
267
    Given the following config values are set as admin:
268
      | customreportsliveediting     | 0 |
269
    And the following "core_reportbuilder > Reports" exist:
270
      | name           | source                                       |
271
      | Report users   | core_user\reportbuilder\datasource\users     |
272
    When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
273
    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"
274
    And I click on "Switch to preview mode" "button"
275
    And I should see "admin" in the "Users" "table"
276
    And I click on "Close 'Report users' editor" "button"
277
    And I press "View" action in the "Report users" report row
278
    And I should see "admin" in the "Users" "table"
279
 
280
  Scenario Outline: Download custom report in different formats
281
    Given the following "users" exist:
282
      | username  | firstname | lastname |
283
      | user1     | User      | 1        |
284
      | user2     | User      | 2        |
285
    And the following "core_reportbuilder > Reports" exist:
286
      | name           | source                                       |
287
      | Report users   | core_user\reportbuilder\datasource\users     |
288
    When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
289
    And I click on "Switch to preview mode" "button"
290
    Then I set the field "Download table data as" to "<format>"
291
    And I press "Download"
292
    Examples:
293
      | format                             |
294
      | Comma separated values (.csv)      |
295
      | Microsoft Excel (.xlsx)            |
296
      | HTML table                         |
297
      | Javascript Object Notation (.json) |
298
      | OpenDocument (.ods)                |
299
      | Portable Document Format (.pdf)    |