From d235be6a3bdf70fa42a258382e3b03ea75ce9b82 Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Wed, 31 Dec 2025 10:10:33 -0500 Subject: [PATCH] when refreshing containers, open console window to check for status completion --- src/Explorer/Tree/Collection.ts | 2 +- test/fx.ts | 11 +++++-- test/sql/scaleAndSettings/scale.spec.ts | 6 ++-- test/sql/scaleAndSettings/settings.spec.ts | 36 ++++++++++++++-------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/Explorer/Tree/Collection.ts b/src/Explorer/Tree/Collection.ts index b40fbebae..5f2d0df15 100644 --- a/src/Explorer/Tree/Collection.ts +++ b/src/Explorer/Tree/Collection.ts @@ -599,7 +599,7 @@ export default class Collection implements ViewModels.Collection { useSelectedNode.getState().setSelectedNode(this); const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; // // Refresh all databases in case they were deleted outside of user session - // await this.container.onRefreshResourcesClick(); + await this.container.onRefreshResourcesClick(); throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer(); this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings); diff --git a/test/fx.ts b/test/fx.ts index f59e053c6..63e572436 100644 --- a/test/fx.ts +++ b/test/fx.ts @@ -461,9 +461,10 @@ export class DataExplorer { await containerNode.expand(); // refresh tree to remove deleted database + const consoleMessages = await this.getConsoleMessages(); const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton"); await refreshButton.click(); - await expect(this.getConsoleMessage()).toContainText("Successfully refreshed databases", { + await expect(consoleMessages).toContainText("Successfully refreshed databases", { timeout: ONE_MINUTE_MS, }); @@ -474,10 +475,16 @@ export class DataExplorer { } /** Gets the console message element */ - getConsoleMessage(): Locator { + getConsoleHeaderStatus(): Locator { return this.frame.getByTestId("notification-console/header-status"); } + async getConsoleMessages(): Promise { + const expandCollapseConsoleLogsButton = this.frame.getByTestId("NotificationConsole/ExpandCollapseButton"); + await expandCollapseConsoleLogsButton.click(); + return this.frame.getByTestId("NotificationConsole/Contents"); + } + async getDropdownItemByName(name: string, ariaLabel?: string): Promise { const dropdownItemsWrapper = this.frame.locator("div.ms-Dropdown-items"); if (ariaLabel) { diff --git a/test/sql/scaleAndSettings/scale.spec.ts b/test/sql/scaleAndSettings/scale.spec.ts index 82d46e1c2..d306c4c0f 100644 --- a/test/sql/scaleAndSettings/scale.spec.ts +++ b/test/sql/scaleAndSettings/scale.spec.ts @@ -41,7 +41,7 @@ test.describe("Autoscale and Manual throughput", () => { await explorer.commandBarButton(CommandBarButton.Save).click(); // Read console message - await expect(explorer.getConsoleMessage()).toContainText( + await expect(explorer.getConsoleHeaderStatus()).toContainText( `Successfully updated offer for collection ${context.container.id}`, { timeout: 2 * ONE_MINUTE_MS, @@ -82,7 +82,7 @@ test.describe("Autoscale and Manual throughput", () => { test("Update manual throughput", async () => { await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString()); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText( + await expect(explorer.getConsoleHeaderStatus()).toContainText( `Successfully updated offer for collection ${context.container.id}`, { timeout: 2 * ONE_MINUTE_MS, @@ -119,7 +119,7 @@ test.describe("Autoscale and Manual throughput", () => { await autoscaleRadioButton.click(); await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled(); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText( + await expect(explorer.getConsoleHeaderStatus()).toContainText( `Successfully updated offer for collection ${context.container.id}`, { timeout: ONE_MINUTE_MS, diff --git a/test/sql/scaleAndSettings/settings.spec.ts b/test/sql/scaleAndSettings/settings.spec.ts index af87b7ed7..882c88779 100644 --- a/test/sql/scaleAndSettings/settings.spec.ts +++ b/test/sql/scaleAndSettings/settings.spec.ts @@ -30,9 +30,12 @@ test.describe("Settings under Scale & Settings", () => { await ttlOnNoDefaultRadioButton.click(); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { - timeout: ONE_MINUTE_MS, - }); + await expect(explorer.getConsoleHeaderStatus()).toContainText( + `Successfully updated container ${context.container.id}`, + { + timeout: ONE_MINUTE_MS, + }, + ); }); test("Update TTL to On (with user entry)", async () => { @@ -44,9 +47,12 @@ test.describe("Settings under Scale & Settings", () => { await ttlInput.fill("30000"); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { - timeout: ONE_MINUTE_MS, - }); + await expect(explorer.getConsoleHeaderStatus()).toContainText( + `Successfully updated container ${context.container.id}`, + { + timeout: ONE_MINUTE_MS, + }, + ); }); test("Update TTL to Off", async () => { @@ -54,17 +60,23 @@ test.describe("Settings under Scale & Settings", () => { const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" }); await ttlOnNoDefaultRadioButton.click(); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { - timeout: ONE_MINUTE_MS, - }); + await expect(explorer.getConsoleHeaderStatus()).toContainText( + `Successfully updated container ${context.container.id}`, + { + timeout: ONE_MINUTE_MS, + }, + ); // Set it to Off const ttlOffRadioButton = explorer.frame.getByRole("radio", { name: "ttl-off-option" }); await ttlOffRadioButton.click(); await explorer.commandBarButton(CommandBarButton.Save).click(); - await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { - timeout: ONE_MINUTE_MS, - }); + await expect(explorer.getConsoleHeaderStatus()).toContainText( + `Successfully updated container ${context.container.id}`, + { + timeout: ONE_MINUTE_MS, + }, + ); }); });