From 722a69e7a8b8544e202dbef22f69a95c4aa9cd43 Mon Sep 17 00:00:00 2001 From: StylusFrost Date: Mon, 3 Nov 2025 19:13:08 +0100 Subject: [PATCH] test(ui): enhance ScansPage with success toast verification - Added a new success toast element to the ScansPage class for better feedback on scan launches. - Updated the verifyScanLaunched method to utilize the new success toast locator, improving the visibility check for successful scan initiation. - This change enhances the user experience by providing clear confirmation of scan actions. --- ui/tests/scans/scans-page.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/tests/scans/scans-page.ts b/ui/tests/scans/scans-page.ts index 92ccfaed9b..05606d952b 100644 --- a/ui/tests/scans/scans-page.ts +++ b/ui/tests/scans/scans-page.ts @@ -12,6 +12,10 @@ export class ScansPage extends BasePage { readonly scanAliasInput: Locator; readonly startNowButton: Locator; + // Scan state elements + readonly successToast: Locator; + + constructor(page: Page) { super(page); @@ -20,6 +24,9 @@ export class ScansPage extends BasePage { this.scanAliasInput = page.getByRole("textbox", { name: "Scan label (optional)" }); this.startNowButton = page.getByRole("button", { name: /Start now|Start scan now/i }); + // Scan state elements + this.successToast = page.getByRole("alert", { name: /The scan was launched successfully\.?/i }); + // Main content elements this.scanTable = page.locator("table"); } @@ -60,13 +67,8 @@ export class ScansPage extends BasePage { async verifyScanLaunched(alias: string): Promise { // Verify the scan was launched - // Optional success toast (best-effort) - const successToast = this.page.getByRole("alert", { name: "The scan was launched successfully." }).getByText( - "The scan was launched successfully.", - ); - // Verify the success toast is visible - await successToast.isVisible().catch(() => {}); + await this.successToast.waitFor({ state: "visible", timeout: 5000 }).catch(() => {}); // Wait for the scans table to be visible await expect(this.scanTable).toBeVisible();