refactor(tests): implement disableRow method for cleaner row disabling in table editor tests

This commit is contained in:
Bob Qiu committed 2026-10-08 12:31:39 +08:00
1 parent 80526d8d75
commit 8e0c0f5e01
2 files changed
+14 -4

No files matched your search

@@ -98,9 +98,22 @@ export class EnvironmentPage extends BasePage {
* @param row - The row locator to delete
*/
async deleteRow(row: Locator): Promise<void> {
const rows = this.page.locator(this.LISTBOX).locator('[role="option"]');
const countBefore = await rows.count();
const button = row.getByRole("button", { name: "Delete Row" });
await button.click();
await button.click();
await expect(rows).toHaveCount(countBefore - 1);
}
/**
* Disables a key/value pair row and waits for the row to flip to its
* disabled state (its toggle button becomes "Enable Row").
* @param row - The row locator to disable
*/
async disableRow(row: Locator): Promise<void> {
await row.getByRole("button", { name: "Disable Row" }).click();
await expect(row.getByRole("button", { name: "Enable Row" })).toBeVisible();
}
/**
@@ -37,10 +37,7 @@ test("Verify Disabling A Row In The Table Editor Is Reflected On Read-Back", asy
kvPairData: [varA, varB],
});
await environmentPage
.getRow(varA.name)
.getByRole("button", { name: "Disable Row" })
.click();
await environmentPage.disableRow(environmentPage.getRow(varA.name));
const variables = await environmentPage.getVariables();
expect(variables).toEqual([