From e2e9cece5fb5cf7d58955b3f236f37fd2a946e0e Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Wed, 31 Dec 2025 11:04:54 -0500 Subject: [PATCH] close notification console window after seeing desired log --- test/fx.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/test/fx.ts b/test/fx.ts index 63e572436..393eb59d7 100644 --- a/test/fx.ts +++ b/test/fx.ts @@ -461,12 +461,13 @@ export class DataExplorer { await containerNode.expand(); // refresh tree to remove deleted database - const consoleMessages = await this.getConsoleMessages(); + const consoleMessages = await this.getNotificationConsoleMessages(); const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton"); await refreshButton.click(); await expect(consoleMessages).toContainText("Successfully refreshed databases", { timeout: ONE_MINUTE_MS, }); + await this.collapseNotificationConsole(); const scaleAndSettingsButton = this.frame.getByTestId( `TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`, @@ -479,9 +480,28 @@ export class DataExplorer { return this.frame.getByTestId("notification-console/header-status"); } - async getConsoleMessages(): Promise { - const expandCollapseConsoleLogsButton = this.frame.getByTestId("NotificationConsole/ExpandCollapseButton"); - await expandCollapseConsoleLogsButton.click(); + async expandNotificationConsole(): Promise { + await this.setNotificationConsoleExpanded(true); + } + + async collapseNotificationConsole(): Promise { + await this.setNotificationConsoleExpanded(false); + } + + async setNotificationConsoleExpanded(expanded: boolean): Promise { + const notificationConsoleToggleButton = this.frame.getByTestId("NotificationConsole/ExpandCollapseButton"); + const alt = await notificationConsoleToggleButton.locator("img").getAttribute("alt"); + + // When expanded, the icon says "Collapse icon" + if (expanded && alt === "Expand icon") { + await notificationConsoleToggleButton.click(); + } else if (!expanded && alt === "Collapse icon") { + await notificationConsoleToggleButton.click(); + } + } + + async getNotificationConsoleMessages(): Promise { + await this.setNotificationConsoleExpanded(true); return this.frame.getByTestId("NotificationConsole/Contents"); }