From 4dc277e2488842e092e85ce2de38d4fc1a0b76b8 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Tue, 3 Sep 2024 01:51:54 +0100 Subject: [PATCH 1/8] complete fix --- .../Widgets/TableV2/TableV2Filter1_1_Spec.ts | 94 ++++++++++++++++++- .../widgets/TableWidgetV2/widget/derived.js | 28 ++++++ 2 files changed, 121 insertions(+), 1 deletion(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts index d5e0741608b..0b62d526c47 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts @@ -1,3 +1,4 @@ +import { featureFlagIntercept } from "../../../../../support/Objects/FeatureFlags"; import { entityExplorer, propPane, @@ -8,12 +9,62 @@ import { draggableWidgets, agHelper, } from "../../../../../support/Objects/ObjectsCore"; +import EditorNavigation, { + EntityType, +} from "../../../../../support/Pages/EditorNavigation"; + +const demoTableData = ` +{{ + [ + { + role: 10, + id: 1, + name: "Alice Johnson", + email: "alice.johnson@example.com", + age: 28, + gender: 2 + }, + { + role: 20, + id: 2, + name: "Bob Smith", + email: "bob.smith@example.com", + age: 34, + gender: 1 + }, + { + role: 30, + id: 3, + name: "Charlie Brown", + email: "charlie.brown@example.com", + age: 25, + gender: 3 + }, + { + role: 20, + id: 4, + name: "Diana Prince", + email: "diana.prince@example.com", + age: 30, + gender: 2 + }, + { + role: 10, + id: 5, + name: "Evan Williams", + email: "evan.williams@example.com", + age: 27, + gender: 1 + } + ] +}} + `; describe( "Verify various Table_Filter combinations", { tags: ["@tag.Widget", "@tag.Table"] }, function () { - it("1. Adding Data to Table Widget", function () { + it.only("1. Adding Data to Table Widget", function () { entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); //propPane.EnterJSContext("Table data", JSON.stringify(this.dataSet.TableInput)); // turn on filtering for the table - it is disabled by default in this PR(#34593) @@ -136,5 +187,46 @@ describe( table.WaitForTableEmpty("v2"); table.RemoveFilterNVerify("2381224", true, true, 0, "v2"); }); + + it.only("11. Verify table search includes label and value for table with select column type", () => { + // This flag is turned on to allow the label show in the table select cell content + // when this feature is turned on fully, this flag will be removed + featureFlagIntercept({ release_table_cell_label_value_enabled: true }); + deployMode.NavigateBacktoEditor(); + EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); + propPane.EnterJSContext("Table data", demoTableData); + + // Edit role column to select type + table.ChangeColumnType("role", "Select", "v2"); + table.EditColumn("role", "v2"); + agHelper.UpdateCodeInput( + locators._controlOption, + ` + {{ + [ + {"label": "Software Engineer", + "value": 10,}, + {"label": "Product Manager", + "value": 20,}, + {"label": "UX Designer", + "value": 30,} + ] + }} + `, + ); + // Search for a label in the table + table.SearchTable("Software Engineer"); + table.ReadTableRowColumnData(0, 2, "v2").then((afterSearch) => { + expect(afterSearch).to.eq("Software Engineer"); + }); + table.RemoveSearchTextNVerify("1", "v2"); + + // Search for a value in the table + table.SearchTable("20"); + table.ReadTableRowColumnData(0, 2, "v2").then((afterSearch) => { + expect(afterSearch).to.eq("Product Manager"); + }); + table.RemoveSearchTextNVerify("1", "v2"); + }); }, ); diff --git a/app/client/src/widgets/TableWidgetV2/widget/derived.js b/app/client/src/widgets/TableWidgetV2/widget/derived.js index ad69270fa97..87ed5acc168 100644 --- a/app/client/src/widgets/TableWidgetV2/widget/derived.js +++ b/app/client/src/widgets/TableWidgetV2/widget/derived.js @@ -587,8 +587,36 @@ export default { const columnWithDisplayText = Object.values(props.primaryColumns).filter( (column) => column.columnType === "url" && column.displayText, ); + + /* + * For select columns with label and values, we need to include the label value + * in the search + */ + let labelValueForSelectCell = ""; + const selectColumnKeys = []; + Object.entries(props.primaryColumns).forEach(([id, column]) => { + const isColumnSelectColumnType = + column?.columnType === "select" && column?.selectOptions?.length; + if (isColumnSelectColumnType) { + selectColumnKeys.push(id); + } + }); + if (selectColumnKeys.length) { + selectColumnKeys.forEach((key) => { + const value = row[key]; + const selectOptions = + primaryColumns[key].selectOptions[row.__originalIndex__]; + const option = selectOptions.find((option) => option.value === value); + + if (option) { + labelValueForSelectCell = option.label; + } + }); + } + const displayedRow = { ...row, + labelValueForSelectCell, ...columnWithDisplayText.reduce((acc, column) => { let displayText; if (_.isArray(column.displayText)) { From b608cf72b8b529379598524c49f210a9956219f8 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Tue, 3 Sep 2024 01:56:27 +0100 Subject: [PATCH 2/8] remove it.only from test cases --- .../ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts index 0b62d526c47..f5e577ca487 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts @@ -64,7 +64,7 @@ describe( "Verify various Table_Filter combinations", { tags: ["@tag.Widget", "@tag.Table"] }, function () { - it.only("1. Adding Data to Table Widget", function () { + it("1. Adding Data to Table Widget", function () { entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); //propPane.EnterJSContext("Table data", JSON.stringify(this.dataSet.TableInput)); // turn on filtering for the table - it is disabled by default in this PR(#34593) @@ -188,7 +188,7 @@ describe( table.RemoveFilterNVerify("2381224", true, true, 0, "v2"); }); - it.only("11. Verify table search includes label and value for table with select column type", () => { + it("11. Verify table search includes label and value for table with select column type", () => { // This flag is turned on to allow the label show in the table select cell content // when this feature is turned on fully, this flag will be removed featureFlagIntercept({ release_table_cell_label_value_enabled: true }); From a8308c8867a59c5034e3152c9941beefa54e3ea0 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Tue, 3 Sep 2024 09:48:51 +0100 Subject: [PATCH 3/8] fix failing Select1_spec --- .../Widgets/TableV2/columnTypes/Select1_spec.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index fafe2da10f9..6b7b1fb8a77 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -42,7 +42,8 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - [ + {{ + [ { "label": "#1", "value": "#1" @@ -56,6 +57,7 @@ describe( "value": "#3" } ] + }} `, ); cy.editTableSelectCell(0, 0); @@ -84,12 +86,14 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` + {{ [ { "label": "test", "value": "test" } - ] + ] + }} `, ); cy.wait(500); @@ -175,6 +179,7 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` + {{ [ { "label": "#1label", @@ -188,7 +193,8 @@ describe( "label": "#3label", "value": "#3value" } - ] + ] + }} `, ); cy.editTableSelectCell(0, 0); From fcf8a4379eb7fa6ff88db518fc9135c7beb308b4 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Tue, 10 Sep 2024 05:23:35 +0100 Subject: [PATCH 4/8] move test data to fixtures --- .../Widgets/TableV2/TableV2Filter1_1_Spec.ts | 50 +------------------ .../cypress/fixtures/Table/DemoTableData.ts | 46 +++++++++++++++++ 2 files changed, 48 insertions(+), 48 deletions(-) create mode 100644 app/client/cypress/fixtures/Table/DemoTableData.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts index f5e577ca487..2c529e35fd2 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2Filter1_1_Spec.ts @@ -1,3 +1,4 @@ +import { demoTableDataForSelect } from "../../../../../fixtures/Table/DemoTableData"; import { featureFlagIntercept } from "../../../../../support/Objects/FeatureFlags"; import { entityExplorer, @@ -13,53 +14,6 @@ import EditorNavigation, { EntityType, } from "../../../../../support/Pages/EditorNavigation"; -const demoTableData = ` -{{ - [ - { - role: 10, - id: 1, - name: "Alice Johnson", - email: "alice.johnson@example.com", - age: 28, - gender: 2 - }, - { - role: 20, - id: 2, - name: "Bob Smith", - email: "bob.smith@example.com", - age: 34, - gender: 1 - }, - { - role: 30, - id: 3, - name: "Charlie Brown", - email: "charlie.brown@example.com", - age: 25, - gender: 3 - }, - { - role: 20, - id: 4, - name: "Diana Prince", - email: "diana.prince@example.com", - age: 30, - gender: 2 - }, - { - role: 10, - id: 5, - name: "Evan Williams", - email: "evan.williams@example.com", - age: 27, - gender: 1 - } - ] -}} - `; - describe( "Verify various Table_Filter combinations", { tags: ["@tag.Widget", "@tag.Table"] }, @@ -194,7 +148,7 @@ describe( featureFlagIntercept({ release_table_cell_label_value_enabled: true }); deployMode.NavigateBacktoEditor(); EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); - propPane.EnterJSContext("Table data", demoTableData); + propPane.EnterJSContext("Table data", demoTableDataForSelect); // Edit role column to select type table.ChangeColumnType("role", "Select", "v2"); diff --git a/app/client/cypress/fixtures/Table/DemoTableData.ts b/app/client/cypress/fixtures/Table/DemoTableData.ts new file mode 100644 index 00000000000..1b0bfdfb49e --- /dev/null +++ b/app/client/cypress/fixtures/Table/DemoTableData.ts @@ -0,0 +1,46 @@ +export const demoTableDataForSelect = ` +{{ + [ + { + role: 10, + id: 1, + name: "Alice Johnson", + email: "alice.johnson@example.com", + age: 28, + gender: 2 + }, + { + role: 20, + id: 2, + name: "Bob Smith", + email: "bob.smith@example.com", + age: 34, + gender: 1 + }, + { + role: 30, + id: 3, + name: "Charlie Brown", + email: "charlie.brown@example.com", + age: 25, + gender: 3 + }, + { + role: 20, + id: 4, + name: "Diana Prince", + email: "diana.prince@example.com", + age: 30, + gender: 2 + }, + { + role: 10, + id: 5, + name: "Evan Williams", + email: "evan.williams@example.com", + age: 27, + gender: 1 + } + ] +}} + `; From 8eec0ab3331cce034418a8f2066a9ba778fb3643 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Wed, 11 Sep 2024 12:32:27 +0100 Subject: [PATCH 5/8] add implementation for different states of selectOptions --- .../TableV2/columnTypes/Select1_spec.ts | 12 +- .../widgets/TableWidgetV2/widget/derived.js | 150 ++++++++++++++++-- 2 files changed, 138 insertions(+), 24 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index ffaa9166a83..427f133fa12 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -42,7 +42,6 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - {{ [ { "label": "#1", @@ -57,7 +56,6 @@ describe( "value": "#3" } ] - }} `, ); cy.editTableSelectCell(0, 0); @@ -86,14 +84,12 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - {{ [ { "label": "test", "value": "test" } ] - }} `, ); cy.wait(500); @@ -124,7 +120,7 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - {{[ + [ { label: "#1", value: "#1" @@ -137,7 +133,7 @@ describe( label: "#3", value: "#3" } - ]}} + ] `, ); cy.get(_.locators._propertyControlInput("filterable")).click({ @@ -180,7 +176,7 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - {{ + [ { "label": "#1label", @@ -195,7 +191,7 @@ describe( "value": "#3value" } ] - }} + `, ); cy.editTableSelectCell(0, 0); diff --git a/app/client/src/widgets/TableWidgetV2/widget/derived.js b/app/client/src/widgets/TableWidgetV2/widget/derived.js index 87ed5acc168..aa5873dd548 100644 --- a/app/client/src/widgets/TableWidgetV2/widget/derived.js +++ b/app/client/src/widgets/TableWidgetV2/widget/derived.js @@ -342,12 +342,46 @@ export default { const newRow = { ...row }; selectColumnKeysWithSortByLabel.forEach((key) => { const value = row[key]; - const selectOptions = - primaryColumns[key].selectOptions[row.__originalIndex__]; - const option = selectOptions.find((option) => option.value === value); + const isSelectOptionsAnArray = _.isArray( + primaryColumns[key].selectOptions, + ); + + let selectOptions; - if (option) { - newRow[key] = option.label; + /* + * If selectOptions is an array, check if it contains nested arrays. + * This is to handle situations where selectOptons is a javascript object and computes as a nested array. + */ + if (isSelectOptionsAnArray) { + if (_.some(primaryColumns[key].selectOptions, _.isArray)) { + /* Handle the case where selectOptions contains nested arrays - selectOptions is javascript */ + selectOptions = + primaryColumns[key].selectOptions[row.__originalIndex__]; + const option = selectOptions.find((option) => { + return option.value === value; + }); + if (option) { + newRow[key] = option.label; + } + } else { + /* Handle the case where selectOptions is a flat array - selectOptions is plain JSON */ + selectOptions = primaryColumns[key].selectOptions; + const option = selectOptions.find( + (option) => option.value === value, + ); + if (option) { + newRow[key] = option.label; + } + } + } else { + /* If selectOptions is not an array, parse it as JSON - not evaluated yet, so returns as string */ + selectOptions = JSON.parse(primaryColumns[key].selectOptions); + const option = selectOptions.find( + (option) => option.value === value, + ); + if (option) { + newRow[key] = option.label; + } } }); @@ -450,18 +484,55 @@ export default { } }); + /* + * When sorting is done, transform the data back to its original state + * where table data shows value instead of label + */ if (selectColumnKeysWithSortByLabel.length) { const transformedLabelToValueData = sortedTableData.map((row) => { const newRow = { ...row }; selectColumnKeysWithSortByLabel.forEach((key) => { const label = row[key]; - const selectOptions = - primaryColumns[key].selectOptions[row.__originalIndex__]; - const option = selectOptions.find( - (option) => option.label === label, + const isSelectOptionsAnArray = _.isArray( + primaryColumns[key].selectOptions, ); - if (option) { - newRow[key] = option.value; + + let selectOptions; + + /* + * If selectOptions is an array, check if it contains nested arrays. + * This is to handle situations where selectOptons is a javascript object and computes as a nested array. + */ + if (isSelectOptionsAnArray) { + if (_.some(primaryColumns[key].selectOptions, _.isArray)) { + /* Handle the case where selectOptions contains nested arrays - selectOptions is javascript */ + selectOptions = + primaryColumns[key].selectOptions[row.__originalIndex__]; + const option = selectOptions.find((option) => { + return option.label === label; + }); + if (option) { + newRow[key] = option.value; + } + } else { + /* Handle the case where selectOptions is a flat array - selectOptions is plain JSON */ + selectOptions = primaryColumns[key].selectOptions; + const option = selectOptions.find( + (option) => option.label === label, + ); + if (option) { + newRow[key] = option.value; + } + } + } else { + /* If selectOptions is not an array, parse it as JSON - not evaluated yet, so returns as string */ + selectOptions = JSON.parse(primaryColumns[key].selectOptions); + const option = selectOptions.find( + (option) => option.label === label, + ); + if (option) { + newRow[key] = option.value; + } } }); @@ -593,7 +664,15 @@ export default { * in the search */ let labelValueForSelectCell = ""; + /* + * Initialize an array to store keys for columns that have the 'select' column type + * and contain selectOptions. + */ const selectColumnKeys = []; + /* + * Iterate over the primary columns to identify which columns are of type 'select' + * and have selectOptions. These keys are pushed into the selectColumnKeys array. + */ Object.entries(props.primaryColumns).forEach(([id, column]) => { const isColumnSelectColumnType = column?.columnType === "select" && column?.selectOptions?.length; @@ -601,15 +680,54 @@ export default { selectColumnKeys.push(id); } }); + /* + * If there are any select columns, iterate over them to find the label value + * associated with the selected value in each row. + */ if (selectColumnKeys.length) { selectColumnKeys.forEach((key) => { const value = row[key]; - const selectOptions = - primaryColumns[key].selectOptions[row.__originalIndex__]; - const option = selectOptions.find((option) => option.value === value); - if (option) { - labelValueForSelectCell = option.label; + const isSelectOptionsAnArray = _.isArray( + primaryColumns[key].selectOptions, + ); + + let selectOptions; + + /* + * If selectOptions is an array, check if it contains nested arrays. + * This is to handle situations where selectOptons is a javascript object and computes as a nested array. + */ + if (isSelectOptionsAnArray) { + if (_.some(primaryColumns[key].selectOptions, _.isArray)) { + /* Handle the case where selectOptions contains nested arrays - selectOptions is javascript */ + selectOptions = + primaryColumns[key].selectOptions[row.__originalIndex__]; + const option = selectOptions.find((option) => { + return option.value === value; + }); + if (option) { + labelValueForSelectCell = option.label; + } + } else { + /* Handle the case where selectOptions is a flat array - selectOptions is plain JSON */ + selectOptions = primaryColumns[key].selectOptions; + const option = selectOptions.find( + (option) => option.value === value, + ); + if (option) { + labelValueForSelectCell = option.label; + } + } + } else { + /* If selectOptions is not an array, parse it as JSON - not evaluated yet, so returns as string */ + selectOptions = JSON.parse(primaryColumns[key].selectOptions); + const option = selectOptions.find( + (option) => option.value === value, + ); + if (option) { + labelValueForSelectCell = option.label; + } } }); } From a19af04f67dcddea6cfffc62614102ea05f9cff5 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Wed, 11 Sep 2024 12:42:23 +0100 Subject: [PATCH 6/8] revert changes in Select1_spec --- .../Widgets/TableV2/columnTypes/Select1_spec.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index 427f133fa12..f6593370866 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -42,7 +42,7 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - [ + [ { "label": "#1", "value": "#1" @@ -89,7 +89,7 @@ describe( "label": "test", "value": "test" } - ] + ] `, ); cy.wait(500); @@ -120,7 +120,7 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - [ + {{[ { label: "#1", value: "#1" @@ -133,7 +133,7 @@ describe( label: "#3", value: "#3" } - ] + ]}} `, ); cy.get(_.locators._propertyControlInput("filterable")).click({ @@ -176,7 +176,6 @@ describe( cy.updateCodeInput( ".t--property-control-options", ` - [ { "label": "#1label", @@ -190,8 +189,7 @@ describe( "label": "#3label", "value": "#3value" } - ] - + ] `, ); cy.editTableSelectCell(0, 0); From 5fe966d56cc9cc01dc2dfe3f1968da8706fd91e9 Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Wed, 11 Sep 2024 13:06:48 +0100 Subject: [PATCH 7/8] add tests for JSON and JS options in property pane on table --- .../TableV2/columnTypes/Select1_spec.ts | 59 ++++++++++++++++--- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index f6593370866..cffe2ec1fac 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -37,7 +37,7 @@ describe( }); }); - it("3. should check that options given in the property pane is appearing on the table", () => { + it("3. should check that JSON options given in the property pane is appearing on the table", () => { cy.get(".t--property-control-options").should("exist"); cy.updateCodeInput( ".t--property-control-options", @@ -80,7 +80,50 @@ describe( cy.get(".menu-item-active.has-focus").should("contain", "#1"); }); - it("4. should check that placeholder property is working", () => { + it("4. should check that javascript options given in the property pane is appearing on the table", () => { + cy.get(".t--property-control-options").should("exist"); + cy.updateCodeInput( + ".t--property-control-options", + ` + {{[ + { + "label": "#1", + "value": "#1" + }, + { + "label": "#2", + "value": "#2" + }, + { + "label": "#3", + "value": "#3" + } + ]}} + `, + ); + cy.editTableSelectCell(0, 0); + + [ + { + label: "#1", + value: "#1", + }, + { + label: "#2", + value: "#2", + }, + { + label: "#3", + value: "#3", + }, + ].forEach((item) => { + cy.get(".menu-item-text").contains(item.value).should("exist"); + }); + + cy.get(".menu-item-active.has-focus").should("contain", "#1"); + }); + + it("5. should check that placeholder property is working", () => { cy.updateCodeInput( ".t--property-control-options", ` @@ -116,7 +159,7 @@ describe( ).should("contain", "choose an item"); }); - it("5. should check that filterable property is working", () => { + it("6. should check that filterable property is working", () => { cy.updateCodeInput( ".t--property-control-options", ` @@ -161,7 +204,7 @@ describe( cy.get(".t--canvas-artboard").click({ force: true }); }); - it("6. should check that on option select is working", () => { + it("7. should check that on option select is working", () => { _.agHelper.CheckForPageSaveError(); featureFlagIntercept({ release_table_cell_label_value_enabled: true }); cy.openPropertyPane("tablewidgetv2"); @@ -204,7 +247,7 @@ describe( cy.discardTableRow(4, 0); }); - it("7. should check that currentRow is accessible in the select options", () => { + it("8. should check that currentRow is accessible in the select options", () => { cy.updateCodeInput( ".t--property-control-options", ` @@ -229,7 +272,7 @@ describe( cy.get(".menu-item-text").contains("#1").should("not.exist"); }); - it("8. should check that 'same select option in new row' property is working", () => { + it("9. should check that 'same select option in new row' property is working", () => { _.propPane.NavigateBackToPropertyPane(); const checkSameOptionsInNewRowWhileEditing = () => { @@ -295,7 +338,7 @@ describe( checkSameOptionsWhileAddingNewRow(); }); - it("9. should check that 'new row select options' is working", () => { + it("10. should check that 'new row select options' is working", () => { const checkNewRowOptions = () => { // New row select options should be visible when "Same options in new row" is turned off _.propPane.TogglePropertyState("Same options in new row", "Off"); @@ -360,7 +403,7 @@ describe( checkNoOptionState(); }); - it("10. should check that server side filering is working", () => { + it("11. should check that server side filering is working", () => { _.dataSources.CreateDataSource("Postgres"); _.dataSources.CreateQueryAfterDSSaved( "SELECT * FROM public.astronauts {{this.params.filterText ? `WHERE name LIKE '%${this.params.filterText}%'` : ''}} LIMIT 10;", From f921efc65232c164d0249904ec1ae66dfbb39eae Mon Sep 17 00:00:00 2001 From: Jacques Ikot Date: Wed, 11 Sep 2024 19:16:32 +0100 Subject: [PATCH 8/8] replace .t--property-control-options with _controlOption from commonlocators --- .../TableV2/columnTypes/Select1_spec.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts index cffe2ec1fac..dd77c5338ad 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/Select1_spec.ts @@ -38,9 +38,9 @@ describe( }); it("3. should check that JSON options given in the property pane is appearing on the table", () => { - cy.get(".t--property-control-options").should("exist"); + cy.get(_.locators._controlOption).should("exist"); cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` [ { @@ -81,9 +81,9 @@ describe( }); it("4. should check that javascript options given in the property pane is appearing on the table", () => { - cy.get(".t--property-control-options").should("exist"); + cy.get(_.locators._controlOption).should("exist"); cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` {{[ { @@ -125,7 +125,7 @@ describe( it("5. should check that placeholder property is working", () => { cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` [ { @@ -161,7 +161,7 @@ describe( it("6. should check that filterable property is working", () => { cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` {{[ { @@ -217,7 +217,7 @@ describe( `, ); cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` [ { @@ -249,7 +249,7 @@ describe( it("8. should check that currentRow is accessible in the select options", () => { cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` {{[ { @@ -289,7 +289,7 @@ describe( cy.get(".t--property-control-newrowoptions").should("not.exist"); cy.updateCodeInput( - ".t--property-control-options", + _.locators._controlOption, ` {{[{ "label": "male",