Files
moodle/reportbuilder/tests/behat/columnsortingeditor.feature
T
2021-10-19 13:56:05 +01:00

73 lines
3.8 KiB
Gherkin

@core_reportbuilder @javascript
Feature: Manage custom report columns sorting
In order to manage the sorting for columns of custom reports
As an admin
I need to be able to enable/disable, change sort direction and reorder sorting for columns
Background:
Given the following "core_reportbuilder > Reports" exist:
| name | source | default |
| My report | core_user\reportbuilder\datasource\users | 0 |
And the following "core_reportbuilder > Columns" exist:
| report | uniqueidentifier |
| My report | user:username |
| My report | user:lastname |
| My report | user:firstname |
And the following "users" exist:
| username | firstname | lastname | email |
| user01 | Alice | Zebra | user01@example.com |
| user02 | Zoe | Aardvark | user02@example.com |
And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
Scenario: Toggle column sorting in report
Given I click on "Show/hide settings sidebar" "button"
And I change window size to "large"
And I click on "Show/hide 'Sorting'" "button"
# This will be the fallback sort after toggling lastname sorting.
And I click on "Enable sorting for column 'First name'" "checkbox"
When I click on "Enable sorting for column 'Surname'" "checkbox"
Then I should see "Updated sorting for column 'Surname'"
And "user02" "table_row" should appear before "user01" "table_row"
And I click on "Disable sorting for column 'Surname'" "checkbox"
And I should see "Updated sorting for column 'Surname'"
And "user01" "table_row" should appear before "user02" "table_row"
Scenario: Change column sort direction in report
Given I click on "Show/hide settings sidebar" "button"
And I change window size to "large"
And I click on "Show/hide 'Sorting'" "button"
When I click on "Enable sorting for column 'Surname'" "checkbox"
And I click on "Sort column 'Surname' descending" "button"
Then I should see "Updated sorting for column 'Surname'"
And "user01" "table_row" should appear before "user02" "table_row"
And I click on "Sort column 'Surname' ascending" "button"
And I should see "Updated sorting for column 'Surname'"
And "user02" "table_row" should appear before "user01" "table_row"
Scenario: Change column sort order in report
Given I click on "Show/hide settings sidebar" "button"
And I change window size to "large"
And I click on "Show/hide 'Sorting'" "button"
When I click on "Enable sorting for column 'Surname'" "checkbox"
And I click on "Enable sorting for column 'First name'" "checkbox"
And I click on "Move sorting for column 'First name'" "button"
And I click on "To the top of the list" "link" in the "Move sorting for column 'First name'" "dialogue"
Then I should see "Updated sorting for column 'First name'"
And "First name" "text" should appear before "Surname" "text" in the "#settingssorting" "css_element"
And "user01" "table_row" should appear before "user02" "table_row"
Scenario: Sortable columns are updated when column is added to report
Given I click on "Show/hide settings sidebar" "button"
And I change window size to "large"
And I click on "Show/hide 'Sorting'" "button"
When I click on "Add column 'Full name'" "link"
Then I should see "Full name" in the "#settingssorting" "css_element"
Scenario: Sortable columns are updated when column is deleted from report
Given I click on "Show/hide settings sidebar" "button"
And I change window size to "large"
And I click on "Show/hide 'Sorting'" "button"
When I click on "Delete column 'Username'" "link"
And I click on "Delete" "button" in the "Delete column 'Username'" "dialogue"
Then I should not see "Username" in the "#settingssorting" "css_element"