1 |
efrain |
1 |
@core_reportbuilder @javascript
|
|
|
2 |
Feature: Manage custom report columns sorting
|
|
|
3 |
In order to manage the sorting for columns of custom reports
|
|
|
4 |
As an admin
|
|
|
5 |
I need to be able to enable/disable, change sort direction and reorder sorting for columns
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "core_reportbuilder > Reports" exist:
|
|
|
9 |
| name | source | default |
|
|
|
10 |
| My report | core_user\reportbuilder\datasource\users | 0 |
|
|
|
11 |
And the following "core_reportbuilder > Columns" exist:
|
|
|
12 |
| report | uniqueidentifier |
|
|
|
13 |
| My report | user:username |
|
|
|
14 |
| My report | user:lastname |
|
|
|
15 |
| My report | user:firstname |
|
|
|
16 |
And the following "users" exist:
|
|
|
17 |
| username | firstname | lastname | email |
|
|
|
18 |
| user01 | Alice | Zebra | user01@example.com |
|
|
|
19 |
| user02 | Zoe | Aardvark | user02@example.com |
|
|
|
20 |
| user03 | Alice | Badger | user03@example.com |
|
|
|
21 |
And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
|
|
|
22 |
|
|
|
23 |
Scenario: Toggle column sorting in report
|
|
|
24 |
Given I change window size to "large"
|
|
|
25 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
26 |
# This will be the fallback sort after toggling lastname sorting.
|
|
|
27 |
And I click on "Enable initial sorting for column 'First name'" "checkbox"
|
|
|
28 |
When I click on "Enable initial sorting for column 'Last name'" "checkbox"
|
|
|
29 |
Then I should see "Updated sorting for column 'Last name'"
|
|
|
30 |
And "user02" "table_row" should appear before "user01" "table_row"
|
|
|
31 |
And I click on "Disable initial sorting for column 'Last name'" "checkbox"
|
|
|
32 |
And I should see "Updated sorting for column 'Last name'"
|
|
|
33 |
And "user01" "table_row" should appear before "user02" "table_row"
|
|
|
34 |
|
|
|
35 |
Scenario: Change column sort direction in report
|
|
|
36 |
Given I change window size to "large"
|
|
|
37 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
38 |
When I click on "Enable initial sorting for column 'Last name'" "checkbox"
|
|
|
39 |
And I click on "Sort column 'Last name' descending" "button"
|
|
|
40 |
Then I should see "Updated sorting for column 'Last name'"
|
|
|
41 |
And "user01" "table_row" should appear before "user02" "table_row"
|
|
|
42 |
And I click on "Sort column 'Last name' ascending" "button"
|
|
|
43 |
And I should see "Updated sorting for column 'Last name'"
|
|
|
44 |
And "user02" "table_row" should appear before "user01" "table_row"
|
|
|
45 |
|
|
|
46 |
Scenario: Change column sort order in report
|
|
|
47 |
Given I change window size to "large"
|
|
|
48 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
49 |
When I click on "Enable initial sorting for column 'Last name'" "checkbox"
|
|
|
50 |
And I click on "Enable initial sorting for column 'First name'" "checkbox"
|
|
|
51 |
And I click on "Move sorting for column 'First name'" "button"
|
|
|
52 |
And I click on "To the top of the list" "link" in the "Move sorting for column 'First name'" "dialogue"
|
|
|
53 |
Then I should see "Updated sorting for column 'First name'"
|
|
|
54 |
And "First name" "text" should appear before "Last name" "text" in the "#settingssorting" "css_element"
|
|
|
55 |
And "user01" "table_row" should appear before "user02" "table_row"
|
|
|
56 |
|
|
|
57 |
Scenario: Change column sorting for column sorted by multiple fields
|
|
|
58 |
Given I change window size to "large"
|
|
|
59 |
And I click on "Add column 'Full name'" "link"
|
|
|
60 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
61 |
When I click on "Enable initial sorting for column 'Full name'" "checkbox"
|
|
|
62 |
Then I should see "Updated sorting for column 'Full name'"
|
|
|
63 |
# User1 = Alice Zebra; User2=Zoe Aardvark; User3 = Alice Badger.
|
|
|
64 |
And "user03" "table_row" should appear before "user01" "table_row"
|
|
|
65 |
And "user01" "table_row" should appear before "user02" "table_row"
|
|
|
66 |
And I click on "Sort column 'Full name' descending" "button"
|
|
|
67 |
And I should see "Updated sorting for column 'Full name'"
|
|
|
68 |
And "user02" "table_row" should appear before "user01" "table_row"
|
|
|
69 |
And "user01" "table_row" should appear before "user03" "table_row"
|
|
|
70 |
|
|
|
71 |
Scenario: Configured report sorting is always applied when editing
|
|
|
72 |
Given I change window size to "large"
|
|
|
73 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
74 |
# Sort by last name descending.
|
|
|
75 |
When I click on "Enable initial sorting for column 'Last name'" "checkbox"
|
|
|
76 |
Then "user02" "table_row" should appear before "user01" "table_row"
|
|
|
77 |
# Switching to preview mode should observe report config.
|
|
|
78 |
And I click on "Switch to preview mode" "button"
|
|
|
79 |
And "user02" "table_row" should appear before "user01" "table_row"
|
|
|
80 |
# Custom sorting for the user.
|
|
|
81 |
And I click on "Sort by First name Ascending" "link"
|
|
|
82 |
And "user01" "table_row" should appear before "user02" "table_row"
|
|
|
83 |
# Switching back to edit mode should observe report config.
|
|
|
84 |
And I click on "Switch to edit mode" "button"
|
|
|
85 |
And "user02" "table_row" should appear before "user01" "table_row"
|
|
|
86 |
|
|
|
87 |
Scenario: Sortable columns are updated when column is added to report
|
|
|
88 |
Given I change window size to "large"
|
|
|
89 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
90 |
When I click on "Add column 'Full name'" "link"
|
|
|
91 |
Then I should see "Full name" in the "#settingssorting" "css_element"
|
|
|
92 |
|
|
|
93 |
Scenario: Sortable columns are updated when column is deleted from report
|
|
|
94 |
Given I change window size to "large"
|
|
|
95 |
And I click on "Show/hide 'Sorting'" "button"
|
|
|
96 |
When I click on "Delete column 'Username'" "button"
|
|
|
97 |
And I click on "Delete" "button" in the "Delete column 'Username'" "dialogue"
|
|
|
98 |
Then I should not see "Username" in the "#settingssorting" "css_element"
|