Re-enable remaining tests.

This commit is contained in:
Jade Welton
2026-07-10 14:03:44 -07:00
parent c19c1dc5fd
commit fec40b7dff
10 changed files with 1360 additions and 1360 deletions
+171 -171
View File
@@ -1,212 +1,212 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { existsSync, mkdtempSync, rmdirSync, unlinkSync, writeFileSync } from "fs"; import { existsSync, mkdtempSync, rmdirSync, unlinkSync, writeFileSync } from "fs";
// import { tmpdir } from "os"; import { tmpdir } from "os";
// import path from "path"; import path from "path";
// import { CommandBarButton, DataExplorer, DocumentsTab, ONE_MINUTE_MS, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, DocumentsTab, ONE_MINUTE_MS, TestAccount } from "../fx";
// import { import {
// createTestSQLContainer, createTestSQLContainer,
// itemsPerPartition, itemsPerPartition,
// partitionCount, partitionCount,
// retry, retry,
// setPartitionKeys, setPartitionKeys,
// TestContainerContext, TestContainerContext,
// TestData, TestData,
// } from "../testData"; } from "../testData";
// import { documentTestCases } from "./testCases"; import { documentTestCases } from "./testCases";
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// let documentsTab: DocumentsTab = null!; let documentsTab: DocumentsTab = null!;
// for (const { name, databaseId, containerId, documents } of documentTestCases) { for (const { name, databaseId, containerId, documents } of documentTestCases) {
// test.describe(`Test SQL Documents with ${name}`, () => { test.describe(`Test SQL Documents with ${name}`, () => {
// // test.skip(true, "Temporarily disabling all tests in this spec file"); // test.skip(true, "Temporarily disabling all tests in this spec file");
// test.beforeEach("Open documents tab", async ({ page }) => { test.beforeEach("Open documents tab", async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQLReadOnly); explorer = await DataExplorer.open(page, TestAccount.SQLReadOnly);
// const containerNode = await explorer.waitForContainerNode(databaseId, containerId); const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
// await containerNode.expand(); await containerNode.expand();
// const containerMenuNode = await explorer.waitForContainerItemsNode(databaseId, containerId); const containerMenuNode = await explorer.waitForContainerItemsNode(databaseId, containerId);
// await containerMenuNode.element.click(); await containerMenuNode.element.click();
// documentsTab = explorer.documentsTab("tab0"); documentsTab = explorer.documentsTab("tab0");
// await documentsTab.documentsFilter.waitFor(); await documentsTab.documentsFilter.waitFor();
// await documentsTab.documentsListPane.waitFor(); await documentsTab.documentsListPane.waitFor();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// }); });
// for (const document of documents) { for (const document of documents) {
// const { documentId: docId, partitionKeys, skipCreateDelete } = document; const { documentId: docId, partitionKeys, skipCreateDelete } = document;
// test.describe(`Document ID: ${docId}`, () => { test.describe(`Document ID: ${docId}`, () => {
// test(`should load and view document ${docId}`, async () => { test(`should load and view document ${docId}`, async () => {
// test.skip(); test.skip();
// const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0); const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
// await span.waitFor(); await span.waitFor();
// await expect(span).toBeVisible(); await expect(span).toBeVisible();
// await span.click(); await span.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// const resultText = await documentsTab.resultsEditor.text(); const resultText = await documentsTab.resultsEditor.text();
// const resultData = JSON.parse(resultText!); const resultData = JSON.parse(resultText!);
// expect(resultText).not.toBeNull(); expect(resultText).not.toBeNull();
// expect(resultData?.id).toEqual(docId); expect(resultData?.id).toEqual(docId);
// }); });
// const testOrSkip = skipCreateDelete ? test.skip : test; const testOrSkip = skipCreateDelete ? test.skip : test;
// testOrSkip(`should be able to create and delete new document from ${docId}`, async ({ page }) => { testOrSkip(`should be able to create and delete new document from ${docId}`, async ({ page }) => {
// test.skip(); test.skip();
// const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0); const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
// await span.waitFor(); await span.waitFor();
// await expect(span).toBeVisible(); await expect(span).toBeVisible();
// await span.click(); await span.click();
// let newDocumentId; let newDocumentId;
// await page.waitForTimeout(5000); await page.waitForTimeout(5000);
// await retry(async () => { await retry(async () => {
// const newDocumentButton = await explorer.waitForCommandBarButton("New Item", 5000); const newDocumentButton = await explorer.waitForCommandBarButton("New Item", 5000);
// await expect(newDocumentButton).toBeVisible(); await expect(newDocumentButton).toBeVisible();
// await expect(newDocumentButton).toBeEnabled(); await expect(newDocumentButton).toBeEnabled();
// await newDocumentButton.click(); await newDocumentButton.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// newDocumentId = `${Date.now().toString()}-delete`; newDocumentId = `${Date.now().toString()}-delete`;
// const newDocument = { const newDocument = {
// id: newDocumentId, id: newDocumentId,
// ...setPartitionKeys(partitionKeys || []), ...setPartitionKeys(partitionKeys || []),
// }; };
// await documentsTab.resultsEditor.setText(JSON.stringify(newDocument)); await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
// const saveButton = await explorer.waitForCommandBarButton("Save", 5000); const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
// await saveButton.click({ timeout: 5000 }); await saveButton.click({ timeout: 5000 });
// await expect(saveButton).toBeHidden({ timeout: 5000 }); await expect(saveButton).toBeHidden({ timeout: 5000 });
// }, 3); }, 3);
// await documentsTab.setFilter(`WHERE c.id = "${newDocumentId}"`); await documentsTab.setFilter(`WHERE c.id = "${newDocumentId}"`);
// await documentsTab.filterButton.click(); await documentsTab.filterButton.click();
// const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0); const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
// await newSpan.waitFor(); await newSpan.waitFor();
// await newSpan.click(); await newSpan.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// const deleteButton = await explorer.waitForCommandBarButton("Delete", 5000); const deleteButton = await explorer.waitForCommandBarButton("Delete", 5000);
// await deleteButton.click(); await deleteButton.click();
// const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000); const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000);
// await deleteDialogButton.click(); await deleteDialogButton.click();
// const deletedSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0); const deletedSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
// await expect(deletedSpan).toHaveCount(0); await expect(deletedSpan).toHaveCount(0);
// }); });
// }); });
// } }
// }); });
// } }
// test.describe.serial("Upload Item", () => { test.describe.serial("Upload Item", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let uploadDocumentDirPath: string = null!; let uploadDocumentDirPath: string = null!;
// let uploadDocumentFilePath: string = null!; let uploadDocumentFilePath: string = null!;
// test.beforeAll("Create Test database and open documents tab", async ({ browser }) => { test.beforeAll("Create Test database and open documents tab", async ({ browser }) => {
// uploadDocumentDirPath = mkdtempSync(path.join(tmpdir(), "upload-document-")); uploadDocumentDirPath = mkdtempSync(path.join(tmpdir(), "upload-document-"));
// uploadDocumentFilePath = path.join(uploadDocumentDirPath, "uploadDocument.json"); uploadDocumentFilePath = path.join(uploadDocumentDirPath, "uploadDocument.json");
// const page = await browser.newPage(); const page = await browser.newPage();
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.expand(); await containerNode.expand();
// const containerMenuNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id); const containerMenuNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id);
// await containerMenuNode.element.click(); await containerMenuNode.element.click();
// // We need to click twice in order to remove a tooltip // We need to click twice in order to remove a tooltip
// await containerMenuNode.element.click(); await containerMenuNode.element.click();
// }); });
// test.afterAll("Delete Test Database and uploadDocument temp folder", async () => { test.afterAll("Delete Test Database and uploadDocument temp folder", async () => {
// if (existsSync(uploadDocumentFilePath)) { if (existsSync(uploadDocumentFilePath)) {
// unlinkSync(uploadDocumentFilePath); unlinkSync(uploadDocumentFilePath);
// } }
// if (existsSync(uploadDocumentDirPath)) { if (existsSync(uploadDocumentDirPath)) {
// rmdirSync(uploadDocumentDirPath); rmdirSync(uploadDocumentDirPath);
// } }
// await context?.dispose(); await context?.dispose();
// }); });
// test.afterEach("Close Upload Items panel if still open", async () => { test.afterEach("Close Upload Items panel if still open", async () => {
// const closeUploadItemsPanelButton = explorer.frame.getByLabel("Close Upload Items"); const closeUploadItemsPanelButton = explorer.frame.getByLabel("Close Upload Items");
// if (await closeUploadItemsPanelButton.isVisible()) { if (await closeUploadItemsPanelButton.isVisible()) {
// await closeUploadItemsPanelButton.click(); await closeUploadItemsPanelButton.click();
// } }
// }); });
// test("upload document", async () => { test("upload document", async () => {
// test.skip(); test.skip();
// // Create file to upload // Create file to upload
// const TestDataJsonString: string = JSON.stringify(TestData, null, 2); const TestDataJsonString: string = JSON.stringify(TestData, null, 2);
// writeFileSync(uploadDocumentFilePath, TestDataJsonString); writeFileSync(uploadDocumentFilePath, TestDataJsonString);
// const uploadItemCommandBar = explorer.commandBarButton(CommandBarButton.UploadItem); const uploadItemCommandBar = explorer.commandBarButton(CommandBarButton.UploadItem);
// await uploadItemCommandBar.click(); await uploadItemCommandBar.click();
// // Select file to upload // Select file to upload
// await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath); await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath);
// const uploadButton = explorer.frame.getByTestId("Panel/OkButton"); const uploadButton = explorer.frame.getByTestId("Panel/OkButton");
// await uploadButton.click(); await uploadButton.click();
// // Verify upload success message // Verify upload success message
// const fileUploadStatusExpected: string = `${partitionCount * itemsPerPartition} created, 0 throttled, 0 errors`; const fileUploadStatusExpected: string = `${partitionCount * itemsPerPartition} created, 0 throttled, 0 errors`;
// const fileUploadStatus = explorer.frame.getByTestId("file-upload-status"); const fileUploadStatus = explorer.frame.getByTestId("file-upload-status");
// await expect(fileUploadStatus).toContainText(fileUploadStatusExpected, { await expect(fileUploadStatus).toContainText(fileUploadStatusExpected, {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }); });
// // Select file to upload again // Select file to upload again
// await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath); await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath);
// await uploadButton.click(); await uploadButton.click();
// // Verify upload failure message // Verify upload failure message
// const errorIcon = explorer.frame.getByRole("img", { name: "error" }); const errorIcon = explorer.frame.getByRole("img", { name: "error" });
// await expect(errorIcon).toBeVisible({ timeout: ONE_MINUTE_MS }); await expect(errorIcon).toBeVisible({ timeout: ONE_MINUTE_MS });
// await expect(fileUploadStatus).toContainText( await expect(fileUploadStatus).toContainText(
// `0 created, 0 throttled, ${partitionCount * itemsPerPartition} errors`, `0 created, 0 throttled, ${partitionCount * itemsPerPartition} errors`,
// { {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("upload invalid json", async () => { test("upload invalid json", async () => {
// test.skip(); test.skip();
// // Create file to upload // Create file to upload
// let TestDataJsonString: string = JSON.stringify(TestData, null, 2); let TestDataJsonString: string = JSON.stringify(TestData, null, 2);
// // Remove the first '[' so that it becomes invalid json // Remove the first '[' so that it becomes invalid json
// TestDataJsonString = TestDataJsonString.substring(1); TestDataJsonString = TestDataJsonString.substring(1);
// writeFileSync(uploadDocumentFilePath, TestDataJsonString); writeFileSync(uploadDocumentFilePath, TestDataJsonString);
// const uploadItemCommandBar = explorer.commandBarButton(CommandBarButton.UploadItem); const uploadItemCommandBar = explorer.commandBarButton(CommandBarButton.UploadItem);
// await uploadItemCommandBar.click(); await uploadItemCommandBar.click();
// // Select file to upload // Select file to upload
// await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath); await explorer.frame.setInputFiles("#importFileInput", uploadDocumentFilePath);
// const uploadButton = explorer.frame.getByTestId("Panel/OkButton"); const uploadButton = explorer.frame.getByTestId("Panel/OkButton");
// await uploadButton.click(); await uploadButton.click();
// // Verify upload failure message // Verify upload failure message
// const fileUploadErrorList = explorer.frame.getByLabel("error list"); const fileUploadErrorList = explorer.frame.getByLabel("error list");
// // The parsing error will show up differently in different browsers so just check for the word "JSON" // The parsing error will show up differently in different browsers so just check for the word "JSON"
// await expect(fileUploadErrorList).toContainText("JSON", { await expect(fileUploadErrorList).toContainText("JSON", {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }); });
// }); });
// }); });
+116 -116
View File
@@ -1,144 +1,144 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { CommandBarButton, DataExplorer, Editor, QueryTab, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, Editor, QueryTab, TestAccount } from "../fx";
// import { TestContainerContext, TestItem, createTestSQLContainer } from "../testData"; import { TestContainerContext, TestItem, createTestSQLContainer } from "../testData";
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// let queryTab: QueryTab = null!; let queryTab: QueryTab = null!;
// let queryEditor: Editor = null!; let queryEditor: Editor = null!;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer({ includeTestData: true }); context = await createTestSQLContainer({ includeTestData: true });
// }); });
// test.beforeEach("Open new query tab", async ({ page }) => { test.beforeEach("Open new query tab", async ({ page }) => {
// // Open a query tab // Open a query tab
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// // Container nodes should be visible. The explorer auto-expands database nodes when they are first loaded. // Container nodes should be visible. The explorer auto-expands database nodes when they are first loaded.
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.openContextMenu(); await containerNode.openContextMenu();
// await containerNode.contextMenuItem("New SQL Query").click(); await containerNode.contextMenuItem("New SQL Query").click();
// // Wait for the editor to load // Wait for the editor to load
// queryTab = explorer.queryTab("tab0"); queryTab = explorer.queryTab("tab0");
// queryEditor = queryTab.editor(); queryEditor = queryTab.editor();
// await queryEditor.locator.waitFor({ timeout: 30 * 1000 }); await queryEditor.locator.waitFor({ timeout: 30 * 1000 });
// await queryTab.executeCTA.waitFor(); await queryTab.executeCTA.waitFor();
// await explorer.frame.getByTestId("NotificationConsole/ExpandCollapseButton").click(); await explorer.frame.getByTestId("NotificationConsole/ExpandCollapseButton").click();
// await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor(); await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
// }); });
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// test("Query results", async () => { test("Query results", async () => {
// test.skip(); test.skip();
// // Run the query and verify the results // Run the query and verify the results
// await queryEditor.locator.click(); await queryEditor.locator.click();
// const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery); const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
// await executeQueryButton.click(); await executeQueryButton.click();
// await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// // Read the results // Read the results
// const resultText = await queryTab.resultsEditor.text(); const resultText = await queryTab.resultsEditor.text();
// expect(resultText).not.toBeNull(); expect(resultText).not.toBeNull();
// const resultData: TestItem[] = JSON.parse(resultText!); const resultData: TestItem[] = JSON.parse(resultText!);
// // Pick 3 random documents and assert them // Pick 3 random documents and assert them
// const randomDocs = [0, 1, 2].map(() => resultData[Math.floor(Math.random() * resultData.length)]); const randomDocs = [0, 1, 2].map(() => resultData[Math.floor(Math.random() * resultData.length)]);
// randomDocs.forEach((doc) => { randomDocs.forEach((doc) => {
// const matchingDoc = context?.testData.get(doc.id); const matchingDoc = context?.testData.get(doc.id);
// expect(matchingDoc).not.toBeNull(); expect(matchingDoc).not.toBeNull();
// expect(doc.randomData).toEqual(matchingDoc?.randomData); expect(doc.randomData).toEqual(matchingDoc?.randomData);
// expect(doc.partitionKey).toEqual(matchingDoc?.partitionKey); expect(doc.partitionKey).toEqual(matchingDoc?.partitionKey);
// }); });
// }); });
// test("Query stats", async () => { test("Query stats", async () => {
// test.skip(); test.skip();
// // Run the query and verify the results // Run the query and verify the results
// await queryEditor.locator.click(); await queryEditor.locator.click();
// const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery); const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
// await executeQueryButton.click(); await executeQueryButton.click();
// await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// // Open the query stats tab and validate some data there // Open the query stats tab and validate some data there
// queryTab.queryStatsTab.click(); queryTab.queryStatsTab.click();
// await expect(queryTab.queryStatsList).toBeAttached(); await expect(queryTab.queryStatsList).toBeAttached();
// const showingResultsCell = queryTab.queryStatsList.getByTestId("Row:Showing Results/Column:value"); const showingResultsCell = queryTab.queryStatsList.getByTestId("Row:Showing Results/Column:value");
// await expect(showingResultsCell).toContainText(/\d+ - \d+/); await expect(showingResultsCell).toContainText(/\d+ - \d+/);
// }); });
// test("Query errors", async () => { test("Query errors", async () => {
// test.skip(true, "Disabled due to an issue with error reporting in the backend."); test.skip(true, "Disabled due to an issue with error reporting in the backend.");
// await queryEditor.locator.click(); await queryEditor.locator.click();
// await queryEditor.setText("SELECT\n glarb(c.id),\n blarg(c.id)\nFROM c"); await queryEditor.setText("SELECT\n glarb(c.id),\n blarg(c.id)\nFROM c");
// // Run the query and verify the results // Run the query and verify the results
// const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery); const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
// await executeQueryButton.click(); await executeQueryButton.click();
// await expect(queryTab.errorList).toBeAttached({ timeout: 60 * 1000 }); await expect(queryTab.errorList).toBeAttached({ timeout: 60 * 1000 });
// // Validating the squiggles requires a lot of digging through the Monaco model, OR a screenshot comparison. // Validating the squiggles requires a lot of digging through the Monaco model, OR a screenshot comparison.
// // The screenshot ended up being fairly flaky, and a pain to maintain, so I decided not to include validation for the squiggles. // The screenshot ended up being fairly flaky, and a pain to maintain, so I decided not to include validation for the squiggles.
// // Validate the errors are in the list // Validate the errors are in the list
// await expect(queryTab.errorList.getByTestId("Row:0/Column:code")).toHaveText("SC2005"); await expect(queryTab.errorList.getByTestId("Row:0/Column:code")).toHaveText("SC2005");
// await expect(queryTab.errorList.getByTestId("Row:0/Column:location")).toHaveText("Line 2"); await expect(queryTab.errorList.getByTestId("Row:0/Column:location")).toHaveText("Line 2");
// await expect(queryTab.errorList.getByTestId("Row:1/Column:code")).toHaveText("SC2005"); await expect(queryTab.errorList.getByTestId("Row:1/Column:code")).toHaveText("SC2005");
// await expect(queryTab.errorList.getByTestId("Row:1/Column:location")).toHaveText("Line 3"); await expect(queryTab.errorList.getByTestId("Row:1/Column:location")).toHaveText("Line 3");
// }); });
// test("View button toggles between vertical and horizontal layout", async () => { test("View button toggles between vertical and horizontal layout", async () => {
// // The default layout is Horizontal (Allotment vertical={true} → split-view-vertical class) // The default layout is Horizontal (Allotment vertical={true} → split-view-vertical class)
// const allotment = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotment = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotment).toBeAttached(); await expect(allotment).toBeAttached();
// await expect(allotment).toHaveClass(/split-view-vertical/); await expect(allotment).toHaveClass(/split-view-vertical/);
// // Click the main View button (not the chevron) to toggle to Vertical layout // Click the main View button (not the chevron) to toggle to Vertical layout
// const viewButton = explorer.commandBarButton(CommandBarButton.View); const viewButton = explorer.commandBarButton(CommandBarButton.View);
// await viewButton.click(); await viewButton.click();
// // After toggle, Allotment should have split-view-horizontal class (Vertical direction) // After toggle, Allotment should have split-view-horizontal class (Vertical direction)
// const allotmentAfterToggle = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotmentAfterToggle = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotmentAfterToggle).toHaveClass(/split-view-horizontal/); await expect(allotmentAfterToggle).toHaveClass(/split-view-horizontal/);
// // Click again to toggle back to Horizontal // Click again to toggle back to Horizontal
// await viewButton.click(); await viewButton.click();
// const allotmentAfterSecondToggle = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotmentAfterSecondToggle = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotmentAfterSecondToggle).toHaveClass(/split-view-vertical/); await expect(allotmentAfterSecondToggle).toHaveClass(/split-view-vertical/);
// }); });
// test("View dropdown allows selecting vertical or horizontal layout", async () => { test("View dropdown allows selecting vertical or horizontal layout", async () => {
// test.skip(); test.skip();
// // The default layout is Horizontal (split-view-vertical) // The default layout is Horizontal (split-view-vertical)
// const allotment = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotment = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotment).toHaveClass(/split-view-vertical/); await expect(allotment).toHaveClass(/split-view-vertical/);
// // Find the View split button's menu trigger (chevron). // Find the View split button's menu trigger (chevron).
// // The primary button has data-test, so navigate to the split button container and find the menu button. // The primary button has data-test, so navigate to the split button container and find the menu button.
// const viewPrimaryButton = explorer.commandBarButton(CommandBarButton.View); const viewPrimaryButton = explorer.commandBarButton(CommandBarButton.View);
// const splitContainer = viewPrimaryButton.locator(".."); const splitContainer = viewPrimaryButton.locator("..");
// const menuButton = splitContainer.locator('[aria-haspopup="true"]'); const menuButton = splitContainer.locator('[aria-haspopup="true"]');
// await menuButton.click(); await menuButton.click();
// // Select "Vertical" from the dropdown menu // Select "Vertical" from the dropdown menu
// await explorer.frame.getByRole("menuitem", { name: "Vertical" }).click(); await explorer.frame.getByRole("menuitem", { name: "Vertical" }).click();
// // Verify the layout changed to Vertical (split-view-horizontal) // Verify the layout changed to Vertical (split-view-horizontal)
// const allotmentAfterVertical = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotmentAfterVertical = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotmentAfterVertical).toHaveClass(/split-view-horizontal/); await expect(allotmentAfterVertical).toHaveClass(/split-view-horizontal/);
// // Open dropdown again and select "Horizontal" // Open dropdown again and select "Horizontal"
// await menuButton.click(); await menuButton.click();
// await explorer.frame.getByRole("menuitem", { name: "Horizontal" }).click(); await explorer.frame.getByRole("menuitem", { name: "Horizontal" }).click();
// // Verify it reverted to Horizontal (split-view-vertical) // Verify it reverted to Horizontal (split-view-vertical)
// const allotmentAfterHorizontal = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal"); const allotmentAfterHorizontal = queryTab.locator.locator(".split-view-vertical, .split-view-horizontal");
// await expect(allotmentAfterHorizontal).toHaveClass(/split-view-vertical/); await expect(allotmentAfterHorizontal).toHaveClass(/split-view-vertical/);
// }); });
@@ -1,140 +1,140 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { DataExplorer, TestAccount } from "../../fx"; import { DataExplorer, TestAccount } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// test.describe("Change Partition Key", () => { test.describe("Change Partition Key", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// const newPartitionKeyPath = "newPartitionKey"; const newPartitionKeyPath = "newPartitionKey";
// const newContainerId = "testcontainer_1"; const newContainerId = "testcontainer_1";
// let previousJobName: string | undefined; let previousJobName: string | undefined;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// }); });
// test.beforeEach("Open container settings", async ({ page }) => { test.beforeEach("Open container settings", async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// // Click Scale & Settings and open Partition Key tab // Click Scale & Settings and open Partition Key tab
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// const PartitionKeyTab = explorer.frame.getByTestId("settings-tab-header/PartitionKeyTab"); const PartitionKeyTab = explorer.frame.getByTestId("settings-tab-header/PartitionKeyTab");
// await expect(PartitionKeyTab).toBeVisible(); await expect(PartitionKeyTab).toBeVisible();
// await PartitionKeyTab.click(); await PartitionKeyTab.click();
// }); });
// test.afterEach("Delete Test Database", async () => { test.afterEach("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// test("Change partition key path", async ({ page }) => { test("Change partition key path", async ({ page }) => {
// test.skip(); test.skip();
// await expect(explorer.frame.getByText("/partitionKey")).toBeVisible(); await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();
// await expect(explorer.frame.getByText("Change partition key")).toBeVisible(); await expect(explorer.frame.getByText("Change partition key")).toBeVisible();
// await expect(explorer.frame.getByText(/To safeguard the integrity of/)).toBeVisible(); await expect(explorer.frame.getByText(/To safeguard the integrity of/)).toBeVisible();
// await expect(explorer.frame.getByText(/To change the partition key/)).toBeVisible(); await expect(explorer.frame.getByText(/To change the partition key/)).toBeVisible();
// const changePartitionKeyButton = explorer.frame.getByTestId("change-partition-key-button"); const changePartitionKeyButton = explorer.frame.getByTestId("change-partition-key-button");
// expect(changePartitionKeyButton).toBeVisible(); expect(changePartitionKeyButton).toBeVisible();
// await changePartitionKeyButton.click(); await changePartitionKeyButton.click();
// // Fill out new partition key form in the panel // Fill out new partition key form in the panel
// const changePkPanel = explorer.frame.getByTestId(`Panel:Change partition key`); const changePkPanel = explorer.frame.getByTestId(`Panel:Change partition key`);
// await expect(changePkPanel.getByText(context.database.id)).toBeVisible(); await expect(changePkPanel.getByText(context.database.id)).toBeVisible();
// await expect(explorer.frame.getByRole("heading", { name: "Change partition key" })).toBeVisible(); await expect(explorer.frame.getByRole("heading", { name: "Change partition key" })).toBeVisible();
// await expect(explorer.frame.getByText(/When changing a container/)).toBeVisible(); await expect(explorer.frame.getByText(/When changing a container/)).toBeVisible();
// // Try to switch to new container // Try to switch to new container
// await expect(changePkPanel.getByText("New container")).toBeVisible(); await expect(changePkPanel.getByText("New container")).toBeVisible();
// await expect(changePkPanel.getByText("Existing container")).toBeVisible(); await expect(changePkPanel.getByText("Existing container")).toBeVisible();
// await expect(changePkPanel.getByTestId("new-container-id-input")).toBeVisible(); await expect(changePkPanel.getByTestId("new-container-id-input")).toBeVisible();
// changePkPanel.getByTestId("new-container-id-input").fill(newContainerId); changePkPanel.getByTestId("new-container-id-input").fill(newContainerId);
// await expect(changePkPanel.getByTestId("new-container-partition-key-input")).toBeVisible(); await expect(changePkPanel.getByTestId("new-container-partition-key-input")).toBeVisible();
// changePkPanel.getByTestId("new-container-partition-key-input").fill(newPartitionKeyPath); changePkPanel.getByTestId("new-container-partition-key-input").fill(newPartitionKeyPath);
// await expect(changePkPanel.getByTestId("add-sub-partition-key-button")).toBeVisible(); await expect(changePkPanel.getByTestId("add-sub-partition-key-button")).toBeVisible();
// changePkPanel.getByTestId("add-sub-partition-key-button").click(); changePkPanel.getByTestId("add-sub-partition-key-button").click();
// await expect(changePkPanel.getByTestId("new-container-sub-partition-key-input-0")).toBeVisible(); await expect(changePkPanel.getByTestId("new-container-sub-partition-key-input-0")).toBeVisible();
// await expect(changePkPanel.getByTestId("remove-sub-partition-key-button-0")).toBeVisible(); await expect(changePkPanel.getByTestId("remove-sub-partition-key-button-0")).toBeVisible();
// await expect(changePkPanel.getByTestId("hierarchical-partitioning-info-text")).toBeVisible(); await expect(changePkPanel.getByTestId("hierarchical-partitioning-info-text")).toBeVisible();
// await changePkPanel.getByTestId("remove-sub-partition-key-button-0").click(); await changePkPanel.getByTestId("remove-sub-partition-key-button-0").click();
// await changePkPanel.getByTestId("Panel/OkButton").click(); await changePkPanel.getByTestId("Panel/OkButton").click();
// let jobName: string | undefined; let jobName: string | undefined;
// await page.waitForRequest( await page.waitForRequest(
// (req) => { (req) => {
// const requestUrl = req.url(); const requestUrl = req.url();
// if (requestUrl.includes("/dataTransferJobs") && req.method() === "PUT") { if (requestUrl.includes("/dataTransferJobs") && req.method() === "PUT") {
// jobName = new URL(requestUrl).pathname.split("/").pop(); jobName = new URL(requestUrl).pathname.split("/").pop();
// return true; return true;
// } }
// return false; return false;
// }, },
// { timeout: 120000 }, { timeout: 120000 },
// ); );
// await expect(changePkPanel).not.toBeVisible({ timeout: 5 * 60 * 1000 }); await expect(changePkPanel).not.toBeVisible({ timeout: 5 * 60 * 1000 });
// // Verify partition key change job // Verify partition key change job
// const jobText = explorer.frame.getByText(/Partition key change job/); const jobText = explorer.frame.getByText(/Partition key change job/);
// await expect(jobText).toBeVisible(); await expect(jobText).toBeVisible();
// // await expect(explorer.frame.locator(".ms-ProgressIndicator-itemName")).toContainText("Portal_testcontainer_1"); // await expect(explorer.frame.locator(".ms-ProgressIndicator-itemName")).toContainText("Portal_testcontainer_1");
// await expect(explorer.frame.locator(".ms-ProgressIndicator-itemName")).toContainText(jobName!); await expect(explorer.frame.locator(".ms-ProgressIndicator-itemName")).toContainText(jobName!);
// const jobRow = explorer.frame.locator(".ms-ProgressIndicator-itemDescription"); const jobRow = explorer.frame.locator(".ms-ProgressIndicator-itemDescription");
// // await expect(jobRow.getByText("Pending")).toBeVisible({ timeout: 30 * 1000 }); // await expect(jobRow.getByText("Pending")).toBeVisible({ timeout: 30 * 1000 });
// await expect(jobRow.getByText("Completed")).toBeVisible({ timeout: 5 * 60 * 1000 }); await expect(jobRow.getByText("Completed")).toBeVisible({ timeout: 5 * 60 * 1000 });
// const newContainerNode = await explorer.waitForContainerNode(context.database.id, newContainerId); const newContainerNode = await explorer.waitForContainerNode(context.database.id, newContainerId);
// expect(newContainerNode).not.toBeNull(); expect(newContainerNode).not.toBeNull();
// // Now try to switch to existing container // Now try to switch to existing container
// // Ensure this job name is different from the previously processed job name // Ensure this job name is different from the previously processed job name
// previousJobName = jobName; previousJobName = jobName;
// await changePartitionKeyButton.click(); await changePartitionKeyButton.click();
// await changePkPanel.getByText("Existing container").click(); await changePkPanel.getByText("Existing container").click();
// await changePkPanel.getByLabel("Use existing container").check(); await changePkPanel.getByLabel("Use existing container").check();
// await changePkPanel.getByText("Choose an existing container").click(); await changePkPanel.getByText("Choose an existing container").click();
// const containerDropdownItem = await explorer.getDropdownItemByName(newContainerId, "Existing Containers"); const containerDropdownItem = await explorer.getDropdownItemByName(newContainerId, "Existing Containers");
// await containerDropdownItem.click(); await containerDropdownItem.click();
// let secondJobName: string | undefined; let secondJobName: string | undefined;
// await Promise.all([ await Promise.all([
// page.waitForRequest( page.waitForRequest(
// (req) => { (req) => {
// const requestUrl = req.url(); const requestUrl = req.url();
// if (requestUrl.includes("/dataTransferJobs") && req.method() === "PUT") { if (requestUrl.includes("/dataTransferJobs") && req.method() === "PUT") {
// secondJobName = new URL(requestUrl).pathname.split("/").pop(); secondJobName = new URL(requestUrl).pathname.split("/").pop();
// return true; return true;
// } }
// return false; return false;
// }, },
// { timeout: 120000 }, { timeout: 120000 },
// ), ),
// changePkPanel.getByTestId("Panel/OkButton").click(), changePkPanel.getByTestId("Panel/OkButton").click(),
// ]); ]);
// const cancelButton = explorer.frame.getByRole("button", { name: "Cancel" }); const cancelButton = explorer.frame.getByRole("button", { name: "Cancel" });
// const isCancelButtonVisible = await cancelButton.isVisible().catch(() => false); const isCancelButtonVisible = await cancelButton.isVisible().catch(() => false);
// if (isCancelButtonVisible) { if (isCancelButtonVisible) {
// await cancelButton.click(); await cancelButton.click();
// // Dismiss overlay if it appears // Dismiss overlay if it appears
// const overlayFrame = explorer.frame.locator("#webpack-dev-server-client-overlay").first(); const overlayFrame = explorer.frame.locator("#webpack-dev-server-client-overlay").first();
// if (await overlayFrame.count()) { if (await overlayFrame.count()) {
// await overlayFrame.contentFrame().getByLabel("Dismiss").click(); await overlayFrame.contentFrame().getByLabel("Dismiss").click();
// } }
// const cancelledJobRow = explorer.frame.getByTestId("Tab:tab0"); const cancelledJobRow = explorer.frame.getByTestId("Tab:tab0");
// await expect(cancelledJobRow.getByText("Cancelled")).toBeVisible({ timeout: 30 * 1000 }); await expect(cancelledJobRow.getByText("Cancelled")).toBeVisible({ timeout: 30 * 1000 });
// } else { } else {
// const jobRow = explorer.frame.locator(".ms-ProgressIndicator-itemDescription"); const jobRow = explorer.frame.locator(".ms-ProgressIndicator-itemDescription");
// await expect(jobRow.getByText("Completed")).toBeVisible({ timeout: 5 * 60 * 1000 }); await expect(jobRow.getByText("Completed")).toBeVisible({ timeout: 5 * 60 * 1000 });
// expect(secondJobName).not.toBe(previousJobName); expect(secondJobName).not.toBe(previousJobName);
// } }
// }); });
// }); });
@@ -1,113 +1,113 @@
// import { expect, Page, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
// import * as DataModels from "../../../src/Contracts/DataModels"; import * as DataModels from "../../../src/Contracts/DataModels";
// import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx"; import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// test.describe("Computed Properties", () => { test.describe("Computed Properties", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// }); });
// test.beforeEach("Open Settings tab under Scale & Settings", async ({ page }) => { test.beforeEach("Open Settings tab under Scale & Settings", async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.expand(); await containerNode.expand();
// // Click Scale & Settings and open Settings tab // Click Scale & Settings and open Settings tab
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// const computedPropertiesTab = explorer.frame.getByTestId("settings-tab-header/ComputedPropertiesTab"); const computedPropertiesTab = explorer.frame.getByTestId("settings-tab-header/ComputedPropertiesTab");
// await computedPropertiesTab.click(); await computedPropertiesTab.click();
// }); });
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// if (!process.env.CI) { if (!process.env.CI) {
// await context?.dispose(); await context?.dispose();
// } }
// }); });
// test("Add valid computed property", async ({ page }) => { test("Add valid computed property", async ({ page }) => {
// test.skip(); test.skip();
// await clearComputedPropertiesTextBoxContent({ page }); await clearComputedPropertiesTextBoxContent({ page });
// // Create computed property // Create computed property
// const computedProperties: DataModels.ComputedProperties = [ const computedProperties: DataModels.ComputedProperties = [
// { {
// name: "cp_lowerName", name: "cp_lowerName",
// query: "SELECT VALUE LOWER(c.name) FROM c", query: "SELECT VALUE LOWER(c.name) FROM c",
// }, },
// ]; ];
// const computedPropertiesString: string = JSON.stringify(computedProperties); const computedPropertiesString: string = JSON.stringify(computedProperties);
// await page.keyboard.type(computedPropertiesString); await page.keyboard.type(computedPropertiesString);
// // Save changes // Save changes
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeEnabled(); await expect(saveButton).toBeEnabled();
// await saveButton.click(); await saveButton.click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Add computed property with invalid query", async ({ page }) => { test("Add computed property with invalid query", async ({ page }) => {
// test.skip(); test.skip();
// await clearComputedPropertiesTextBoxContent({ page }); await clearComputedPropertiesTextBoxContent({ page });
// // Create computed property with no VALUE keyword in query // Create computed property with no VALUE keyword in query
// const computedProperties: DataModels.ComputedProperties = [ const computedProperties: DataModels.ComputedProperties = [
// { {
// name: "cp_lowerName", name: "cp_lowerName",
// query: "SELECT LOWER(c.name) FROM c", query: "SELECT LOWER(c.name) FROM c",
// }, },
// ]; ];
// const computedPropertiesString: string = JSON.stringify(computedProperties); const computedPropertiesString: string = JSON.stringify(computedProperties);
// await page.keyboard.type(computedPropertiesString); await page.keyboard.type(computedPropertiesString);
// // Save changes // Save changes
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeEnabled(); await expect(saveButton).toBeEnabled();
// await saveButton.click(); await saveButton.click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Failed to update container ${context.container.id}`, `Failed to update container ${context.container.id}`,
// { {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Add computed property with invalid json", async ({ page }) => { test("Add computed property with invalid json", async ({ page }) => {
// test.skip(); test.skip();
// await clearComputedPropertiesTextBoxContent({ page }); await clearComputedPropertiesTextBoxContent({ page });
// // Create computed property with no VALUE keyword in query // Create computed property with no VALUE keyword in query
// const computedProperties: DataModels.ComputedProperties = [ const computedProperties: DataModels.ComputedProperties = [
// { {
// name: "cp_lowerName", name: "cp_lowerName",
// query: "SELECT LOWER(c.name) FROM c", query: "SELECT LOWER(c.name) FROM c",
// }, },
// ]; ];
// const computedPropertiesString: string = JSON.stringify(computedProperties); const computedPropertiesString: string = JSON.stringify(computedProperties);
// await page.keyboard.type(computedPropertiesString + "]"); await page.keyboard.type(computedPropertiesString + "]");
// // Save button should remain disabled due to invalid json // Save button should remain disabled due to invalid json
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeDisabled(); await expect(saveButton).toBeDisabled();
// }); });
// const clearComputedPropertiesTextBoxContent = async ({ page }: { page: Page }): Promise<void> => { const clearComputedPropertiesTextBoxContent = async ({ page }: { page: Page }): Promise<void> => {
// // Get computed properties text box // Get computed properties text box
// await explorer.frame.waitForSelector(".monaco-scrollable-element", { state: "visible" }); await explorer.frame.waitForSelector(".monaco-scrollable-element", { state: "visible" });
// const computedPropertiesEditor = explorer.frame.getByTestId("computed-properties-editor"); const computedPropertiesEditor = explorer.frame.getByTestId("computed-properties-editor");
// await computedPropertiesEditor.click(); await computedPropertiesEditor.click();
// // Clear existing content (Ctrl+A + Backspace does not work with webkit) // Clear existing content (Ctrl+A + Backspace does not work with webkit)
// for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
// await page.keyboard.press("Backspace"); await page.keyboard.press("Backspace");
// } }
// }; };
// }); });
@@ -1,198 +1,198 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../../fx"; import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../../testData";
// test.describe("Vector Policy under Scale & Settings", () => { test.describe("Vector Policy under Scale & Settings", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// }); });
// test.beforeEach("Open Container Policy tab under Scale & Settings", async ({ page }) => { test.beforeEach("Open Container Policy tab under Scale & Settings", async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// await explorer.waitForContainerNode(context.database.id, context.container.id); await explorer.waitForContainerNode(context.database.id, context.container.id);
// // Click Scale & Settings and open Container Policy tab // Click Scale & Settings and open Container Policy tab
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// const containerPolicyTab = explorer.frame.getByTestId("settings-tab-header/ContainerVectorPolicyTab"); const containerPolicyTab = explorer.frame.getByTestId("settings-tab-header/ContainerVectorPolicyTab");
// await containerPolicyTab.click(); await containerPolicyTab.click();
// // Click on Vector Policy tab // Click on Vector Policy tab
// const vectorPolicyTab = explorer.frame.getByRole("tab", { name: "Vector Policy" }); const vectorPolicyTab = explorer.frame.getByRole("tab", { name: "Vector Policy" });
// await vectorPolicyTab.click(); await vectorPolicyTab.click();
// }); });
// test.afterEach("Clear vector policies", async () => { test.afterEach("Clear vector policies", async () => {
// const { resource: containerDef } = await context.container.read(); const { resource: containerDef } = await context.container.read();
// if (containerDef.vectorEmbeddingPolicy?.vectorEmbeddings?.length) { if (containerDef.vectorEmbeddingPolicy?.vectorEmbeddings?.length) {
// containerDef.vectorEmbeddingPolicy.vectorEmbeddings = []; containerDef.vectorEmbeddingPolicy.vectorEmbeddings = [];
// await context.container.replace(containerDef); await context.container.replace(containerDef);
// } }
// }); });
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// /** Count vector policy entries currently in the DOM. */ /** Count vector policy entries currently in the DOM. */
// const getPolicyCount = async (): Promise<number> => { const getPolicyCount = async (): Promise<number> => {
// for (let i = 1; i <= 20; i++) { for (let i = 1; i <= 20; i++) {
// if ((await explorer.frame.locator(`#vector-policy-path-${i}`).count()) === 0) { if ((await explorer.frame.locator(`#vector-policy-path-${i}`).count()) === 0) {
// return i - 1; return i - 1;
// } }
// } }
// return 20; return 20;
// }; };
// /** /**
// * Ensure at least one saved (existing) vector policy exists on the container. * Ensure at least one saved (existing) vector policy exists on the container.
// * If none exist, add one and save it. Returns the total policy count afterward. * If none exist, add one and save it. Returns the total policy count afterward.
// */ */
// const ensureExistingPolicy = async (): Promise<number> => { const ensureExistingPolicy = async (): Promise<number> => {
// const count = await getPolicyCount(); const count = await getPolicyCount();
// if (count > 0) { if (count > 0) {
// return count; return count;
// } }
// // No saved policies — add and save one // No saved policies — add and save one
// const addButton = explorer.frame.locator("#add-vector-policy"); const addButton = explorer.frame.locator("#add-vector-policy");
// await addButton.click(); await addButton.click();
// await explorer.frame.locator("#vector-policy-path-1").fill("/existingPolicy"); await explorer.frame.locator("#vector-policy-path-1").fill("/existingPolicy");
// await explorer.frame.locator("#vector-policy-dimension-1").fill("500"); await explorer.frame.locator("#vector-policy-dimension-1").fill("500");
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await saveButton.click(); await saveButton.click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { timeout: 2 * ONE_MINUTE_MS }, { timeout: 2 * ONE_MINUTE_MS },
// ); );
// return 1; return 1;
// }; };
// test("Add new vector embedding policy", async () => { test("Add new vector embedding policy", async () => {
// test.skip(); test.skip();
// const existingCount = await getPolicyCount(); const existingCount = await getPolicyCount();
// // Click Add vector embedding button // Click Add vector embedding button
// const addButton = explorer.frame.locator("#add-vector-policy"); const addButton = explorer.frame.locator("#add-vector-policy");
// await addButton.click(); await addButton.click();
// const newIndex = existingCount + 1; const newIndex = existingCount + 1;
// // Fill in path // Fill in path
// const pathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`); const pathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`);
// await pathInput.fill("/embedding"); await pathInput.fill("/embedding");
// // Fill in dimensions // Fill in dimensions
// const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`); const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
// await dimensionsInput.fill("1500"); await dimensionsInput.fill("1500");
// // Save changes // Save changes
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeEnabled(); await expect(saveButton).toBeEnabled();
// await saveButton.click(); await saveButton.click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Existing vector embedding policy fields are disabled", async () => { test("Existing vector embedding policy fields are disabled", async () => {
// test.skip(); test.skip();
// // Ensure there is at least one saved policy // Ensure there is at least one saved policy
// await ensureExistingPolicy(); await ensureExistingPolicy();
// // Verify the path field is disabled for the existing policy // Verify the path field is disabled for the existing policy
// const existingPathInput = explorer.frame.locator("#vector-policy-path-1"); const existingPathInput = explorer.frame.locator("#vector-policy-path-1");
// await expect(existingPathInput).toBeDisabled(); await expect(existingPathInput).toBeDisabled();
// // Verify the dimensions field is disabled for the existing policy // Verify the dimensions field is disabled for the existing policy
// const existingDimensionsInput = explorer.frame.locator("#vector-policy-dimension-1"); const existingDimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
// await expect(existingDimensionsInput).toBeDisabled(); await expect(existingDimensionsInput).toBeDisabled();
// }); });
// test("New vector embedding policy fields are enabled while existing are disabled", async () => { test("New vector embedding policy fields are enabled while existing are disabled", async () => {
// test.skip(); test.skip();
// // Ensure there is at least one saved policy // Ensure there is at least one saved policy
// const existingCount = await ensureExistingPolicy(); const existingCount = await ensureExistingPolicy();
// // Now add a new policy // Now add a new policy
// const addButton = explorer.frame.locator("#add-vector-policy"); const addButton = explorer.frame.locator("#add-vector-policy");
// await addButton.click(); await addButton.click();
// const newIndex = existingCount + 1; const newIndex = existingCount + 1;
// // Verify the existing policy fields are disabled // Verify the existing policy fields are disabled
// const existingPathInput = explorer.frame.locator("#vector-policy-path-1"); const existingPathInput = explorer.frame.locator("#vector-policy-path-1");
// const existingDimensionsInput = explorer.frame.locator("#vector-policy-dimension-1"); const existingDimensionsInput = explorer.frame.locator("#vector-policy-dimension-1");
// await expect(existingPathInput).toBeDisabled(); await expect(existingPathInput).toBeDisabled();
// await expect(existingDimensionsInput).toBeDisabled(); await expect(existingDimensionsInput).toBeDisabled();
// // Verify the new policy fields are enabled // Verify the new policy fields are enabled
// const newPathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`); const newPathInput = explorer.frame.locator(`#vector-policy-path-${newIndex}`);
// const newDimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`); const newDimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
// await expect(newPathInput).toBeEnabled(); await expect(newPathInput).toBeEnabled();
// await expect(newDimensionsInput).toBeEnabled(); await expect(newDimensionsInput).toBeEnabled();
// }); });
// test("Delete existing vector embedding policy", async () => { test("Delete existing vector embedding policy", async () => {
// test.skip(); test.skip();
// // Ensure there is at least one saved policy to delete // Ensure there is at least one saved policy to delete
// const existingCount = await ensureExistingPolicy(); const existingCount = await ensureExistingPolicy();
// // Verify the policy exists // Verify the policy exists
// const pathInput = explorer.frame.locator("#vector-policy-path-1"); const pathInput = explorer.frame.locator("#vector-policy-path-1");
// await expect(pathInput).toBeVisible(); await expect(pathInput).toBeVisible();
// // Click the delete (trash) button for the first vector embedding // Click the delete (trash) button for the first vector embedding
// const deleteButton = explorer.frame.locator("#delete-Vector-embedding-1"); const deleteButton = explorer.frame.locator("#delete-Vector-embedding-1");
// await expect(deleteButton).toBeEnabled(); await expect(deleteButton).toBeEnabled();
// await deleteButton.click(); await deleteButton.click();
// // Verify one fewer policy entry in the UI // Verify one fewer policy entry in the UI
// const countAfterDelete = await getPolicyCount(); const countAfterDelete = await getPolicyCount();
// expect(countAfterDelete).toBe(existingCount - 1); expect(countAfterDelete).toBe(existingCount - 1);
// // Save the deletion // Save the deletion
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeEnabled(); await expect(saveButton).toBeEnabled();
// await saveButton.click(); await saveButton.click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// // Verify the count is still reduced after save // Verify the count is still reduced after save
// const countAfterSave = await getPolicyCount(); const countAfterSave = await getPolicyCount();
// expect(countAfterSave).toBe(existingCount - 1); expect(countAfterSave).toBe(existingCount - 1);
// }); });
// test("Validation error for empty path", async () => { test("Validation error for empty path", async () => {
// test.skip(); test.skip();
// const existingCount = await getPolicyCount(); const existingCount = await getPolicyCount();
// const addButton = explorer.frame.locator("#add-vector-policy"); const addButton = explorer.frame.locator("#add-vector-policy");
// await addButton.click(); await addButton.click();
// const newIndex = existingCount + 1; const newIndex = existingCount + 1;
// // Leave path empty, just fill dimensions // Leave path empty, just fill dimensions
// const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`); const dimensionsInput = explorer.frame.locator(`#vector-policy-dimension-${newIndex}`);
// await dimensionsInput.fill("512"); await dimensionsInput.fill("512");
// // Check for validation error on path // Check for validation error on path
// const pathError = explorer.frame.locator("text=Path should not be empty"); const pathError = explorer.frame.locator("text=Path should not be empty");
// await expect(pathError).toBeVisible(); await expect(pathError).toBeVisible();
// // Verify save button is disabled due to validation error // Verify save button is disabled due to validation error
// const saveButton = explorer.commandBarButton(CommandBarButton.Save); const saveButton = explorer.commandBarButton(CommandBarButton.Save);
// await expect(saveButton).toBeDisabled(); await expect(saveButton).toBeDisabled();
// }); });
// }); });
+105 -105
View File
@@ -1,129 +1,129 @@
// import { expect, test, type Page } from "@playwright/test"; import { expect, test, type Page } from "@playwright/test";
// import { DataExplorer, TestAccount } from "../../fx"; import { DataExplorer, TestAccount } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// /** /**
// * Tests for Dynamic Data Masking (DDM) feature. * Tests for Dynamic Data Masking (DDM) feature.
// * *
// * Prerequisites: * Prerequisites:
// * - Test account must have the EnableDynamicDataMasking capability enabled * - Test account must have the EnableDynamicDataMasking capability enabled
// * - If the capability is not enabled, the DataMaskingTab will not be visible and tests will be skipped * - If the capability is not enabled, the DataMaskingTab will not be visible and tests will be skipped
// * *
// * Important Notes: * Important Notes:
// * - Tests focus on enabling DDM and modifying the masking policy configuration * - Tests focus on enabling DDM and modifying the masking policy configuration
// */ */
// let testContainer: TestContainerContext; let testContainer: TestContainerContext;
// let DATABASE_ID: string; let DATABASE_ID: string;
// let CONTAINER_ID: string; let CONTAINER_ID: string;
// test.beforeAll(async () => { test.beforeAll(async () => {
// testContainer = await createTestSQLContainer(); testContainer = await createTestSQLContainer();
// DATABASE_ID = testContainer.database.id; DATABASE_ID = testContainer.database.id;
// CONTAINER_ID = testContainer.container.id; CONTAINER_ID = testContainer.container.id;
// }); });
// // Clean up test database after all tests // Clean up test database after all tests
// test.afterAll(async () => { test.afterAll(async () => {
// if (testContainer) { if (testContainer) {
// await testContainer.dispose(); await testContainer.dispose();
// } }
// }); });
// // Helper function to navigate to Data Masking tab // Helper function to navigate to Data Masking tab
// async function navigateToDataMaskingTab(page: Page, explorer: DataExplorer): Promise<boolean> { async function navigateToDataMaskingTab(page: Page, explorer: DataExplorer): Promise<boolean> {
// // Refresh the tree to see the newly created database // Refresh the tree to see the newly created database
// const refreshButton = explorer.frame.getByTestId("Sidebar/RefreshButton"); const refreshButton = explorer.frame.getByTestId("Sidebar/RefreshButton");
// await refreshButton.click(); await refreshButton.click();
// await page.waitForTimeout(3000); await page.waitForTimeout(3000);
// // Expand database and container nodes // Expand database and container nodes
// const databaseNode = await explorer.waitForNode(DATABASE_ID); const databaseNode = await explorer.waitForNode(DATABASE_ID);
// await databaseNode.expand(); await databaseNode.expand();
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// const containerNode = await explorer.waitForNode(`${DATABASE_ID}/${CONTAINER_ID}`); const containerNode = await explorer.waitForNode(`${DATABASE_ID}/${CONTAINER_ID}`);
// await containerNode.expand(); await containerNode.expand();
// await page.waitForTimeout(1000); await page.waitForTimeout(1000);
// // Click Scale & Settings or Settings (depending on container type) // Click Scale & Settings or Settings (depending on container type)
// let settingsNode = explorer.frame.getByTestId(`TreeNode:${DATABASE_ID}/${CONTAINER_ID}/Scale & Settings`); let settingsNode = explorer.frame.getByTestId(`TreeNode:${DATABASE_ID}/${CONTAINER_ID}/Scale & Settings`);
// const isScaleAndSettings = await settingsNode.isVisible().catch(() => false); const isScaleAndSettings = await settingsNode.isVisible().catch(() => false);
// if (!isScaleAndSettings) { if (!isScaleAndSettings) {
// settingsNode = explorer.frame.getByTestId(`TreeNode:${DATABASE_ID}/${CONTAINER_ID}/Settings`); settingsNode = explorer.frame.getByTestId(`TreeNode:${DATABASE_ID}/${CONTAINER_ID}/Settings`);
// } }
// await settingsNode.click(); await settingsNode.click();
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// // Check if Data Masking tab is available // Check if Data Masking tab is available
// const dataMaskingTab = explorer.frame.getByTestId("settings-tab-header/DataMaskingTab"); const dataMaskingTab = explorer.frame.getByTestId("settings-tab-header/DataMaskingTab");
// const isTabVisible = await dataMaskingTab.isVisible().catch(() => false); const isTabVisible = await dataMaskingTab.isVisible().catch(() => false);
// if (!isTabVisible) { if (!isTabVisible) {
// return false; return false;
// } }
// await dataMaskingTab.click(); await dataMaskingTab.click();
// await page.waitForTimeout(1000); await page.waitForTimeout(1000);
// return true; return true;
// } }
// test.describe("Data Masking under Scale & Settings", () => { test.describe("Data Masking under Scale & Settings", () => {
// test("Data Masking tab should be visible and show JSON editor", async ({ page }) => { test("Data Masking tab should be visible and show JSON editor", async ({ page }) => {
// const explorer = await DataExplorer.open(page, TestAccount.SQL); const explorer = await DataExplorer.open(page, TestAccount.SQL);
// const isTabAvailable = await navigateToDataMaskingTab(page, explorer); const isTabAvailable = await navigateToDataMaskingTab(page, explorer);
// if (!isTabAvailable) { if (!isTabAvailable) {
// test.skip( test.skip(
// true, true,
// "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.", "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.",
// ); );
// } }
// // Verify the Data Masking editor is visible // Verify the Data Masking editor is visible
// const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor"); const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor");
// await expect(dataMaskingEditor).toBeVisible(); await expect(dataMaskingEditor).toBeVisible();
// }); });
// test("Data Masking editor should contain default policy structure", async ({ page }) => { test("Data Masking editor should contain default policy structure", async ({ page }) => {
// test.skip(); test.skip();
// const explorer = await DataExplorer.open(page, TestAccount.SQL); const explorer = await DataExplorer.open(page, TestAccount.SQL);
// const isTabAvailable = await navigateToDataMaskingTab(page, explorer); const isTabAvailable = await navigateToDataMaskingTab(page, explorer);
// if (!isTabAvailable) { if (!isTabAvailable) {
// test.skip( test.skip(
// true, true,
// "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.", "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.",
// ); );
// } }
// // Verify the editor contains the expected JSON structure fields // Verify the editor contains the expected JSON structure fields
// const editorContent = explorer.frame.locator(".settingsV2Editor"); const editorContent = explorer.frame.locator(".settingsV2Editor");
// await expect(editorContent).toBeVisible(); await expect(editorContent).toBeVisible();
// // Check that the editor contains key policy fields (default policy has empty arrays) // Check that the editor contains key policy fields (default policy has empty arrays)
// await expect(editorContent).toContainText("includedPaths"); await expect(editorContent).toContainText("includedPaths");
// await expect(editorContent).toContainText("excludedPaths"); await expect(editorContent).toContainText("excludedPaths");
// }); });
// test("Data Masking editor should have correct default policy values", async ({ page }) => { test("Data Masking editor should have correct default policy values", async ({ page }) => {
// test.skip(); test.skip();
// const explorer = await DataExplorer.open(page, TestAccount.SQL); const explorer = await DataExplorer.open(page, TestAccount.SQL);
// const isTabAvailable = await navigateToDataMaskingTab(page, explorer); const isTabAvailable = await navigateToDataMaskingTab(page, explorer);
// if (!isTabAvailable) { if (!isTabAvailable) {
// test.skip( test.skip(
// true, true,
// "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.", "Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.",
// ); );
// } }
// const editorContent = explorer.frame.locator(".settingsV2Editor"); const editorContent = explorer.frame.locator(".settingsV2Editor");
// await expect(editorContent).toBeVisible(); await expect(editorContent).toBeVisible();
// // Default policy should have empty includedPaths and excludedPaths arrays // Default policy should have empty includedPaths and excludedPaths arrays
// await expect(editorContent).toContainText("[]"); await expect(editorContent).toContainText("[]");
// }); });
// }); });
+104 -104
View File
@@ -1,127 +1,127 @@
// import { Browser, expect, Locator, Page, test } from "@playwright/test"; import { Browser, expect, Locator, Page, test } from "@playwright/test";
// import { import {
// CommandBarButton, CommandBarButton,
// DataExplorer, DataExplorer,
// ONE_MINUTE_MS, ONE_MINUTE_MS,
// TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K, TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K,
// TEST_MANUAL_THROUGHPUT_RU_2K, TEST_MANUAL_THROUGHPUT_RU_2K,
// TestAccount, TestAccount,
// } from "../../fx"; } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// interface SetupResult { interface SetupResult {
// context: TestContainerContext; context: TestContainerContext;
// page: Page; page: Page;
// explorer: DataExplorer; explorer: DataExplorer;
// } }
// test.describe("Autoscale throughput", () => { test.describe("Autoscale throughput", () => {
// let setup: SetupResult; let setup: SetupResult;
// test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
// setup = await openScaleTab(browser); setup = await openScaleTab(browser);
// // Switch manual -> autoscale once for this suite // Switch manual -> autoscale once for this suite
// const autoscaleRadioButton = setup.explorer.frame.getByText("Autoscale", { exact: true }); const autoscaleRadioButton = setup.explorer.frame.getByText("Autoscale", { exact: true });
// await autoscaleRadioButton.click(); await autoscaleRadioButton.click();
// await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled(); await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled();
// await setup.explorer.commandBarButton(CommandBarButton.Save).click(); await setup.explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(setup.explorer.getConsoleHeaderStatus()).toContainText( await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for collection ${setup.context.container.id}`, `Successfully updated offer for collection ${setup.context.container.id}`,
// { timeout: 2 * ONE_MINUTE_MS }, { timeout: 2 * ONE_MINUTE_MS },
// ); );
// }); });
// test.afterAll(async () => { test.afterAll(async () => {
// await cleanup(setup); await cleanup(setup);
// }); });
// test("Update autoscale max throughput", async () => { test("Update autoscale max throughput", async () => {
// test.skip(); test.skip();
// await getThroughputInput(setup.explorer, "autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K.toString()); await getThroughputInput(setup.explorer, "autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K.toString());
// await setup.explorer.commandBarButton(CommandBarButton.Save).click(); await setup.explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(setup.explorer.getConsoleHeaderStatus()).toContainText( await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for collection ${setup.context.container.id}`, `Successfully updated offer for collection ${setup.context.container.id}`,
// { timeout: 2 * ONE_MINUTE_MS }, { timeout: 2 * ONE_MINUTE_MS },
// ); );
// }); });
// test("Update autoscale max throughput passed allowed limit", async () => { test("Update autoscale max throughput passed allowed limit", async () => {
// test.skip(); test.skip();
// const softAllowedMaxThroughputString = await setup.explorer.frame const softAllowedMaxThroughputString = await setup.explorer.frame
// .getByTestId("soft-allowed-maximum-throughput") .getByTestId("soft-allowed-maximum-throughput")
// .innerText(); .innerText();
// const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, "")); const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
// await getThroughputInput(setup.explorer, "autopilot").fill((softAllowedMaxThroughput * 10).toString()); await getThroughputInput(setup.explorer, "autopilot").fill((softAllowedMaxThroughput * 10).toString());
// await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled(); await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
// await expect(delayedApplyWarning(setup.explorer)).toBeVisible(); await expect(delayedApplyWarning(setup.explorer)).toBeVisible();
// }); });
// test("Update autoscale max throughput with invalid increment", async () => { test("Update autoscale max throughput with invalid increment", async () => {
// test.skip(); test.skip();
// await getThroughputInput(setup.explorer, "autopilot").fill("1100"); await getThroughputInput(setup.explorer, "autopilot").fill("1100");
// await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled(); await expect(setup.explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
// await expect(getThroughputInputErrorMessage(setup.explorer, "autopilot")).toContainText( await expect(getThroughputInputErrorMessage(setup.explorer, "autopilot")).toContainText(
// "Throughput value must be in increments of 1000", "Throughput value must be in increments of 1000",
// ); );
// }); });
// }); });
// test.describe("Manual throughput", () => { test.describe("Manual throughput", () => {
// let setup: SetupResult; let setup: SetupResult;
// test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
// setup = await openScaleTab(browser); setup = await openScaleTab(browser);
// }); });
// test.afterAll(async () => { test.afterAll(async () => {
// await cleanup(setup); await cleanup(setup);
// }); });
// test("Update manual throughput", async () => { test("Update manual throughput", async () => {
// test.skip(); test.skip();
// await getThroughputInput(setup.explorer, "manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString()); await getThroughputInput(setup.explorer, "manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString());
// await setup.explorer.commandBarButton(CommandBarButton.Save).click(); await setup.explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(setup.explorer.getConsoleHeaderStatus()).toContainText( await expect(setup.explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for collection ${setup.context.container.id}`, `Successfully updated offer for collection ${setup.context.container.id}`,
// { timeout: 2 * ONE_MINUTE_MS }, { timeout: 2 * ONE_MINUTE_MS },
// ); );
// }); });
// test("Update manual throughput passed allowed limit", async () => { test("Update manual throughput passed allowed limit", async () => {
// test.skip(); test.skip();
// const softAllowedMaxThroughputString = await setup.explorer.frame const softAllowedMaxThroughputString = await setup.explorer.frame
// .getByTestId("soft-allowed-maximum-throughput") .getByTestId("soft-allowed-maximum-throughput")
// .innerText(); .innerText();
// const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, "")); const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
// await getThroughputInput(setup.explorer, "manual").fill((softAllowedMaxThroughput * 10).toString()); await getThroughputInput(setup.explorer, "manual").fill((softAllowedMaxThroughput * 10).toString());
// await expect(delayedApplyWarning(setup.explorer)).toBeVisible(); await expect(delayedApplyWarning(setup.explorer)).toBeVisible();
// }); });
// }); });
// const delayedApplyWarning = (explorer: DataExplorer): Locator => const delayedApplyWarning = (explorer: DataExplorer): Locator =>
// explorer.frame.locator("#updateThroughputDelayedApplyWarningMessage"); explorer.frame.locator("#updateThroughputDelayedApplyWarningMessage");
// const getThroughputInput = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator => const getThroughputInput = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator =>
// explorer.frame.getByTestId(`${type}-throughput-input`); explorer.frame.getByTestId(`${type}-throughput-input`);
// const getThroughputInputErrorMessage = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator => const getThroughputInputErrorMessage = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator =>
// explorer.frame.getByTestId(`${type}-throughput-input-error`); explorer.frame.getByTestId(`${type}-throughput-input-error`);
// async function openScaleTab(browser: Browser): Promise<SetupResult> { async function openScaleTab(browser: Browser): Promise<SetupResult> {
// const context = await createTestSQLContainer(); const context = await createTestSQLContainer();
// const page = await browser.newPage(); const page = await browser.newPage();
// const explorer = await DataExplorer.open(page, TestAccount.SQL); const explorer = await DataExplorer.open(page, TestAccount.SQL);
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// await explorer.frame.getByTestId("settings-tab-header/ScaleTab").click(); await explorer.frame.getByTestId("settings-tab-header/ScaleTab").click();
// return { context, page, explorer }; return { context, page, explorer };
// } }
// async function cleanup({ context }: Partial<SetupResult>) { async function cleanup({ context }: Partial<SetupResult>) {
// await context?.dispose(); await context?.dispose();
// } }
+67 -67
View File
@@ -1,80 +1,80 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx"; import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// test.describe("Settings under Scale & Settings", () => { test.describe("Settings under Scale & Settings", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeAll("Create Test Database & Open Settings tab", async ({ browser }) => { test.beforeAll("Create Test Database & Open Settings tab", async ({ browser }) => {
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// const page = await browser.newPage(); const page = await browser.newPage();
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// // Click Scale & Settings and open Settings tab // Click Scale & Settings and open Settings tab
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// const settingsTab = explorer.frame.getByTestId("settings-tab-header/SubSettingsTab"); const settingsTab = explorer.frame.getByTestId("settings-tab-header/SubSettingsTab");
// await settingsTab.click(); await settingsTab.click();
// }); });
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// test("Update TTL to On (no default)", async () => { test("Update TTL to On (no default)", async () => {
// test.skip(); test.skip();
// 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.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Update TTL to On (with user entry)", async () => { test("Update TTL to On (with user entry)", async () => {
// test.skip(); test.skip();
// const ttlOnRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-option" }); const ttlOnRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-option" });
// await ttlOnRadioButton.click(); await ttlOnRadioButton.click();
// // Enter TTL seconds // Enter TTL seconds
// const ttlInput = explorer.frame.getByTestId("ttl-input"); const ttlInput = explorer.frame.getByTestId("ttl-input");
// await ttlInput.fill("30000"); await ttlInput.fill("30000");
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Set Geospatial Config to Geometry then Geography", async () => { test("Set Geospatial Config to Geometry then Geography", async () => {
// test.skip(); test.skip();
// const geometryRadioButton = explorer.frame.getByRole("radio", { name: "geometry-option" }); const geometryRadioButton = explorer.frame.getByRole("radio", { name: "geometry-option" });
// await geometryRadioButton.click(); await geometryRadioButton.click();
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }, },
// ); );
// const geographyRadioButton = explorer.frame.getByRole("radio", { name: "geography-option" }); const geographyRadioButton = explorer.frame.getByRole("radio", { name: "geography-option" });
// await geographyRadioButton.click(); await geographyRadioButton.click();
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated container ${context.container.id}`, `Successfully updated container ${context.container.id}`,
// { {
// timeout: ONE_MINUTE_MS, timeout: ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// }); });
+330 -330
View File
@@ -1,330 +1,330 @@
// import { Locator, expect, test } from "@playwright/test"; import { Locator, expect, test } from "@playwright/test";
// import { import {
// CommandBarButton, CommandBarButton,
// DataExplorer, DataExplorer,
// ONE_MINUTE_MS, ONE_MINUTE_MS,
// TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K, TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K,
// TEST_MANUAL_THROUGHPUT_RU, TEST_MANUAL_THROUGHPUT_RU,
// TestAccount, TestAccount,
// } from "../../fx"; } from "../../fx";
// import { TestDatabaseContext, createTestDB } from "../../testData"; import { TestDatabaseContext, createTestDB } from "../../testData";
// test.describe("Shared Throughput Option Removed from Creation Dialogs", () => { test.describe("Shared Throughput Option Removed from Creation Dialogs", () => {
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// }); });
// test("New Database panel should not show shared throughput checkbox", async () => { test("New Database panel should not show shared throughput checkbox", async () => {
// test.skip(); test.skip();
// // Open the "New Database" panel via the global command menu // Open the "New Database" panel via the global command menu
// const newDatabaseButton = await explorer.globalCommandButton("New Database"); const newDatabaseButton = await explorer.globalCommandButton("New Database");
// await newDatabaseButton.click(); await newDatabaseButton.click();
// const panel = explorer.panel("New Database"); const panel = explorer.panel("New Database");
// await panel.waitFor(); await panel.waitFor();
// // Assert that no "Provision throughput" / "Provision shared throughput" checkbox is visible // Assert that no "Provision throughput" / "Provision shared throughput" checkbox is visible
// const sharedThroughputCheckbox = panel.getByRole("checkbox", { const sharedThroughputCheckbox = panel.getByRole("checkbox", {
// name: /Provision.*throughput|Share.*throughput/i, name: /Provision.*throughput|Share.*throughput/i,
// }); });
// await expect(sharedThroughputCheckbox).not.toBeAttached(); await expect(sharedThroughputCheckbox).not.toBeAttached();
// // Close the panel without submitting // Close the panel without submitting
// const closeButton = explorer.frame.getByLabel("Close New Database"); const closeButton = explorer.frame.getByLabel("Close New Database");
// await closeButton.click(); await closeButton.click();
// await panel.waitFor({ state: "detached" }); await panel.waitFor({ state: "detached" });
// }); });
// test("New Container panel should not show shared throughput checkbox when creating new database", async () => { test("New Container panel should not show shared throughput checkbox when creating new database", async () => {
// test.skip(); test.skip();
// // Open the "New Container" panel // Open the "New Container" panel
// const newContainerButton = await explorer.globalCommandButton("New Container"); const newContainerButton = await explorer.globalCommandButton("New Container");
// await newContainerButton.click(); await newContainerButton.click();
// const panel = explorer.panel("New Container"); const panel = explorer.panel("New Container");
// await panel.waitFor(); await panel.waitFor();
// // "Create new" database should be selected by default // "Create new" database should be selected by default
// const createNewRadio = panel.getByRole("radio", { name: /Create new/i }); const createNewRadio = panel.getByRole("radio", { name: /Create new/i });
// await expect(createNewRadio).toBeChecked(); await expect(createNewRadio).toBeChecked();
// // Assert that no "Share throughput across containers" checkbox is visible // Assert that no "Share throughput across containers" checkbox is visible
// const shareThroughputCheckbox = panel.getByRole("checkbox", { const shareThroughputCheckbox = panel.getByRole("checkbox", {
// name: /Share throughput/i, name: /Share throughput/i,
// }); });
// await expect(shareThroughputCheckbox).not.toBeAttached(); await expect(shareThroughputCheckbox).not.toBeAttached();
// // Close the panel without submitting // Close the panel without submitting
// const closeButton = explorer.frame.getByLabel("Close New Container"); const closeButton = explorer.frame.getByLabel("Close New Container");
// await closeButton.click(); await closeButton.click();
// await panel.waitFor({ state: "detached" }); await panel.waitFor({ state: "detached" });
// }); });
// test("Dedicated throughput checkbox still appears for existing shared database", async () => { test("Dedicated throughput checkbox still appears for existing shared database", async () => {
// test.skip(); test.skip();
// // Create a database with shared throughput via SDK // Create a database with shared throughput via SDK
// const dbContext = await createTestDB({ throughput: 400 }); const dbContext = await createTestDB({ throughput: 400 });
// try { try {
// // Wait for the database to appear // Wait for the database to appear
// await explorer.waitForNode(dbContext.database.id); await explorer.waitForNode(dbContext.database.id);
// // Open New Container panel // Open New Container panel
// const newContainerButton = await explorer.globalCommandButton("New Container"); const newContainerButton = await explorer.globalCommandButton("New Container");
// await newContainerButton.click(); await newContainerButton.click();
// const panel = explorer.panel("New Container"); const panel = explorer.panel("New Container");
// await panel.waitFor(); await panel.waitFor();
// // Select "Use existing" and pick the shared database // Select "Use existing" and pick the shared database
// const useExistingRadio = panel.getByRole("radio", { name: /Use existing/i }); const useExistingRadio = panel.getByRole("radio", { name: /Use existing/i });
// await useExistingRadio.click(); await useExistingRadio.click();
// const databaseDropdown = panel.getByRole("combobox", { name: "Choose an existing database" }); const databaseDropdown = panel.getByRole("combobox", { name: "Choose an existing database" });
// await databaseDropdown.click(); await databaseDropdown.click();
// await explorer.frame.getByRole("option", { name: dbContext.database.id }).click(); await explorer.frame.getByRole("option", { name: dbContext.database.id }).click();
// // Assert that "Provision dedicated throughput" checkbox IS visible for a shared database // Assert that "Provision dedicated throughput" checkbox IS visible for a shared database
// const dedicatedThroughputCheckbox = panel.getByRole("checkbox", { const dedicatedThroughputCheckbox = panel.getByRole("checkbox", {
// name: /Provision dedicated throughput/i, name: /Provision dedicated throughput/i,
// }); });
// await expect(dedicatedThroughputCheckbox).toBeVisible(); await expect(dedicatedThroughputCheckbox).toBeVisible();
// // Close the panel without submitting // Close the panel without submitting
// const closeButton = explorer.frame.getByLabel("Close New Container"); const closeButton = explorer.frame.getByLabel("Close New Container");
// await closeButton.click(); await closeButton.click();
// await panel.waitFor({ state: "detached" }); await panel.waitFor({ state: "detached" });
// } finally { } finally {
// await dbContext.dispose(); await dbContext.dispose();
// } }
// }); });
// }); });
// test.describe("Database with Shared Throughput", () => { test.describe("Database with Shared Throughput", () => {
// test.skip(); test.skip();
// let dbContext: TestDatabaseContext = null!; let dbContext: TestDatabaseContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// const containerId = "sharedcontainer"; const containerId = "sharedcontainer";
// // Helper methods // Helper methods
// const getThroughputInput = (type: "manual" | "autopilot"): Locator => { const getThroughputInput = (type: "manual" | "autopilot"): Locator => {
// return explorer.frame.getByTestId(`${type}-throughput-input`); return explorer.frame.getByTestId(`${type}-throughput-input`);
// }; };
// test.afterEach("Delete Test Database", async () => { test.afterEach("Delete Test Database", async () => {
// await dbContext?.dispose(); await dbContext?.dispose();
// }); });
// test.describe("Manual Throughput Tests", () => { test.describe("Manual Throughput Tests", () => {
// test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// }); });
// test("Create database with shared manual throughput and verify Scale node in UI", async () => { test("Create database with shared manual throughput and verify Scale node in UI", async () => {
// test.skip(); test.skip();
// test.setTimeout(120000); // 2 minutes timeout test.setTimeout(120000); // 2 minutes timeout
// // Create database with shared manual throughput (400 RU/s) // Create database with shared manual throughput (400 RU/s)
// dbContext = await createTestDB({ throughput: 400 }); dbContext = await createTestDB({ throughput: 400 });
// // Verify database node appears in the tree // Verify database node appears in the tree
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// expect(databaseNode).toBeDefined(); expect(databaseNode).toBeDefined();
// // Expand the database node to see child nodes // Expand the database node to see child nodes
// await databaseNode.expand(); await databaseNode.expand();
// // Verify that "Scale" node appears under the database // Verify that "Scale" node appears under the database
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// expect(scaleNode).toBeDefined(); expect(scaleNode).toBeDefined();
// await expect(scaleNode.element).toBeVisible(); await expect(scaleNode.element).toBeVisible();
// }); });
// test("Add container to shared database without dedicated throughput", async () => { test("Add container to shared database without dedicated throughput", async () => {
// test.skip(); test.skip();
// // Create database with shared manual throughput // Create database with shared manual throughput
// dbContext = await createTestDB({ throughput: 400 }); dbContext = await createTestDB({ throughput: 400 });
// // Wait for the database to appear in the tree // Wait for the database to appear in the tree
// await explorer.waitForNode(dbContext.database.id); await explorer.waitForNode(dbContext.database.id);
// // Add a container to the shared database via UI // Add a container to the shared database via UI
// const newContainerButton = await explorer.globalCommandButton("New Container"); const newContainerButton = await explorer.globalCommandButton("New Container");
// await newContainerButton.click(); await newContainerButton.click();
// await explorer.whilePanelOpen( await explorer.whilePanelOpen(
// "New Container", "New Container",
// async (panel, okButton) => { async (panel, okButton) => {
// // Select "Use existing" database // Select "Use existing" database
// const useExistingRadio = panel.getByRole("radio", { name: /Use existing/i }); const useExistingRadio = panel.getByRole("radio", { name: /Use existing/i });
// await useExistingRadio.click(); await useExistingRadio.click();
// // Select the database from dropdown using the new data-testid // Select the database from dropdown using the new data-testid
// const databaseDropdown = panel.getByRole("combobox", { name: "Choose an existing database" }); const databaseDropdown = panel.getByRole("combobox", { name: "Choose an existing database" });
// await databaseDropdown.click(); await databaseDropdown.click();
// await explorer.frame.getByRole("option", { name: dbContext.database.id }).click(); await explorer.frame.getByRole("option", { name: dbContext.database.id }).click();
// // Now you can target the specific database option by its data-testid // Now you can target the specific database option by its data-testid
// //await panel.getByTestId(`database-option-${dbContext.database.id}`).click(); //await panel.getByTestId(`database-option-${dbContext.database.id}`).click();
// // Fill container id // Fill container id
// await panel.getByRole("textbox", { name: "Container id, Example Container1" }).fill(containerId); await panel.getByRole("textbox", { name: "Container id, Example Container1" }).fill(containerId);
// // Fill partition key // Fill partition key
// await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk"); await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
// // Ensure "Provision dedicated throughput" is NOT checked // Ensure "Provision dedicated throughput" is NOT checked
// const dedicatedThroughputCheckbox = panel.getByRole("checkbox", { const dedicatedThroughputCheckbox = panel.getByRole("checkbox", {
// name: /Provision dedicated throughput for this container/i, name: /Provision dedicated throughput for this container/i,
// }); });
// if (await dedicatedThroughputCheckbox.isVisible()) { if (await dedicatedThroughputCheckbox.isVisible()) {
// const isChecked = await dedicatedThroughputCheckbox.isChecked(); const isChecked = await dedicatedThroughputCheckbox.isChecked();
// if (isChecked) { if (isChecked) {
// await dedicatedThroughputCheckbox.uncheck(); await dedicatedThroughputCheckbox.uncheck();
// } }
// } }
// await okButton.click(); await okButton.click();
// }, },
// { closeTimeout: 5 * ONE_MINUTE_MS }, { closeTimeout: 5 * ONE_MINUTE_MS },
// ); );
// // Verify container was created under the database // Verify container was created under the database
// const containerNode = await explorer.waitForContainerNode(dbContext.database.id, containerId); const containerNode = await explorer.waitForContainerNode(dbContext.database.id, containerId);
// expect(containerNode).toBeDefined(); expect(containerNode).toBeDefined();
// }); });
// test("Scale shared database manual throughput", async () => { test("Scale shared database manual throughput", async () => {
// test.skip(); test.skip();
// // Create database with shared manual throughput (400 RU/s) // Create database with shared manual throughput (400 RU/s)
// dbContext = await createTestDB({ throughput: 400 }); dbContext = await createTestDB({ throughput: 400 });
// // Navigate to the scale settings by clicking the "Scale" node in the tree // Navigate to the scale settings by clicking the "Scale" node in the tree
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// await databaseNode.expand(); await databaseNode.expand();
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// await scaleNode.element.click(); await scaleNode.element.click();
// // Update manual throughput from 400 to 800 // Update manual throughput from 400 to 800
// await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU.toString()); await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU.toString());
// // Save changes // Save changes
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// // Verify success message // Verify success message
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for database ${dbContext.database.id}`, `Successfully updated offer for database ${dbContext.database.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Scale shared database from manual to autoscale", async () => { test("Scale shared database from manual to autoscale", async () => {
// test.skip(); test.skip();
// // Create database with shared manual throughput (400 RU/s) // Create database with shared manual throughput (400 RU/s)
// dbContext = await createTestDB({ throughput: 400 }); dbContext = await createTestDB({ throughput: 400 });
// // Open database settings by clicking the "Scale" node // Open database settings by clicking the "Scale" node
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// await databaseNode.expand(); await databaseNode.expand();
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// await scaleNode.element.click(); await scaleNode.element.click();
// // Switch to Autoscale // Switch to Autoscale
// const autoscaleRadio = explorer.frame.getByText("Autoscale", { exact: true }); const autoscaleRadio = explorer.frame.getByText("Autoscale", { exact: true });
// await autoscaleRadio.click(); await autoscaleRadio.click();
// // Set autoscale max throughput to 1000 // Set autoscale max throughput to 1000
// //await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString()); //await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
// // Save changes // Save changes
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for database ${dbContext.database.id}`, `Successfully updated offer for database ${dbContext.database.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// }); });
// test.describe("Autoscale Throughput Tests", () => { test.describe("Autoscale Throughput Tests", () => {
// test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// }); });
// test("Create database with shared autoscale throughput and verify Scale node in UI", async () => { test("Create database with shared autoscale throughput and verify Scale node in UI", async () => {
// test.skip(); test.skip();
// test.setTimeout(120000); // 2 minutes timeout test.setTimeout(120000); // 2 minutes timeout
// // Create database with shared autoscale throughput (max 1000 RU/s) // Create database with shared autoscale throughput (max 1000 RU/s)
// dbContext = await createTestDB({ maxThroughput: 1000 }); dbContext = await createTestDB({ maxThroughput: 1000 });
// // Verify database node appears // Verify database node appears
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// expect(databaseNode).toBeDefined(); expect(databaseNode).toBeDefined();
// // Expand the database node to see child nodes // Expand the database node to see child nodes
// await databaseNode.expand(); await databaseNode.expand();
// // Verify that "Scale" node appears under the database // Verify that "Scale" node appears under the database
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// expect(scaleNode).toBeDefined(); expect(scaleNode).toBeDefined();
// await expect(scaleNode.element).toBeVisible(); await expect(scaleNode.element).toBeVisible();
// }); });
// test("Scale shared database autoscale throughput", async () => { test("Scale shared database autoscale throughput", async () => {
// test.skip(); test.skip();
// // Create database with shared autoscale throughput (max 1000 RU/s) // Create database with shared autoscale throughput (max 1000 RU/s)
// dbContext = await createTestDB({ maxThroughput: 1000 }); dbContext = await createTestDB({ maxThroughput: 1000 });
// // Open database settings // Open database settings
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// await databaseNode.expand(); await databaseNode.expand();
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// await scaleNode.element.click(); await scaleNode.element.click();
// // Update autoscale max throughput from 1000 to 4000 // Update autoscale max throughput from 1000 to 4000
// await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K.toString()); await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_4K.toString());
// // Save changes // Save changes
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// // Verify success message // Verify success message
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for database ${dbContext.database.id}`, `Successfully updated offer for database ${dbContext.database.id}`,
// { {
// timeout: 2 * ONE_MINUTE_MS, timeout: 2 * ONE_MINUTE_MS,
// }, },
// ); );
// }); });
// test("Scale shared database from autoscale to manual", async () => { test("Scale shared database from autoscale to manual", async () => {
// test.skip(); test.skip();
// // Create database with shared autoscale throughput (max 1000 RU/s) // Create database with shared autoscale throughput (max 1000 RU/s)
// dbContext = await createTestDB({ maxThroughput: 1000 }); dbContext = await createTestDB({ maxThroughput: 1000 });
// // Open database settings // Open database settings
// const databaseNode = await explorer.waitForNode(dbContext.database.id); const databaseNode = await explorer.waitForNode(dbContext.database.id);
// await databaseNode.expand(); await databaseNode.expand();
// const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`); const scaleNode = await explorer.waitForNode(`${dbContext.database.id}/Scale`);
// await scaleNode.element.click(); await scaleNode.element.click();
// // Switch to Manual // Switch to Manual
// const manualRadio = explorer.frame.getByText("Manual", { exact: true }); const manualRadio = explorer.frame.getByText("Manual", { exact: true });
// await manualRadio.click(); await manualRadio.click();
// // Save changes // Save changes
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// // Verify success message // Verify success message
// await expect(explorer.getConsoleHeaderStatus()).toContainText( await expect(explorer.getConsoleHeaderStatus()).toContainText(
// `Successfully updated offer for database ${dbContext.database.id}`, `Successfully updated offer for database ${dbContext.database.id}`,
// { timeout: 2 * ONE_MINUTE_MS }, { timeout: 2 * ONE_MINUTE_MS },
// ); );
// }); });
// }); });
// }); });
@@ -1,112 +1,112 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx"; import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
// import { createTestSQLContainer, TestContainerContext } from "../../testData"; import { createTestSQLContainer, TestContainerContext } from "../../testData";
// test.describe("Throughput bucket settings", () => { test.describe("Throughput bucket settings", () => {
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer(); context = await createTestSQLContainer();
// }); });
// test.beforeEach("Open Throughput Bucket Settings", async ({ browser }) => { test.beforeEach("Open Throughput Bucket Settings", async ({ browser }) => {
// const page = await browser.newPage(); const page = await browser.newPage();
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// // Click Scale & Settings and open Throughput Bucket Settings tab // Click Scale & Settings and open Throughput Bucket Settings tab
// await explorer.openScaleAndSettings(context); await explorer.openScaleAndSettings(context);
// const throughputBucketTab = explorer.frame.getByTestId("settings-tab-header/ThroughputBucketsTab"); const throughputBucketTab = explorer.frame.getByTestId("settings-tab-header/ThroughputBucketsTab");
// await throughputBucketTab.click(); await throughputBucketTab.click();
// }); });
// // Delete database only if not running in CI // Delete database only if not running in CI
// if (!process.env.CI) { if (!process.env.CI) {
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// } }
// test("Activate throughput bucket #2", async () => { test("Activate throughput bucket #2", async () => {
// test.skip(); test.skip();
// // Activate bucket 2 // Activate bucket 2
// const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle"); const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle");
// await bucket2Toggle.click(); await bucket2Toggle.click();
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).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,
// }, },
// ); );
// }); });
// test("Activate throughput buckets #1 and #2", async () => { test("Activate throughput buckets #1 and #2", async () => {
// test.skip(); test.skip();
// // Activate bucket 1 // Activate bucket 1
// const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle"); const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
// await bucket1Toggle.click(); await bucket1Toggle.click();
// // Activate bucket 2 // Activate bucket 2
// const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle"); const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle");
// await bucket2Toggle.click(); await bucket2Toggle.click();
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).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,
// }, },
// ); );
// }); });
// test("Set throughput percentage for bucket #1", async () => { test("Set throughput percentage for bucket #1", async () => {
// test.skip(); test.skip();
// // Set throughput percentage for bucket 1 (inactive) - Should be disabled // Set throughput percentage for bucket 1 (inactive) - Should be disabled
// const bucket1PercentageInput = explorer.frame.getByTestId("bucket-1-percentage-input"); const bucket1PercentageInput = explorer.frame.getByTestId("bucket-1-percentage-input");
// expect(bucket1PercentageInput).toBeDisabled(); expect(bucket1PercentageInput).toBeDisabled();
// // Activate bucket 1 // Activate bucket 1
// const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle"); const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
// await bucket1Toggle.click(); await bucket1Toggle.click();
// expect(bucket1PercentageInput).toBeEnabled(); expect(bucket1PercentageInput).toBeEnabled();
// await bucket1PercentageInput.fill("40"); await bucket1PercentageInput.fill("40");
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).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,
// }, },
// ); );
// }); });
// test("Set default throughput bucket", async () => { test("Set default throughput bucket", async () => {
// test.skip(); test.skip();
// // There are no active throughput buckets so they all should be disabled // There are no active throughput buckets so they all should be disabled
// const defaultThroughputBucketDropdown = explorer.frame.getByTestId("default-throughput-bucket-dropdown"); const defaultThroughputBucketDropdown = explorer.frame.getByTestId("default-throughput-bucket-dropdown");
// await defaultThroughputBucketDropdown.click(); await defaultThroughputBucketDropdown.click();
// const bucket1Option = explorer.frame.getByRole("option", { name: "Bucket 1" }); const bucket1Option = explorer.frame.getByRole("option", { name: "Bucket 1" });
// expect(bucket1Option).toBeDisabled(); expect(bucket1Option).toBeDisabled();
// // Activate bucket 1 // Activate bucket 1
// const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle"); const bucket1Toggle = explorer.frame.getByTestId("bucket-1-active-toggle");
// await bucket1Toggle.click(); await bucket1Toggle.click();
// // Open dropdown again // Open dropdown again
// await defaultThroughputBucketDropdown.click(); await defaultThroughputBucketDropdown.click();
// expect(bucket1Option).toBeEnabled(); expect(bucket1Option).toBeEnabled();
// // Select bucket 1 as default // Select bucket 1 as default
// await bucket1Option.click(); await bucket1Option.click();
// await explorer.commandBarButton(CommandBarButton.Save).click(); await explorer.commandBarButton(CommandBarButton.Save).click();
// await expect(explorer.getConsoleHeaderStatus()).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,
// }, },
// ); );
// }); });
// }); });