mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-06 04:53:59 -05:00
refactor(tests): implement disableRow method for cleaner row disabling in table editor tests
This commit is contained in:
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([
|
||||
|
||||
Reference in new issue
Block a user