when refreshing containers, open console window to check for status completion

This commit is contained in:
Asier Isayas
2025-12-31 10:10:33 -05:00
parent 87d5f84f2e
commit d235be6a3b
4 changed files with 37 additions and 18 deletions

View File

@@ -599,7 +599,7 @@ export default class Collection implements ViewModels.Collection {
useSelectedNode.getState().setSelectedNode(this); useSelectedNode.getState().setSelectedNode(this);
const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit;
// // Refresh all databases in case they were deleted outside of user session // // 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(); throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer();
this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings); this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings);

View File

@@ -461,9 +461,10 @@ export class DataExplorer {
await containerNode.expand(); await containerNode.expand();
// refresh tree to remove deleted database // refresh tree to remove deleted database
const consoleMessages = await this.getConsoleMessages();
const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton"); const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
await refreshButton.click(); await refreshButton.click();
await expect(this.getConsoleMessage()).toContainText("Successfully refreshed databases", { await expect(consoleMessages).toContainText("Successfully refreshed databases", {
timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
}); });
@@ -474,10 +475,16 @@ export class DataExplorer {
} }
/** Gets the console message element */ /** Gets the console message element */
getConsoleMessage(): Locator { getConsoleHeaderStatus(): Locator {
return this.frame.getByTestId("notification-console/header-status"); return this.frame.getByTestId("notification-console/header-status");
} }
async getConsoleMessages(): Promise<Locator> {
const expandCollapseConsoleLogsButton = this.frame.getByTestId("NotificationConsole/ExpandCollapseButton");
await expandCollapseConsoleLogsButton.click();
return this.frame.getByTestId("NotificationConsole/Contents");
}
async getDropdownItemByName(name: string, ariaLabel?: string): Promise<Locator> { async getDropdownItemByName(name: string, ariaLabel?: string): Promise<Locator> {
const dropdownItemsWrapper = this.frame.locator("div.ms-Dropdown-items"); const dropdownItemsWrapper = this.frame.locator("div.ms-Dropdown-items");
if (ariaLabel) { if (ariaLabel) {

View File

@@ -41,7 +41,7 @@ test.describe("Autoscale and Manual throughput", () => {
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// Read console message // Read console message
await expect(explorer.getConsoleMessage()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`, `Successfully updated offer for collection ${context.container.id}`,
{ {
timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
@@ -82,7 +82,7 @@ test.describe("Autoscale and Manual throughput", () => {
test("Update manual throughput", async () => { test("Update manual throughput", async () => {
await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString()); await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString());
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`, `Successfully updated offer for collection ${context.container.id}`,
{ {
timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
@@ -119,7 +119,7 @@ test.describe("Autoscale and Manual throughput", () => {
await autoscaleRadioButton.click(); await autoscaleRadioButton.click();
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled(); await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled();
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
`Successfully updated offer for collection ${context.container.id}`, `Successfully updated offer for collection ${context.container.id}`,
{ {
timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,

View File

@@ -30,9 +30,12 @@ test.describe("Settings under Scale & Settings", () => {
await ttlOnNoDefaultRadioButton.click(); await ttlOnNoDefaultRadioButton.click();
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { await expect(explorer.getConsoleHeaderStatus()).toContainText(
timeout: ONE_MINUTE_MS, `Successfully updated container ${context.container.id}`,
}); {
timeout: ONE_MINUTE_MS,
},
);
}); });
test("Update TTL to On (with user entry)", async () => { test("Update TTL to On (with user entry)", async () => {
@@ -44,9 +47,12 @@ test.describe("Settings under Scale & Settings", () => {
await ttlInput.fill("30000"); await ttlInput.fill("30000");
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { await expect(explorer.getConsoleHeaderStatus()).toContainText(
timeout: ONE_MINUTE_MS, `Successfully updated container ${context.container.id}`,
}); {
timeout: ONE_MINUTE_MS,
},
);
}); });
test("Update TTL to Off", async () => { 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" }); const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
await ttlOnNoDefaultRadioButton.click(); await ttlOnNoDefaultRadioButton.click();
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { await expect(explorer.getConsoleHeaderStatus()).toContainText(
timeout: ONE_MINUTE_MS, `Successfully updated container ${context.container.id}`,
}); {
timeout: ONE_MINUTE_MS,
},
);
// Set it to Off // Set it to Off
const ttlOffRadioButton = explorer.frame.getByRole("radio", { name: "ttl-off-option" }); const ttlOffRadioButton = explorer.frame.getByRole("radio", { name: "ttl-off-option" });
await ttlOffRadioButton.click(); await ttlOffRadioButton.click();
await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, { await expect(explorer.getConsoleHeaderStatus()).toContainText(
timeout: ONE_MINUTE_MS, `Successfully updated container ${context.container.id}`,
}); {
timeout: ONE_MINUTE_MS,
},
);
}); });
}); });