mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-08 20:17:03 +00:00
* Temporarily re-enable key based auth for Mongo and Cassandra tests. * Increase number of shards for playwright tests. * Another small bump to test shard count. * click global new... button then collection in playwright tests * get new table button * create and delete container for every individual scale test * for scale and settings, dont create sample data in container * run scale tests serially * refactor scale setup and tear down to be within each test * record network traces * record network calls on all retries * when disposing of database during playwright test, refresh tree to remove deleted database * refresh tree before opening scale and settings * When opening scale and settings, refresh databases * reload all databases before loading offers * increase time for change partition key request * increase time for change partition key request * refresh databases in test instead of product code * when refreshing containers, open console window to check for status completion * close notification console window after seeing desired log * create and delete a container for each individual test * dont delete database after every test. leave it to the CI * Don't refresh databases when opening Scale+Settings and only delete database if running locally * only open scale and settings at the beginning of each test suite * get it back to working * change settings.spect.ts from serial to parallel * don't delete database after each test * update container creation throughpout to be 5000 * run tests with no throughput limit on the account * adjust scale test to reflect no throughput limit on account * remove test container throughput * don't refresh collections when clicking settings in product code * refactor and run cleanup during pr check * copy cleanup accounts * run cleanup after playwright tests * run cleanup every three hours * revert ci.yml * update cpk test * remove cpk * remove cleanup accounts and add cpk * add cpk * remove cpk changes * revert ci.yml * run cleanup every two hours --------- Co-authored-by: Jade Welton <jawelton@microsoft.com> Co-authored-by: Asier Isayas <aisayas@microsoft.com>
125 lines
4.8 KiB
TypeScript
125 lines
4.8 KiB
TypeScript
import { Browser, expect, Locator, Page, test } from "@playwright/test";
|
|
import {
|
|
CommandBarButton,
|
|
DataExplorer,
|
|
ONE_MINUTE_MS,
|
|
TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K,
|
|
TEST_MANUAL_THROUGHPUT_RU_2K,
|
|
TestAccount,
|
|
} from "../../fx";
|
|
import { createTestSQLContainer, TestContainerContext } from "../../testData";
|
|
|
|
interface SetupResult {
|
|
context: TestContainerContext;
|
|
page: Page;
|
|
explorer: DataExplorer;
|
|
}
|
|
|
|
test.describe("Autoscale throughput", () => {
|
|
let setup: SetupResult;
|
|
|
|
test.beforeAll(async ({ browser }) => {
|
|
setup = await openScaleTab(browser);
|
|
|
|
// Switch manual -> autoscale once for this suite
|
|
const autoscaleRadioButton = setup.explorer.frame.getByText("Autoscale", { exact: true });
|
|
await autoscaleRadioButton.click();
|
|
await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled();
|
|
await setup.explorer.commandBarButton(CommandBarButton.Save).click();
|
|
await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
|
|
`Successfully updated offer for collection ${setup.context.container.id}`,
|
|
{ timeout: 2 * ONE_MINUTE_MS },
|
|
);
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await cleanup(setup);
|
|
});
|
|
|
|
test("Update autoscale max throughput", async () => {
|
|
await getThroughputInput(setup.explorer, "autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K.toString());
|
|
await setup.explorer.commandBarButton(CommandBarButton.Save).click();
|
|
|
|
await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
|
|
`Successfully updated offer for collection ${setup.context.container.id}`,
|
|
{ timeout: 2 * ONE_MINUTE_MS },
|
|
);
|
|
});
|
|
|
|
test("Update autoscale max throughput passed allowed limit", async () => {
|
|
const softAllowedMaxThroughputString = await setup.explorer.frame
|
|
.getByTestId("soft-allowed-maximum-throughput")
|
|
.innerText();
|
|
const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
|
|
|
|
await getThroughputInput(setup.explorer, "autopilot").fill((softAllowedMaxThroughput * 10).toString());
|
|
await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
|
|
await expect(delayedApplyWarning(setup.explorer)).toBeVisible();
|
|
});
|
|
|
|
test("Update autoscale max throughput with invalid increment", async () => {
|
|
await getThroughputInput(setup.explorer, "autopilot").fill("1100");
|
|
await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
|
|
await expect(getThroughputInputErrorMessage(setup.explorer, "autopilot")).toContainText(
|
|
"Throughput value must be in increments of 1000",
|
|
);
|
|
});
|
|
});
|
|
|
|
test.describe("Manual throughput", () => {
|
|
let setup: SetupResult;
|
|
|
|
test.beforeAll(async ({ browser }) => {
|
|
setup = await openScaleTab(browser);
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await cleanup(setup);
|
|
});
|
|
|
|
test("Update manual throughput", async () => {
|
|
await getThroughputInput(setup.explorer, "manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString());
|
|
await setup.explorer.commandBarButton(CommandBarButton.Save).click();
|
|
await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
|
|
`Successfully updated offer for collection ${setup.context.container.id}`,
|
|
{ timeout: 2 * ONE_MINUTE_MS },
|
|
);
|
|
});
|
|
|
|
test("Update manual throughput passed allowed limit", async () => {
|
|
const softAllowedMaxThroughputString = await setup.explorer.frame
|
|
.getByTestId("soft-allowed-maximum-throughput")
|
|
.innerText();
|
|
const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
|
|
|
|
await getThroughputInput(setup.explorer, "manual").fill((softAllowedMaxThroughput * 10).toString());
|
|
await expect(delayedApplyWarning(setup.explorer)).toBeVisible();
|
|
});
|
|
});
|
|
|
|
const delayedApplyWarning = (explorer: DataExplorer): Locator =>
|
|
explorer.frame.locator("#updateThroughputDelayedApplyWarningMessage");
|
|
|
|
const getThroughputInput = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator =>
|
|
explorer.frame.getByTestId(`${type}-throughput-input`);
|
|
|
|
const getThroughputInputErrorMessage = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator =>
|
|
explorer.frame.getByTestId(`${type}-throughput-input-error`);
|
|
|
|
async function openScaleTab(browser: Browser): Promise<SetupResult> {
|
|
const context = await createTestSQLContainer();
|
|
const page = await browser.newPage();
|
|
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
|
|
|
await explorer.openScaleAndSettings(context);
|
|
await explorer.frame.getByTestId("settings-tab-header/ScaleTab").click();
|
|
|
|
return { context, page, explorer };
|
|
}
|
|
|
|
async function cleanup({ context }: Partial<SetupResult>) {
|
|
if (!process.env.CI) {
|
|
await context?.dispose();
|
|
}
|
|
}
|