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
@core_reportbuilder @javascript
2
Feature: Manage custom report filters
3
  In order to manage the filters of custom reports
4
  As an admin
5
  I need to add, edit and delete filters in a report
6
 
7
  Scenario: Add filter to report
8
    Given the following "core_reportbuilder > Reports" exist:
9
      | name      | source                                   | default |
10
      | My report | core_user\reportbuilder\datasource\users | 0       |
11
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
12
    When I click on "Show/hide 'Filters'" "button"
13
    Then I should see "There are no filters selected" in the "[data-region='active-filters']" "css_element"
14
    And I set the field "Select a filter" to "Email address"
15
    And I should see "Added filter 'Email address'"
16
    And I should not see "There are no filters selected" in the "[data-region='active-filters']" "css_element"
17
    And I should see "Email address" in the "[data-region='active-filters']" "css_element"
18
 
19
  Scenario: Rename filter in report
20
    Given the following "core_reportbuilder > Reports" exist:
21
      | name      | source                                   | default |
22
      | My report | core_user\reportbuilder\datasource\users | 0       |
23
    And the following "core_reportbuilder > Filters" exist:
24
      | report    | uniqueidentifier |
25
      | My report | user:email       |
26
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
27
    And I click on "Show/hide 'Filters'" "button"
28
    When I set the field "Rename filter 'Email address'" to "My Email filter"
29
    And I reload the page
30
    And I click on "Show/hide 'Filters'" "button"
31
    Then I should see "My Email filter" in the "[data-region='active-filters']" "css_element"
32
 
33
  Scenario: Rename filter in report using filters
34
    Given the "multilang" filter is "on"
35
    And the "multilang" filter applies to "content and headings"
36
    And the following "core_reportbuilder > Reports" exist:
37
      | name      | source                                   | default |
38
      | My report | core_user\reportbuilder\datasource\users | 0       |
39
    And the following "core_reportbuilder > Filters" exist:
40
      | report    | uniqueidentifier |
41
      | My report | user:email       |
42
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
43
    And I click on "Show/hide 'Filters'" "button"
44
    When I set the field "Rename filter 'Email address'" to "<span class=\"multilang\" lang=\"en\">English</span><span class=\"multilang\" lang=\"es\">Spanish</span>"
45
    And I reload the page
46
    And I click on "Show/hide 'Filters'" "button"
47
    Then I should see "English" in the "[data-region='active-filters']" "css_element"
48
    And I should not see "Spanish" in the "[data-region='active-filters']" "css_element"
49
 
50
  Scenario: Rename filter in report using special characters
51
    Given the following "core_reportbuilder > Reports" exist:
52
      | name      | source                                   | default |
53
      | My report | core_user\reportbuilder\datasource\users | 0       |
54
    And the following "core_reportbuilder > Filters" exist:
55
      | report    | uniqueidentifier |
56
      | My report | user:email       |
57
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
58
    And I click on "Show/hide 'Filters'" "button"
59
    When I set the field "Rename filter 'Email address'" to "Fish & Chips"
60
    And I click on "Switch to preview mode" "button"
61
    And I click on "Filters" "button"
62
    Then I should see "Fish & Chips" in the "[data-region='report-filters']" "css_element"
63
 
64
  Scenario: Move filter in report
65
    Given the following "core_reportbuilder > Reports" exist:
66
      | name      | source                                   | default |
67
      | My report | core_user\reportbuilder\datasource\users | 0       |
68
    And the following "core_reportbuilder > Filters" exist:
69
      | report    | uniqueidentifier |
70
      | My report | user:fullname    |
71
      | My report | user:email       |
72
      | My report | user:country     |
73
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
74
    When I click on "Show/hide 'Filters'" "button"
75
    And I click on "Move filter 'Country'" "button"
76
    And I click on "After \"Full name\"" "link" in the "Move filter 'Country'" "dialogue"
77
    Then I should see "Moved filter 'Country'"
78
    And "Country" "text" should appear before "Email address" "text"
79
 
80
  Scenario: Delete filter from report
81
    Given the following "core_reportbuilder > Reports" exist:
82
      | name      | source                                   | default |
83
      | My report | core_user\reportbuilder\datasource\users | 0       |
84
    And the following "core_reportbuilder > Filters" exist:
85
      | report    | uniqueidentifier |
86
      | My report | user:email       |
87
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
88
    And I click on "Show/hide 'Filters'" "button"
89
    And I click on "Delete filter 'Email address'" "button"
90
    And I click on "Delete" "button" in the "Delete filter 'Email address'" "dialogue"
91
    Then I should see "Deleted filter 'Email address'"
92
    And I should see "There are no filters selected" in the "[data-region='active-filters']" "css_element"
93
    And I should not see "Email address" in the "[data-region='active-filters']" "css_element"
94
 
1441 ariadna 95
  Scenario: Reset filters in custom report
1 efrain 96
    Given the following "core_reportbuilder > Reports" exist:
97
      | name      | source                                   |
98
      | My report | core_user\reportbuilder\datasource\users |
99
    And I am on the "My report" "reportbuilder > View" page logged in as "admin"
