Skip to content

Commit

Permalink
fix: reduce flakiness for instance panel e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Hu <[email protected]>
  • Loading branch information
MasWho committed Feb 20, 2025
1 parent e751537 commit 0199e37
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/helpers/instancePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const startInstanceFromPanel = async (page: Page, instance: string) => {
});
const startButton = instanceDetailPanel.locator("css=button[title=Start]");
await startButton.click();
await page.waitForSelector(`text=Instance ${instance} started.`);
await checkInstanceStatus(page, instance, "Running");
};

export const stopInstanceFromPanel = async (page: Page, instance: string) => {
Expand All @@ -43,7 +43,7 @@ export const stopInstanceFromPanel = async (page: Page, instance: string) => {
hasText: "Stop",
});
await confirmStopButton.click();
await page.waitForSelector(`text=Instance ${instance} stopped.`);
await checkInstanceStatus(page, instance, "Stopped");
};

export const navigateToInstanceDetails = async (
Expand All @@ -62,3 +62,16 @@ export const navigateToInstanceDetails = async (
});
await expect(instanceDetailTitle).toBeVisible();
};

export const checkInstanceStatus = async (
page: Page,
instance: string,
status: string,
) => {
await page.waitForLoadState("networkidle");
await gotoURL(page, "/ui/");
await openInstancePanel(page, instance);
const sidePanel = page.getByLabel("Side panel");
const statusRow = sidePanel.getByRole("row", { name: "Status" });
await expect(statusRow.getByRole("cell", { name: status })).toBeVisible();
};

0 comments on commit 0199e37

Please sign in to comment.