Repository: appsmithorg/appsmith
File: app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/Listv2_BasicClientSideData_spec.js (JavaScript)

Code before:
      cy.get(publishLocators.textWidget).should("have.length", 6);
    });

    it("4. shows correct text from binding", () => {
      cy.get(publishLocators.containerWidget).each(($containerEl, index) => {
        cy.wrap($containerEl)
          .find(publishLocators.textWidget)
          .eq(0)
          .should("have.text", simpleListData1[index].name);
        cy.wrap($containerEl)
          .find(publishLocators.textWidget)
          .eq(1)
          .should("have.text", simpleListData1[index].id);
      });
    });

    it("5. retains input values when pages are switched", () => {
      _.agHelper.AddDsl("Listv2/simpleListWithInputAndButton");

      cy.get(publishLocators.inputWidget).should("have.length", 2);

      // Type a number in each of the item's input widget
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")
          .type(index + 1, { delay: 300 });
      });

      // Verify the typed value
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")
          .should("have.value", index + 1);
      });

      // Change to page 2
      cy.get(".rc-pagination-item")
        .find("a")
        .contains("2")
        .click({ force: true })
        .wait(500);

      cy.get(".rc-pagination-item-active").contains(2);

      cy.get(publishLocators.inputWidget).should("have.length", 2);

      // Type a number in each of the item's input widget
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")
          .type(index + 4, { delay: 300 });

Review comment (bug):
Also as done in this [PR](https://github.com/appsmithorg/appsmith/pull/40239), can we make sure that delay is a bit more than 300? This is to avoid flakiness because if in race condition situation the input change hasn't happened but cypress is done waiting for 300 ms then the test would become flaky, WDYT?

Code after:
      cy.get(publishLocators.imageWidget).should("have.length", 3);
      cy.get(publishLocators.textWidget).should("have.length", 6);
    });

    it("4. shows correct text from binding", () => {
      cy.get(publishLocators.containerWidget).each(($containerEl, index) => {
        cy.wrap($containerEl)
          .find(publishLocators.textWidget)
          .eq(0)
          .should("have.text", simpleListData1[index].name);
        cy.wrap($containerEl)
          .find(publishLocators.textWidget)
          .eq(1)
          .should("have.text", simpleListData1[index].id);
      });
    });

    it("5. retains input values when pages are switched", () => {
      _.agHelper.AddDsl("Listv2/simpleListWithInputAndButton");

      cy.get(publishLocators.inputWidget).should("have.length", 2);

      // Type a number in each of the item's input widget
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")
          .type(index + 1, { delay: DEBOUNCE_WAIT_TIME_ON_INPUT_CHANGE });
      });

      // Verify the typed value
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")
          .should("have.value", index + 1);
      });

      // Change to page 2
      cy.get(".rc-pagination-item")
        .find("a")
        .contains("2")
        .click({ force: true })
        .wait(500);

      cy.get(".rc-pagination-item-active").contains(2);

      cy.get(publishLocators.inputWidget).should("have.length", 2);

      // Type a number in each of the item's input widget
      cy.get(".t--draggable-inputwidgetv2").each(($inputWidget, index) => {
        cy.wrap($inputWidget)
          .find("input")