Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Inline editing flaky test fix #36366

Merged
merged 13 commits into from
Sep 20, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const commonlocators = require("../../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
import {
agHelper,
entityExplorer,
propPane,
table,
draggableWidgets,
} from "../../../../../support/Objects/ObjectsCore";
import { PROPERTY_SELECTOR } from "../../../../../locators/WidgetLocators";
import PageList from "../../../../../support/Pages/PageList";
const publish = require("../../../../../locators/publishWidgetspage.json");

describe(
"Table widget inline editing functionality",
Expand All @@ -30,8 +30,7 @@ describe(
cy.openPropertyPane("tablewidgetv2");
table.toggleColumnEditableViaColSettingsPane("step", "v2", true, true);
cy.editColumn("EditActions1");
cy.get(".t--property-pane-section-collapse-savebutton").click();
//cy.get(".t--property-pane-section-collapse-discardbutton").click();
cy.get(widgetsPage.propertyPaneSaveButton).click();
cy.getAlert("onDiscard", "discarded!!");
cy.editTableCell(0, 0);
cy.enterTableCellValue(0, 0, "NewValue");
Expand All @@ -51,22 +50,16 @@ describe(
cy.openPropertyPane("tablewidgetv2");
table.toggleColumnEditableViaColSettingsPane("step", "v2", true, true);
cy.editTableCell(0, 0);
cy.get(
"[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor input.bp3-input",
).should("not.be.disabled");
cy.get(widgetsPage.firstEditInput).should("not.be.disabled");
});

it("3. should check that inline editing works with text wrapping enabled", () => {
cy.openPropertyPane("tablewidgetv2");
table.toggleColumnEditableViaColSettingsPane("step", "v2", true, true);
cy.editColumn("step");
cy.get(".t--property-control-cellwrapping .ads-v2-switch")
.first()
.click({ force: true });
cy.get(widgetsPage.cellControlSwitch).first().click({ force: true });
cy.editTableCell(0, 0);
cy.get(
"[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor input.bp3-input",
).should("not.be.disabled");
cy.get(widgetsPage.firstEditInput).should("not.be.disabled");
});

it("4. should check that cell column height doesn't grow taller when text wrapping is disabled", () => {
Expand Down Expand Up @@ -114,16 +107,15 @@ describe(

it("6. should check if updatedRowIndex is getting updated for single row update mode", () => {
cy.dragAndDropToCanvas("textwidget", { x: 400, y: 400 });
cy.get(".t--widget-textwidget").should("exist");
cy.updateCodeInput(
".t--property-control-text",
`{{Table1.updatedRowIndex}}`,
);
cy.get(publish.textWidget).should("exist");
cy.updateCodeInput(PROPERTY_SELECTOR.text, `{{Table1.updatedRowIndex}}`);

cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 300 });
cy.get(".t--widget-buttonwidget").should("exist");
cy.get(PROPERTY_SELECTOR.onClick).find(".t--js-toggle").click();
cy.updateCodeInput(".t--property-control-label", "Reset");
cy.get(widgetsPage.widgetBtn).should("exist");
cy.get(PROPERTY_SELECTOR.onClick)
.find(PROPERTY_SELECTOR.jsToggle)
.click();
cy.updateCodeInput(widgetsPage.propertyControlLabel, "Reset");
cy.updateCodeInput(
PROPERTY_SELECTOR.onClick,
`{{resetWidget("Table1",true)}}`,
Expand Down Expand Up @@ -161,19 +153,23 @@ describe(
});

it("7. should check if updatedRowIndex is getting updated for multi row update mode", () => {
PageList.AddNewPage("New blank page");
cy.dragAndDropToCanvas("tablewidgetv2", { x: 350, y: 500 });
table.AddSampleTableData();
cy.dragAndDropToCanvas("textwidget", { x: 400, y: 400 });
cy.get(".t--widget-textwidget").should("exist");
cy.updateCodeInput(
".t--property-control-text",
`{{Table1.updatedRowIndex}}`,
);
cy.get(publish.textWidget).should("exist");
cy.updateCodeInput(PROPERTY_SELECTOR.text, `{{Table1.updatedRowIndex}}`);
cy.dragAndDropToCanvas("buttonwidget", { x: 300, y: 300 });
cy.get(".t--widget-buttonwidget").should("exist");
cy.get(PROPERTY_SELECTOR.onClick).find(".t--js-toggle").click();
cy.updateCodeInput(".t--property-control-label", "Reset");
cy.updateCodeInput(
PROPERTY_SELECTOR.onClick,
`{{resetWidget("Table1",true)}}`,
cy.get(widgetsPage.widgetBtn).should("exist");
cy.get(PROPERTY_SELECTOR.onClick)
.find(PROPERTY_SELECTOR.jsToggle)
.click();
cy.updateCodeInput(widgetsPage.propertyControlLabel, "Reset");
propPane.EnterJSContext(
"onClick",
'{{resetWidget("Table1",true)}}',
true,
false,
);

EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/locators/WidgetLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const PROPERTY_SELECTOR = {
TextFieldName: "Text",
tableData: ".t--property-control-tabledata",
tableColumnNames: '[data-rbd-draggable-id] input[type="text"]',
jsToggle : '.t--js-toggle',
};

export const WIDGETSKIT = {
Expand Down
6 changes: 5 additions & 1 deletion app/client/cypress/locators/Widgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,9 @@
"showResult": ".t--property-control-showresult input[type='checkbox']",
"infiniteLoading": ".t--property-control-infiniteloading input[type='checkbox']",
"counterclockwise": ".t--property-control-counterclockwise input[type='checkbox']",
"serversideFilteringInput": ".t--property-control-serversidefiltering input[type='checkbox']"
"serversideFilteringInput": ".t--property-control-serversidefiltering input[type='checkbox']",
"propertyPaneSaveButton": ".t--property-pane-section-collapse-savebutton",
"firstEditInput":"[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor input.bp3-input",
"cellControlSwitch" : ".t--property-control-cellwrapping .ads-v2-switch",
"propertyControlLabel" : ".t--property-control-label"
}
Loading