100
    When I click on "Filters" "button"
101
    And I set the following fields in the "Full name" "core_reportbuilder > Filter" to these values:
102
      | Full name operator | Contains |
103
      | Full name value    | Lionel   |
104
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
1441 ariadna 105
    And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
1 efrain 106
    And I should see "Nothing to display"
107
    And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
1441 ariadna 108
    And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
109
    And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
110
    And "[data-region='report-filters']" "css_element" should be visible
1 efrain 111
    Then I should see "Filters reset"
112
    And the following fields in the "Full name" "core_reportbuilder > Filter" match these values:
113
      | Full name operator | Is any value |
1441 ariadna 114
    And I should see "Admin User" in the "Users" "table"
1 efrain 115
 
116
  Scenario: Use report filters when previewing report
117
    Given the following "users" exist:
118
      | username  | firstname | lastname |
119
      | user1     | User      | 1        |
120
      | user2     | User      | 2        |
121
      | user3     | User      | 3        |
122
    And the following "core_reportbuilder > Reports" exist:
123
      | name      | source                                   | default |
124
      | My report | core_user\reportbuilder\datasource\users | 0       |
125
    And the following "core_reportbuilder > Columns" exist:
126
      | report    | uniqueidentifier  |
127
      | My report | user:fullname     |
128
      | My report | user:email        |
129
    And the following "core_reportbuilder > Filters" exist:
130
      | report    | uniqueidentifier |
131
      | My report | user:fullname    |
132
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
133
    And I change window size to "large"
134
    And I should see "user1@example.com" in the ".reportbuilder-table" "css_element"
135
    And I should see "user2@example.com" in the ".reportbuilder-table" "css_element"
136
    And I should see "user3@example.com" in the ".reportbuilder-table" "css_element"
137
    When I click on "Switch to preview mode" "button"
138
    And I click on "Filters" "button"
139
    And I set the following fields in the "Full name" "core_reportbuilder > Filter" to these values:
140
      | Full name operator | Does not contain |
141
      | Full name value    | User 2           |
142
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
143
    Then I should see "Filters applied"
144
    And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
145
    And the following should exist in the "reportbuilder-table" table:
146
      | Full name | Email address     |
147
      | User 1    | user1@example.com |
148
      | User 3    | user3@example.com |
149
    And the following should not exist in the "reportbuilder-table" table:
150
      | Full name | Email address     |
151
      | User 2    | user2@example.com |
152
    # Switching back to edit mode should not apply filters.
153
    And I click on "Switch to edit mode" "button"
154
    And I should see "user1@example.com" in the ".reportbuilder-table" "css_element"
155
    And I should see "user2@example.com" in the ".reportbuilder-table" "css_element"
156
    And I should see "user3@example.com" in the ".reportbuilder-table" "css_element"
157
 
158
  Scenario: Use report filters when previewing report that contains same condition
159
    Given the following "users" exist:
160
      | username  | firstname | lastname |
161
      | user1     | User   | 1        |
162
      | user2     | User   | 2        |
163
      | user3     | User   | 3        |
164
    And the following "core_reportbuilder > Reports" exist:
165
      | name      | source                                   | default |
166
      | My report | core_user\reportbuilder\datasource\users | 0       |
167
    And the following "core_reportbuilder > Columns" exist:
168
      | report    | uniqueidentifier  |
169
      | My report | user:fullname     |
170
      | My report | user:email        |
171
    And the following "core_reportbuilder > Condition" exists:
172
      | report           | My report  |
173
      | uniqueidentifier | user:email |
174
    And the following "core_reportbuilder > Filter" exists:
175
      | report           | My report  |
176
      | uniqueidentifier | user:email |
177
    And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
178
    And I change window size to "large"
179
    And I should see "user1@example.com" in the ".reportbuilder-table" "css_element"
180
    And I should see "user2@example.com" in the ".reportbuilder-table" "css_element"
181
    And I should see "user3@example.com" in the ".reportbuilder-table" "css_element"
182
    # Set a condition to the report.
183
    When I click on "Show/hide 'Conditions'" "button"
184
    And I set the following fields in the "Email address" "core_reportbuilder > Condition" to these values:
185
      | Email address operator | Is not equal to   |
186
      | Email address value    | user3@example.com |
187
    And I click on "Apply" "button" in the "#settingsconditions" "css_element"
188
    And I click on "Switch to preview mode" "button"
189
    And I click on "Filters" "button"
190
    And I set the following fields in the "Email address" "core_reportbuilder > Filter" to these values:
191
      | Email address operator | Is not equal to   |
192
      | Email address value    | user2@example.com |
193
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
194
    Then I should see "Filters applied"
195
    And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
196
    # Assert we haven't overridden the condition and user3 is still not showing in the report.
197
    And the following should exist in the "reportbuilder-table" table:
198
      | Full name | Email address     |
199
      | User 1    | user1@example.com |
200
    And the following should not exist in the "reportbuilder-table" table:
201
      | Full name | Email address     |
202
      | User 2    | user2@example.com |
203
      | User 3    | user3@example.com |