PromucFlow_constructor/app/client/cypress/e2e/Regression/ClientSide/Widgets
Jacques Ikot 3b1c14a9f0
feat: add sortBy property to table select cell type (#35187)
## Description
**Problem**
The table widget now supports the Select column type, which allows the
column to contain both a label and a value. This could be useful for
currency fields, foreign keys, or any other case where you want to
display a different version of the column value. However, there is a
problem with sorting. The table always sorts using the value, and does
not give the user an option to sort using the label, where it makes
sense in specific cases.

**Solution**
This PR adds a Sort By property to the table select cell, allowing the
users to choose which value is used for sorting without affecting any
functionality of the label or value of the select cell.

[Additional Technical
Documentation](https://www.notion.so/appsmith/Adding-sortBy-Property-to-Select-Columns-in-Table-Widget-V2-a5a41e6319a047378eb50a42be8c32ef?pvs=4)

**Tested Cases**
1. Sort select column by default value
Objective: Ensure that a newly added table with select column default
sorts by the value
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., role) to select type.
- Add selectOptions property
- Verify that when sorted in ascending or descending order, the sorting
is correct

2. Sort select column by label
Objective: Ensure that a newly added table with select column and sortBy
property set to label sorts correctly
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., role) to select type
- Add selectOptions property
- Set sortBy property to label
- Verify that when sorted in ascending or descending order, the sorting
is correct and based on the label value only

3. Verify that sorting of other table cells that are not select works as
expected
Objective: Ensure that every other cell type in the table sorts
correctly
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., role) to select type
- Add selectOptions property
- Set sortBy property to label
- Verify that when columns other that role are sorted, they are sorted
correctly

4. Verify that sorting works as expected when table data is a binding
Objective: Ensure that the sorting works for all columns while using
data binding in table data
**Steps:**
- Drop a new table widget
- Link a query binding to the table data property
- Verify that all columns sort correctly

5. Verify that sorting works as expected when table data is a binding
and select column sorting is set to label
Objective: Ensure that the sorting works for all columns while using
data binding in table data with a select column set to sort by the label
**Steps:**
- Drop a new table widget
- Link a query binding to the table data property
- Set a column (e.g., role) to select type
- Add selectOptions property
- Set sortBy property to label
- Verify that all columns sort correctly

6. Verify that sortBy logic does not take effect or break user
experience until the user adds selectOptions in select cell
**Steps:**
- Drop a new table widget
- Link a query binding to the table data property or add raw data
- Set a column (e.g., role) to select type
- Do not add selectOptions
- Set sortBy property to label
- Verify that all other columns display and sort correctly

7. Verify that sorting by label and value works correctly in deployed
mode
**Steps:**
- Drop a new table widget
- Link a query binding to the table data property or add raw data
- Set a column (e.g., role) to select type
- Add selectOptions
- Set sortBy property to label
- Deploy application
- Confirm that sorting works correctly for all columns

Fixes #21993 

## Automation

