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