The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Consolidate table editing e2e tests (#83649)
Nemanja Glumac0e58a35cea0e
diff --git a/e2e/test/scenarios/table-editing/table-editing.cy.spec.ts b/e2e/test/scenarios/actions/table-editing.cy.spec.tssimilarity index 55%rename from e2e/test/scenarios/table-editing/table-editing.cy.spec.tsrename to e2e/test/scenarios/actions/table-editing.cy.spec.tsindex a90e6414d3b..0aec31386a8 100644--- a/e2e/test/scenarios/table-editing/table-editing.cy.spec.ts+++ b/e2e/test/scenarios/actions/table-editing.cy.spec.ts@@ -28,17 +28,26 @@ const DEFAULT_FIELD = "UUID";const TEST_TABLE_ROW_COUNT = 2;const TARGET_ROW_ID = 2;-describe("scenarios > table-editing", () => {+describe("scenarios > actions > table editing", () => {beforeEach(() => {resetSnowplow();H.restore("postgres-writable");+ cy.signInAsAdmin();+ H.activateToken("pro-self-hosted");++ setTableEditingEnabledForDB(WRITABLE_DB_ID);+ });++ it("should open edit mode from the table browser only for admins on databases with table editing enabled", () => {H.resetTestTable({type: "postgres",table: EDITABLE_SOURCE_TABLE_NAME,});-- cy.signInAsAdmin();+ H.resyncDatabase({+ dbId: WRITABLE_DB_ID,+ tableName: EDITABLE_SOURCE_TABLE_NAME,+ });cy.updatePermissionsGraph({[ALL_USERS_GROUP]: {[WRITABLE_DB_ID]: {@@ -48,34 +57,14 @@ describe("scenarios > table-editing", () => {},});- H.resyncDatabase({- dbId: WRITABLE_DB_ID,- tableName: EDITABLE_SOURCE_TABLE_NAME,- });-- H.activateToken("pro-self-hosted");-- setTableEditingEnabledForDB(WRITABLE_DB_ID);-cy.intercept("GET", "/api/database").as("getDatabases");cy.intercept("GET", "/api/table/*").as("getTable");- });- it("should show edit icon on table browser", () => {+ cy.log("admin opens edit mode from the table browser");openTableBrowser();- getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX).should("be.visible");- });-- it("should not show edit icon on table browser if user is not admin", () => {- cy.signInAsNormalUser();-- openTableBrowser();- getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX).should("not.exist");- });-- it("should allow to open table data edit mode", () => {- openTableBrowser();- openTableEdit(EDITABLE_SOURCE_TABLE_NAME_REGEX);+ getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX)+ .should("be.visible")+ .click();H.getTableId({name: EDITABLE_SOURCE_TABLE_NAME,@@ -105,36 +94,33 @@ describe("scenarios > table-editing", () => {.click();cy.findByTestId("query-builder-root").should("be.visible");- });- describe("db setting is disabled", () => {- it("should not allow to open table data view by default", () => {- setTableEditingEnabledForDB(WRITABLE_DB_ID, false);- openTableBrowser();- getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX).should("not.exist");- });- });+ cy.log("non-admin gets neither the edit icon nor edit mode");+ cy.signInAsNormalUser();+ openTableBrowser();+ getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX).should("not.exist");- describe("non-admin user", () => {- beforeEach(() => {- cy.signInAsNormalUser();+ H.getTableId({+ databaseId: WRITABLE_DB_ID,+ name: EDITABLE_SOURCE_TABLE_NAME,+ }).then((tableId) => {+ cy.visit(`/browse/databases/${WRITABLE_DB_ID}/tables/${tableId}/edit`);+ cy.findByTestId("edit-table-data-restricted").should("be.visible");});- it("should not allow to open table data view", () => {- H.getTableId({- databaseId: WRITABLE_DB_ID,- name: EDITABLE_SOURCE_TABLE_NAME,- }).then((tableId) => {- cy.visit(`/browse/databases/${WRITABLE_DB_ID}/tables/${tableId}/edit`);- cy.findByTestId("edit-table-data-restricted").should("be.visible");- });- });+ cy.log("admin gets no edit icon once the database setting is off");+ cy.signInAsAdmin();+ setTableEditingEnabledForDB(WRITABLE_DB_ID, false);+ openTableBrowser();+ getTableEditIcon(EDITABLE_SOURCE_TABLE_NAME_REGEX).should("not.exist");});describe("table edit mode", () => {beforeEach(() => {- resetSnowplow();-+ H.resetTestTable({+ type: "postgres",+ table: EDITABLE_SOURCE_TABLE_NAME,+ });H.queryWritableDB(`DROP TABLE IF EXISTS ${INLINE_EDIT_TEST_TABLE_NAME}`,"postgres",@@ -204,85 +190,15 @@ describe("scenarios > table-editing", () => {);});- it("should allow to filter table data", () => {- cy.findByTestId("edit-table-data-root").findByText("Filter").click();-- H.popover().within(() => {- cy.findByText("ID").click();- cy.findByText("Is").click();- });-- H.menu().findByText("Not empty").click();- H.popover().findByText("Apply filter").click();-- cy.wait("@getTableDataQuery");-- cy.findByTestId("filters-visibility-control").should("have.text", "1");-- // check that filter persists after page refresh- cy.reload();- cy.wait("@getTableDataQuery");-- cy.findByTestId("filters-visibility-control").should("have.text", "1");-- cy.findByTestId("qb-filters-panel")- .should("be.visible")- .within(() => {- cy.icon("close").click();- });-- cy.wait("@getTableDataQuery");- cy.findByTestId("filters-visibility-control").should("not.exist");- });-- it("should allow to sort table data", () => {- cy.findByTestId("table-header").within(() => {- cy.findByText(DEFAULT_FIELD).click();-- cy.findAllByTestId("header-sort-indicator").should("have.length", 1);-- cy.findByText(DEFAULT_FIELD)- .closest("[role=button]")- .findByLabelText("chevronup icon")- .should("be.visible");-- cy.findByText(DEFAULT_FIELD).click();-- cy.findByText(DEFAULT_FIELD)- .closest("[role=button]")- .findByLabelText("chevrondown icon")- .should("be.visible");- });-- // check that sorting persist after page refresh- cy.reload();- cy.wait("@getTableDataQuery");-- cy.findByTestId("table-header").within(() => {- cy.findByText(DEFAULT_FIELD)- .closest("[role=button]")- .findByLabelText("chevrondown icon")- .should("be.visible");-- cy.findByText(DEFAULT_FIELD).click();-- cy.findAllByTestId("header-sort-indicator").should("have.length", 0);- });- });-- it("should allow to view row details", () => {+ it("should edit rows in the modal and inline, and filter and sort table data", () => {+ cy.log("view and edit a row in the modal");openEditRowModal(1);+H.modal().within(() => {cy.get("@rowId").then((rowId) => {cy.findByTestId("ID-field-input").should("have.text", rowId);});- });- });- it("should allow to edit a row using a modal", () => {- openEditRowModal(1);-- H.modal().within(() => {cy.findByTestId("Integer-field-input").type("{selectAll}{backspace}123").blur();@@ -290,14 +206,13 @@ describe("scenarios > table-editing", () => {cy.findByTestId("update-row-save-button").click();});- cy.wait("@updateTableData").then(({ response }) => {- expect(response?.body.outputs[0].op).to.equal("updated");- expect(response?.body.outputs[0].row.integer).to.equal(123);- });-+ cy.wait("@updateTableData");H.modal().should("not.exist");- H.undoToast().findByText("Successfully updated").should("be.visible");+ dismissUndoToast("Successfully updated");+ cy.get("@rowId").then((rowId) => {+ getEditableCell(Number(rowId), "integer").should("have.text", "123");+ });H.getTableId({databaseId: WRITABLE_DB_ID,name: INLINE_EDIT_TEST_TABLE_NAME,@@ -310,273 +225,284 @@ describe("scenarios > table-editing", () => {result: "success",});});- });- describe("inline cell editing", () => {- const cases = [- {- dataType: "integer",- column: "integer",- value: 1234,- },- {- dataType: "tinyint",- column: "tinyint",- value: 42,- },- {- dataType: "string",- column: "string",- value: "test",- },+ const inputCases = [+ { column: "integer", value: 1234, displayValue: "1,234" },+ { column: "tinyint", value: 42, displayValue: "42" },+ { column: "string", value: "test", displayValue: "test" },];- cases.forEach(({ dataType, column, value }) => {- it(`should allow to edit a cell with type ${dataType}`, () => {- getEditableCell(TARGET_ROW_ID, column)- .as("targetCell")- .click({ scrollBehavior: false });-- cy.get("@targetCell")- .find("input")- .type(`{selectAll}{backspace}${value}`, { scrollBehavior: false })- /*- The number input holds its value in React state that the blur- handler closes over, so blurring before the DOM has settled sends- the pre-edit value (or the empty intermediate one).- */- .should("have.value", String(value))- .blur();-- cy.wait("@updateTableData").then(({ response }) => {- expect(response?.body.outputs[0].op).to.equal("updated");- expect(response?.body.outputs[0].row[column]).to.equal(value);- });+ inputCases.forEach(({ column, value, displayValue }, index) => {+ cy.log(`inline-edit a ${column} cell`);+ getEditableCell(TARGET_ROW_ID, column)+ .as("targetCell")+ .click({ scrollBehavior: false });++ cy.get("@targetCell")+ .find("input")+ .type(`{selectAll}{backspace}${value}`, { scrollBehavior: false })+ /*+ The number input holds its value in React state that the blur+ handler closes over, so blurring before the DOM has settled sends+ the pre-edit value (or the empty intermediate one).+ */+ .should("have.value", String(value))+ .blur();- cy.log("the toast auto-hides after 5s, so assert it before Snowplow");- H.undoToast().findByText("Successfully updated").should("be.visible");+ cy.wait("@updateTableData");+ dismissUndoToast("Successfully updated");+ getEditableCell(TARGET_ROW_ID, column).should(+ "have.text",+ displayValue,+ );- H.getTableId({- databaseId: WRITABLE_DB_ID,- name: INLINE_EDIT_TEST_TABLE_NAME,- }).then((tableId) => {- H.expectUnstructuredSnowplowEvent({+ H.getTableId({+ databaseId: WRITABLE_DB_ID,+ name: INLINE_EDIT_TEST_TABLE_NAME,+ }).then((tableId) => {+ H.expectUnstructuredSnowplowEvent(+ {event: "edit_data_record_modified",event_detail: "update",target_id: tableId,triggered_from: "inline",result: "success",- });- });+ },+ index + 1,+ );});});- it("should allow to edit a cell with date type", () => {- getEditableCell(TARGET_ROW_ID, "date").click({- scrollBehavior: false,- });+ cy.log("inline-edit a date cell");+ getEditableCell(TARGET_ROW_ID, "date").click({+ scrollBehavior: false,+ });- // The picker opens on the month of the cell's current value.- const day = 15;+ // The picker opens on the month of the cell's current value.+ const day = 15;- H.popover().within(() => {- cy.findByRole("button", { name: `${day} February 2020` }).click();- });+ H.popover().within(() => {+ cy.findByRole("button", { name: `${day} February 2020` }).click();+ });- cy.wait("@updateTableData").then(({ response }) => {- const targetDate = dayjs(new Date(2020, 1, day)).format("YYYY-MM-DD");- const responseDate = dayjs(response?.body.outputs[0].row.date).format(- "YYYY-MM-DD",- );+ cy.wait("@updateTableData");+ dismissUndoToast("Successfully updated");+ getEditableCell(TARGET_ROW_ID, "date").should(+ "have.text",+ `February ${day}, 2020`,+ );- expect(responseDate).to.equal(targetDate);- });+ cy.log("inline-edit a datetime cell");+ getEditableCell(TARGET_ROW_ID, "datetime").click({+ scrollBehavior: false,+ });- H.undoToast().findByText("Successfully updated").should("be.visible");+ const hour = 11;+ const minute = 35;++ H.popover().within(() => {+ cy.findByRole("button", { name: `${day} February 2020` }).click();+ cy.findAllByRole("spinbutton").eq(0).type(hour.toString());+ cy.findAllByRole("spinbutton").eq(1).type(minute.toString());+ cy.get('select[data-am-pm="true"]').as("ampmSelect");+ cy.get("@ampmSelect").select("AM");+ // It's safe to click the last button because we're in the popover+ // eslint-disable-next-line metabase/no-unsafe-element-filtering+ cy.findAllByRole("button").last().click();});- it("should allow to edit a cell with datetime type", () => {- getEditableCell(TARGET_ROW_ID, "datetime").click({- scrollBehavior: false,- });+ cy.wait("@updateTableData");+ dismissUndoToast("Successfully updated");+ getEditableCell(TARGET_ROW_ID, "datetime").should(+ "have.text",+ `February ${day}, 2020, ${hour}:${minute} AM`,+ );- const day = 15;- const hour = 11;- const minute = 35;-- H.popover().within(() => {- cy.findByRole("button", { name: `${day} February 2020` }).click();- cy.findAllByRole("spinbutton").eq(0).type(hour.toString());- cy.findAllByRole("spinbutton").eq(1).type(minute.toString());- cy.get('select[data-am-pm="true"]').as("ampmSelect");- cy.get("@ampmSelect").select("AM");- // It's safe to click the last button because we're in the popover- // eslint-disable-next-line metabase/no-unsafe-element-filtering- cy.findAllByRole("button").last().click();- });+ cy.log("inline-edit a boolean cell through its select");+ // The target row's boolean is `false`, so "True" is always a change.+ getEditableCell(TARGET_ROW_ID, "boolean").click({+ scrollBehavior: false,+ });- cy.wait("@updateTableData").then(({ response, request }) => {- const targetDate = "2020-02-15T11:35:00";+ H.popover().within(() => {+ // 3: True, False, None+ cy.findAllByRole("option").should("have.length", 3);+ cy.findByRole("option", { name: "True" }).click();+ });- const requestDate = request.body.params.datetime;- const responseDate = response?.body.outputs[0].row.datetime;+ cy.wait("@updateTableData");+ dismissUndoToast("Successfully updated");+ getEditableCell(TARGET_ROW_ID, "boolean").should("have.text", "true");- // Check if request date matches the response date.- // In theory FE should preserve the initial input date timezone offset (might be based on the CI environment)- expect(requestDate).to.equal(responseDate);+ cy.log("PK cells are not editable");+ getEditableCell(TARGET_ROW_ID, "id")+ .click({ scrollBehavior: false })+ .should("be.visible")+ .find("input")+ .should("not.exist");- // Check if date param matches the input date (without timezone offset at offset 19)- expect(requestDate.slice(0, 19)).to.equal(targetDate);- });+ cy.log("filter and sort persist across reload");+ cy.findByTestId("edit-table-data-root").findByText("Filter").click();- H.undoToast().findByText("Successfully updated").should("be.visible");+ H.popover().within(() => {+ cy.findByText("ID").click();+ cy.findByText("Is").click();});- it("should allow to edit a cell with select type", () => {- // The target row's boolean is `false`, so "True" is always a change.- getEditableCell(TARGET_ROW_ID, "boolean").click({- scrollBehavior: false,- });+ H.menu().findByText("Not empty").click();+ H.popover().findByText("Apply filter").click();- H.popover().within(() => {- // 3: True, False, None- cy.findAllByRole("option").should("have.length", 3);- cy.findByRole("option", { name: "True" }).click();- });+ cy.wait("@getTableDataQuery");- cy.wait("@updateTableData").then(({ response }) => {- expect(response?.body.outputs[0].op).to.equal("updated");- expect(response?.body.outputs[0].row.boolean).to.equal(true);- });+ cy.findByTestId("filters-visibility-control").should("have.text", "1");- H.undoToast().findByText("Successfully updated").should("be.visible");- });+ cy.findByTestId("table-header").findByText(DEFAULT_FIELD).click();+ cy.wait("@getTableDataQuery");- it("should not allow to edit PK cells", () => {- getEditableCell(TARGET_ROW_ID, "id")- .click({ scrollBehavior: false })- .should("be.visible")- .find("input")- .should("not.exist");- });+ cy.findByTestId("table-header").within(() => {+ cy.findAllByTestId("header-sort-indicator").should("have.length", 1);- it("should handle errors", () => {- getEditableCell(TARGET_ROW_ID, "tinyint")- .click({ scrollBehavior: false })- .find("input")- // Entering a big number into tinyint column- .type("{selectAll}{backspace}9999999", {- scrollBehavior: false,- })- .should("have.value", "9999999")- .blur(); // Trigger the save action by blurring the input-- H.undoToast()- .findByText("Couldn't save table changes")+ cy.findByText(DEFAULT_FIELD)+ .closest("[role=button]")+ .findByLabelText("chevronup icon").should("be.visible");++ cy.findByText(DEFAULT_FIELD).click();});- });- });+ cy.wait("@getTableDataQuery");- describe("create / delete row", () => {- beforeEach(() => {- resetSnowplow();+ cy.findByTestId("table-header")+ .findByText(DEFAULT_FIELD)+ .closest("[role=button]")+ .findByLabelText("chevrondown icon")+ .should("be.visible");- H.restore("postgres-writable");- H.resetTestTable({ type: "postgres", table: "scoreboard_actions" });- H.resyncDatabase({- dbId: WRITABLE_DB_ID,- tableName: "scoreboard_actions",+ cy.reload();+ cy.wait("@getTableDataQuery");++ cy.findByTestId("filters-visibility-control").should("have.text", "1");++ cy.findByTestId("table-header").within(() => {+ cy.findByText(DEFAULT_FIELD)+ .closest("[role=button]")+ .findByLabelText("chevrondown icon")+ .should("be.visible");});- H.activateToken("pro-self-hosted");- setTableEditingEnabledForDB(WRITABLE_DB_ID);+ cy.findByTestId("qb-filters-panel")+ .should("be.visible")+ .within(() => {+ cy.icon("close").click();+ });++ cy.wait("@getTableDataQuery");+ cy.findByTestId("filters-visibility-control").should("not.exist");- cy.intercept("GET", "/api/table/*/query_metadata").as("getTableMetadata");- cy.intercept("POST", "api/dataset").as("getTableDataQuery");- cy.intercept("POST", "api/ee/action-v2/execute-bulk").as("executeBulk");+ cy.findByTestId("table-header").within(() => {+ cy.findByText(DEFAULT_FIELD).click();- H.getTableId({ name: "scoreboard_actions" }).then((tableId) => {- cy.visit(`/browse/databases/${WRITABLE_DB_ID}/tables/${tableId}/edit`);+ cy.findAllByTestId("header-sort-indicator").should("have.length", 0);});- cy.wait("@getTableMetadata");+ cy.wait("@getTableDataQuery");+ cy.findByTestId("edit-table-data-loading-overlay").should("not.exist");++ cy.log("a rejected inline edit shows an error toast");+ getEditableCell(TARGET_ROW_ID, "tinyint")+ .click({ scrollBehavior: false })+ .find("input")+ // Entering a big number into tinyint column+ .type("{selectAll}{backspace}9999999", {+ scrollBehavior: false,+ })+ .should("have.value", "9999999")+ .blur(); // Trigger the save action by blurring the input++ H.undoToast()+ .findByText("Couldn't save table changes")+ .should("be.visible");});+ });- it("should allow to create a row", () => {- cy.findByTestId("new-record-button").click();+ it("should create a row and bulk delete rows", () => {+ H.resetTestTable({ type: "postgres", table: "scoreboard_actions" });+ H.resyncDatabase({+ dbId: WRITABLE_DB_ID,+ tableName: "scoreboard_actions",+ });- H.modal().findByText("Create a new record").should("be.visible");+ cy.intercept("GET", "/api/table/*/query_metadata").as("getTableMetadata");+ cy.intercept("POST", "api/ee/action-v2/execute-bulk").as("executeBulk");- cy.findByTestId("Team Name-field-input").click();- H.popover().findByRole("textbox").type("New York Bricks");- H.popover()- .findByText(/Add option/)- .click();- cy.findByTestId("Score-field-input").type("987");- cy.findByTestId("Status-field-input").click();- H.popover().findByText("active").click();-- cy.findByTestId("create-row-form-submit-button").click();-- cy.wait("@executeBulk").then(({ response, request }) => {- expect(request.body.action).to.equal("data-grid.row/create");- expect(response?.body.outputs[0].op).to.equal("created");- expect(response?.body.outputs[0].row.score).to.equal(987);- expect(response?.body.outputs[0].row.status).to.equal("active");- expect(response?.body.outputs[0].row.team_name).to.equal(- "New York Bricks",- );- });+ H.getTableId({ name: "scoreboard_actions" }).then((tableId) => {+ cy.visit(`/browse/databases/${WRITABLE_DB_ID}/tables/${tableId}/edit`);+ });- H.undoToast().within(() => {- cy.findByText("Record successfully created").should("be.visible");- cy.findByLabelText("close icon").click();- });+ cy.wait("@getTableMetadata");- cy.findByTestId("table-root").within(() => {- cy.findByText("New York Bricks").should("be.visible");- cy.findByText("987").should("be.visible");- });+ cy.log("create a row");+ cy.findByTestId("new-record-button").click();- H.getTableId({ name: "scoreboard_actions" }).then((tableId) => {- H.expectUnstructuredSnowplowEvent({- event: "edit_data_record_modified",- event_detail: "create",- target_id: tableId,- triggered_from: "modal",- result: "success",- });- });- });+ H.modal().findByText("Create a new record").should("be.visible");- it("should allow to delete multiple rows (bulk)", () => {- cy.findAllByTestId("row-select-checkbox").eq(1).click();- cy.findAllByTestId("row-select-checkbox").eq(2).click();+ cy.findByTestId("Team Name-field-input").click();+ H.popover().findByRole("textbox").type("New York Bricks");+ H.popover()+ .findByText(/Add option/)+ .click();+ cy.findByTestId("Score-field-input").type("987");+ cy.findByTestId("Status-field-input").click();+ H.popover().findByText("active").click();- cy.log("should not show edit icon when rows are selected");- cy.findByTestId("row-edit-icon").should("not.exist");+ cy.findByTestId("create-row-form-submit-button").click();- cy.log("should bulk delete rows");- cy.findByTestId("toast-card").findByText("Delete").click();+ cy.wait("@executeBulk");+ dismissUndoToast("Record successfully created");- H.modal().within(() => {- cy.findByText("Delete 2 records?").should("be.visible");- cy.findByRole("button", { name: "Delete 2 records" }).click();- });+ cy.findByTestId("table-root")+ .findByText("New York Bricks")+ .should("be.visible")+ .closest("[role=row]")+ .should("contain.text", "987")+ .and("contain.text", "active");- cy.wait("@executeBulk").then(({ response, request }) => {- expect(request.body.action).to.equal("data-grid.row/delete");- expect(response?.body.outputs[0].op).to.equal("deleted");+ H.getTableId({ name: "scoreboard_actions" }).then((tableId) => {+ H.expectUnstructuredSnowplowEvent({+ event: "edit_data_record_modified",+ event_detail: "create",+ target_id: tableId,+ triggered_from: "modal",+ result: "success",});+ });++ cy.log("bulk delete rows");+ cy.findAllByTestId("row-edit-icon").should("exist");+ selectRowByText("New York Bricks");+ selectRowByText("Bouncy Bears");- cy.findByTestId("toast-card").should("not.exist");+ cy.log("should not show edit icon when rows are selected");+ cy.findByTestId("row-edit-icon").should("not.exist");- H.undoToast().findByText("Successfully deleted").should("be.visible");+ cy.findByTestId("toast-card").findByText("Delete").click();- cy.log("should show edit icon when no rows are selected");- cy.findAllByTestId("row-edit-icon").should("exist");+ H.modal().within(() => {+ cy.findByText("Delete 2 records?").should("be.visible");+ cy.findByRole("button", { name: "Delete 2 records" }).click();});++ cy.wait("@executeBulk");+ cy.findByTestId("toast-card").should("not.exist");++ H.undoToast().findByText("Successfully deleted").should("be.visible");+ cy.findByTestId("table-root").within(() => {+ cy.findByText("Amorous Aardvarks").should("be.visible");+ cy.findByText("New York Bricks").should("not.exist");+ cy.findByText("Bouncy Bears").should("not.exist");+ });++ cy.log("should show edit icon when no rows are selected");+ cy.findAllByTestId("row-edit-icon").should("exist");});describe("table editing bugs", () => {@@ -683,19 +609,13 @@ describe("scenarios > table-editing", () => {.should("be.enabled").click();- cy.wait("@executeBulk").then(({ request, response }) => {- expect(request.body.action).to.equal("data-grid.row/create");- expect(response?.body.outputs[0].op).to.equal("created");-- const responseDate = dayjs(- response?.body.outputs[0].row.sale_date,- ).format("YYYY-MM-DD");- expect(responseDate).to.equal(targetDay.format("YYYY-MM-DD"));- });-+ cy.wait("@executeBulk");H.undoToast().findByText("Record successfully created").should("be.visible");+ cy.findByTestId("table-root")+ .findByText(targetDay.format("MMMM D, YYYY"))+ .should("be.visible");H.queryWritableDB(`DROP TABLE IF EXISTS ${TABLE_NAME}`, "postgres");});@@ -748,6 +668,36 @@ function getEditableCell(rowId: number, column: string) {return getEditableRow(rowId).find(`[data-column-id='${column}']`);}+/**+ * The row checkbox sits in the pinned quadrant and the cell text in the+ * center one; both halves of a row share its dataset index.+ */+function selectRowByText(text: string) {+ cy.findByTestId("table-root")+ .findByText(text)+ .closest("[role=row]")+ .invoke("attr", "data-dataset-index")+ .then((datasetIndex) => {+ cy.findByTestId("table-root")+ .find(`[role=row][data-dataset-index='${datasetIndex}']`)+ .findByTestId("row-select-checkbox")+ .click();+ });+}++/**+ * Success toasts stack, so each one is dismissed before the next edit can+ * raise another. Inline edits update the cell optimistically, so the fresh+ * toast is what proves the save succeeded.+ */+function dismissUndoToast(message: string) {+ H.undoToast().within(() => {+ cy.findByText(message).should("be.visible");+ cy.findByLabelText("close icon").click();+ });+ H.undoToast().should("not.exist");+}+function openEditRowModal(rowIndex: number) {cy.findByTestId("table-root").findAllByRole("row")