/ok-to-test tags="@tag.Table, @tag.Binding, @tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10165119164>
> Commit: 8a4e8b238adc0d78726a811b54a209caa4990606
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10165119164&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Table, @tag.Binding, @tag.Sanity`
> Spec:
> <hr>Tue, 30 Jul 2024 16:02:35 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [x] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
	- Introduced a feature flag for dynamic table cell labeling.
- Added a sorting option for select cells, allowing sort by value or
label.
- Enhanced user interface with new configuration options for select
components.
	- Improved sorting functionality for select columns to sort by labels.

- **Bug Fixes**
- Improved sorting functionality in the table widget to ensure accurate
data representation.

- **Tests**
- Expanded and clarified test cases for sorting functionality in the
Table Widget V2.
- Updated testing structure for better reliability and isolation of test
scenarios.
	- Integrated dynamic testing capabilities based on feature flags.

- **Documentation**
- Added new locators for sorting controls to enhance UI interaction
capabilities.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-08-02 08:37:00 +01:00
..
Audio feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
Button test:replace assertPageSave with AssertAutoSave (#33972) 2024-06-06 13:11:03 +05:30
Camera chore: Make pages section into a dropdown (#32486) 2024-04-18 16:04:38 +05:30
Chart chore: Removing widgets related feature flags for the features that are GA (#33229) 2024-05-07 15:26:48 +05:30
Checkbox chore: Reorganise IDE Panels (#35114) 2024-07-31 21:23:35 +05:30
CodeScanner test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
CurrencyInput test: removed toggleBar command and replaced with ts helper (#33835) 2024-06-06 15:25:08 +05:30
Custom fix: Disable custom widgets for airgapped environments (#34540) 2024-06-27 13:47:32 +05:30
Datepicker test: removed toggleBar command and replaced with ts helper (#33835) 2024-06-06 15:25:08 +05:30
Divider test: Updated duplicate file names (#34972) 2024-07-31 10:27:33 +05:30
DocumentViewer test: Cypress - added @tag.Checkbox, @tag.Scanner, @tag.Datepicker, @tag.DocumentViewer, @tag.CurrencyInput, @tag.Dropdown (#29687) 2023-12-18 16:59:48 +05:30
Dropdown test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
Filepicker fix: file picker widgets removing files causing abnormal content (#31646) 2024-03-11 18:13:12 +05:30
Form test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
Iframe feat: New IDE Top Navbar (#31594) 2024-03-12 14:02:58 +05:30
Image test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
Input test: Updated file name for remove duplicate (#34821) 2024-07-12 10:07:17 +05:30
JSONForm test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
List feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
ListV2 test: Remove unused data in DSL fixtures (#34405) 2024-06-24 17:17:43 +05:30
Modal feat: added modal name, lint warning for string, action selector modal (#32893) 2024-05-02 17:48:53 +05:30
Multiselect test: Updated file name for remove duplicate (#34821) 2024-07-12 10:07:17 +05:30
Others test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
PhoneInput feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
Radio test: Cypress - remove width tests (#30577) 2024-01-24 13:05:49 +05:30
Rating test: Cypress - added tags - @tag.Radio, @tag.Rating, @tag.TextEditor, @tag.PhoneInput, @tag.IconButton, @tag.Maps, @tag.MenuButton, @tag.Progress, @tag.Statbox (#29693) 2023-12-18 17:25:28 +05:30
RTE fix: replaced with different solution (#32820) 2024-04-19 17:20:12 +05:30
Select feat: Refactor SelectWidget sourceData handling (#34619) 2024-07-03 13:31:35 +05:30
Sliders fix: number slider + category slider color spec fails (#32935) 2024-04-29 11:31:46 +05:30
Statbox feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
Switch fix: Wrong evaluated value after binding checkbox group widget with… (#33906) 2024-07-17 10:54:03 +05:30
Tab test: Updated duplicate file names (#34972) 2024-07-31 10:27:33 +05:30
TableV1 test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
TableV2 feat: add sortBy property to table select cell type (#35187) 2024-08-02 08:37:00 +01:00
Text feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
TreeSelect test: replace togglebarDisable with CheckUncheck (#34069) 2024-06-10 19:55:17 +05:30
Video feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
Container_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
ContainerTest2_spec.ts chore: Block Selections when Canvas is in Side by Side mode (#31587) 2024-03-13 11:53:49 +05:30
deprecatedWidgets_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
Disabled_Widgets_drag_validation_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
Migration_Spec.js test: updated tests with aghelper table methods (#33737) 2024-05-31 14:01:06 +05:30
Tab_reset_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
WidgetCanvas_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
WidgetCopyPaste_spec.js chore: autoFocus widget search input on load (#32002) 2024-04-03 13:21:53 +05:30
WidgetGrouping_spec.js test: Cypress - @tag.Video, @tag.Container, @tag.Switch, @tag.Slider, @tag.Tab, @tag.Table, @tag.Select (#29698) 2023-12-18 17:05:27 +05:30
Widgets_Labels_spec.js feat: Homepage experience v2 changes (#29282) 2024-01-25 19:11:48 +05:30
WidgetSelection_spec.js feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30