1 @core_reportbuilder @javascript
2 Feature: Manage custom reports
3 In order to manage custom reports
5 I need to create new and edit existing reports
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:
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 "reportbuilder-table" "table"
24 And I should see "Username" in the "reportbuilder-table" "table"
25 And I should see "Email address" in the "reportbuilder-table" "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 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 "reportbuilder-table" "table"
33 And I should see "User 2" in the "reportbuilder-table" "table"
34 And I should not see "User 1" in the "reportbuilder-table" "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 "reportbuilder-table" table:
51 | Name | Report source | Modified by |
52 | My report | Users | Admin User |
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 "reportbuilder-table" table:
71 | Name | Report source |
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:
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 |
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 And I click on "Save" "button" in the "New report" "dialogue"
96 And I click on "Close 'Manager report' editor" "button"
97 # Manager can edit their own report, but not those of other users.
98 And I set the field "Edit report name" in the "Manager report" "table_row" to "Manager report (renamed)"
99 And I open the action menu in "Manager report (renamed)" "table_row"
100 Then "Edit report content" "link" should be visible
101 And "Edit report name" "link" should not exist in the "My report" "table_row"
102 And ".dropdown-toggle" "css_element" should not exist in the "My report" "table_row"
104 Scenario: Rename custom report
105 Given the following "core_reportbuilder > Reports" exist:
107 | My report | core_user\reportbuilder\datasource\users |
108 And I log in as "admin"
109 When I navigate to "Reports > Report builder > Custom reports" in site administration
110 # Try to set the report name to some blank spaces. It should simply ignore the change.
111 And I set the field "Edit report name" in the "My report" "table_row" to " "
112 And I set the field "Edit report name" in the "My report" "table_row" to "My renamed report"
113 And I reload the page
114 Then the following should exist in the "reportbuilder-table" table:
115 | Name | Report source |
116 | My renamed report | Users |
118 Scenario: Rename custom report using filters
119 Given the "multilang" filter is "on"
120 And the "multilang" filter applies to "content and headings"
121 And the following "core_reportbuilder > Reports" exist:
123 | My report | core_user\reportbuilder\datasource\users |
124 And I log in as "admin"
125 When I navigate to "Reports > Report builder > Custom reports" in site administration
126 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>"
127 And I reload the page
128 Then I should see "English" in the "reportbuilder-table" "table"
129 And I should not see "Spanish" in the "reportbuilder-table" "table"
130 # Confirm report name is correctly shown in action.
131 And I press "Delete report" action in the "English" report row
132 And I should see "Are you sure you want to delete the report 'English' and all associated data?" in the "Delete report" "dialogue"
133 And I click on "Cancel" "button" in the "Delete report" "dialogue"
135 Scenario: Edit custom report from the custom reports page
136 Given the following "core_reportbuilder > Reports" exist:
138 | My report | core_user\reportbuilder\datasource\users |
139 And I log in as "admin"
140 When I navigate to "Reports > Report builder > Custom reports" in site administration
141 When I press "Edit report details" action in the "My report" report row
142 And I set the following fields in the "Edit report details" "dialogue" to these values:
143 | Name | My renamed report |
144 And I click on "Save" "button" in the "Edit report details" "dialogue"
145 Then I should see "Report updated"
146 And the following should exist in the "reportbuilder-table" table:
147 | Name | Report source |
148 | My renamed report | Users |
150 Scenario Outline: Filter custom reports
151 Given the following "core_reportbuilder > Reports" exist:
153 | My users | core_user\reportbuilder\datasource\users |
154 And I log in as "admin"
155 When I navigate to "Reports > Report builder > Custom reports" in site administration
156 And I click on "Filters" "button"
157 And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
158 | <filter> operator | Is equal to |
159 | <filter> value | <value> |
160 And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
161 Then I should see "Filters applied"
162 And I should see "My users" in the "reportbuilder-table" "table"
166 | Report source | Users |
168 Scenario: Delete custom report
169 Given the following "core_reportbuilder > Reports" exist:
171 | My report | core_user\reportbuilder\datasource\users |
172 And I log in as "admin"
173 When I navigate to "Reports > Report builder > Custom reports" in site administration
174 And I press "Delete report" action in the "My report" report row
175 And I click on "Delete" "button" in the "Delete report" "dialogue"
176 Then I should see "Report deleted"
177 And I should see "Nothing to display"
179 Scenario: Switch between Preview and Edit mode
180 Given the following "core_reportbuilder > Reports" exist:
182 | My report | core_user\reportbuilder\datasource\users |
183 And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
184 Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
185 And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
186 And I should not see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
187 And I should see "Full name" in the ".reportbuilder-sidebar-menu" "css_element"
188 Then I click on "Switch to preview mode" "button"
189 Then I should not see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
190 And I should see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
191 And I should see "Filters" in the "[data-region='core_reportbuilder/report-header']" "css_element"
192 Then I click on "Switch to edit mode" "button"
193 Then I should see "Preview" in the "[data-region='core_reportbuilder/report-header']" "css_element"
194 And I should not see "Edit" in the "[data-region='core_reportbuilder/report-header']" "css_element"
196 Scenario: Access report clicking on the report name
197 Given the following "core_reportbuilder > Reports" exist:
199 | My report | core_user\reportbuilder\datasource\users |
200 When I log in as "admin"
201 And I navigate to "Reports > Report builder > Custom reports" in site administration
202 And I click on "My report" "link" in the "My report" "table_row"
203 Then I should see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
204 And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
205 And "button[title='Filters']" "css_element" should not exist in the "[data-region='core_reportbuilder/report']" "css_element"
207 Scenario: Access report clicking on the view icon
208 Given the following "core_reportbuilder > Reports" exist:
210 | My report | core_user\reportbuilder\datasource\users |
211 When I log in as "admin"
212 And I navigate to "Reports > Report builder > Custom reports" in site administration
213 And I press "View" action in the "My report" report row
214 Then I should not see "Preview" in the "[data-region='core_reportbuilder/report']" "css_element"
215 And I should not see "Edit" in the "[data-region='core_reportbuilder/report']" "css_element"
216 And "button[title='Filters']" "css_element" should exist in the "[data-region='core_reportbuilder/report']" "css_element"
218 Scenario: Special characters in report name are shown correctly
219 Given the following "core_reportbuilder > Reports" exist:
221 | My fish & chips report | core_user\reportbuilder\datasource\users |
222 When I log in as "admin"
223 And I navigate to "Reports > Report builder > Custom reports" in site administration
224 And I press "Edit report content" action in the "My fish & chips report" report row
225 Then I should see "My fish & chips report" in the "#region-main .navbar" "css_element"
227 Scenario: Site report limit is observed when creating new reports
228 Given the following config values are set as admin:
229 | customreportslimit | 0 |
230 And the following "core_reportbuilder > Reports" exist:
232 | Report users | core_user\reportbuilder\datasource\users |
233 | Report courses | core_course\reportbuilder\datasource\courses |
234 When I log in as "admin"
235 And I navigate to "Reports > Report builder > Custom reports" in site administration
236 Then "New report" "button" should exist
237 And the following config values are set as admin:
238 | customreportslimit | 2 |
239 And I reload the page
240 And "New report" "button" should not exist
242 Scenario: Disable live editing of custom reports
243 Given the following config values are set as admin:
244 | customreportsliveediting | 0 |
245 And the following "core_reportbuilder > Reports" exist:
247 | Report users | core_user\reportbuilder\datasource\users |
248 When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
249 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"
250 And I click on "Switch to preview mode" "button"
251 And I should see "admin" in the "reportbuilder-table" "table"
252 And I click on "Close 'Report users' editor" "button"
253 And I press "View" action in the "Report users" report row
254 And I should see "admin" in the "reportbuilder-table" "table"
256 Scenario Outline: Download custom report in different formats
257 Given the following "users" exist:
258 | username | firstname | lastname |
261 And the following "core_reportbuilder > Reports" exist:
263 | Report users | core_user\reportbuilder\datasource\users |
264 When I am on the "Report users" "reportbuilder > Editor" page logged in as "admin"
265 And I click on "Switch to preview mode" "button"
266 Then I set the field "Download table data as" to "<format>"
267 And I press "Download"
270 | Comma separated values (.csv) |
271 | Microsoft Excel (.xlsx) |
273 | Javascript Object Notation (.json) |
274 | OpenDocument (.ods) |
275 | Portable Document Format (.pdf) |