fix(ui): prevent empty header row from persisting state and crashing CLI (#8167)

* fix: 3228 Empty header row persists in state, file, and crashes CLI

* fix: refactor test steps for auto-append empty header row functionality

* fix: update key column identification to use isKeyField property

* fix: prevent duplicate empty rows in EditableTable and improve empty row detection

* fix: update addMultipartFileToLastRow to target the last row correctly

* addressed review comment
This commit is contained in:
sharan-bruno
2026-06-09 18:51:24 +05:30
committed by GitHub
parent 13a48a256f
commit 216d8e7151
3 changed files with 115 additions and 60 deletions

View File

@@ -1120,13 +1120,17 @@ const addMultipartFileToLastRow = async (page: Page, electronApp: ElectronApplic
await mockBrowseFiles(electronApp, [filePath]);
const table = buildCommonLocators(page).table('editable-table');
const lastRow = table.allRows().last();
// The last row is the empty "add" row. Capture its index now, because once
// we set a file the table appends a new empty row — so `.last()` would jump
// to that new row instead of staying on the one we just filled.
const rowIndex = (await table.allRows().count()) - 1;
const targetRow = table.allRows().nth(rowIndex);
await expect(lastRow.locator('.upload-btn')).toBeVisible();
await lastRow.locator('.upload-btn').click();
await expect(lastRow.locator('.file-value-cell')).toBeVisible();
const inlineChip = lastRow.getByTestId('multipart-file-chip').filter({ hasText: path.basename(filePath) });
const summary = lastRow.getByTestId('multipart-file-summary');
await expect(targetRow.locator('.upload-btn')).toBeVisible();
await targetRow.locator('.upload-btn').click();
await expect(targetRow.locator('.file-value-cell')).toBeVisible();
const inlineChip = targetRow.getByTestId('multipart-file-chip').filter({ hasText: path.basename(filePath) });
const summary = targetRow.getByTestId('multipart-file-summary');
await expect(inlineChip.or(summary)).toBeVisible();
});
};