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: Resolve list widget Error #37747

Open
wants to merge 3 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
agHelper,
locators,
propPane,
} from "../../../../support/Objects/ObjectsCore";

const widgetSelector = (name: string) => `[data-widgetname-cy="${name}"]`;
const containerWidgetSelector = `[type="CONTAINER_WIDGET"]`;

describe("Bug 37683: List widget auto-height update infinite loop error", () => {
it("The list widget height should not trigger an auto-height update", () => {
cy.dragAndDropToCanvas("listwidgetv2", {
x: 300,
y: 600,
});
propPane.EnterJSContext(
"onitemclick",
`{{List1.setVisibility(false)}}`,
true,
false,
);
cy.dragAndDropToCanvas("buttonwidget", {
x: 600,
y: 600,
});
propPane.EnterJSContext(
"onClick",
`{{List1.setVisibility(true)}}`,
true,
false,
);
agHelper.GetNClick(locators._enterPreviewMode);
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
.eq(1)
.click({ force: true });
Comment on lines +33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid force clicking without proper wait conditions

Using force: true might mask underlying issues. Consider waiting for the element to be properly interactable.

-      cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
-        .eq(1)
-        .click({ force: true });
+      cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
+        .eq(1)
+        .should('be.visible')
+        .and('be.enabled')
+        .click();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
.eq(1)
.click({ force: true });
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
.eq(1)
.should('be.visible')
.and('be.enabled')
.click();

cy.wait(4000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace cy.wait with proper assertions

Using arbitrary wait times can make tests flaky. Instead, wait for specific conditions.

-      cy.wait(4000);
+      cy.get(widgetSelector("List1")).should("not.be.visible");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.wait(4000);
cy.get(widgetSelector("List1")).should("not.be.visible");

agHelper.GetNClick(`${widgetSelector("Button1")}`);
agHelper.AssertElementVisibility(locators._widgetInDeployed("list1"));
agHelper.AssertElementVisibility(locators._widgetInDeployed("button1"));
agHelper.GetNClick(locators._exitPreviewMode);
});
});
1 change: 1 addition & 0 deletions app/client/src/widgets/ListWidgetV2/widget/defaultProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
minWidth: FILL_WIDGET_MIN_WIDTH,
responsiveBehavior: ResponsiveBehavior.Fill,
flexVerticalAlignment: FlexVerticalAlignment.Top,
isMetaWidget: true,
dynamicBindingPathList: [
{
key: "currentItemsView",
Expand Down