mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-23 03:34:16 +00:00
Compare commits
2 Commits
users/aisa
...
users/saks
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56bc65f5fb | ||
|
|
6c2ad8b001 |
@@ -94,7 +94,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
||||
notebookBasePath: get("notebookbasepath"),
|
||||
notebookServerToken: get("notebookservertoken"),
|
||||
notebookServerUrl: get("notebookserverurl"),
|
||||
sandboxNotebookOutputs: true,
|
||||
sandboxNotebookOutputs: "true" === get("sandboxnotebookoutputs", "true"),
|
||||
selfServeType: get("selfservetype"),
|
||||
showMinRUSurvey: "true" === get("showminrusurvey"),
|
||||
ttl90Days: "true" === get("ttl90days"),
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("AuthorizationUtils", () => {
|
||||
enableKoResourceTree: false,
|
||||
enableThroughputBuckets: false,
|
||||
hostedDataExplorer: false,
|
||||
sandboxNotebookOutputs: true,
|
||||
sandboxNotebookOutputs: false,
|
||||
showMinRUSurvey: false,
|
||||
ttl90Days: false,
|
||||
enableThroughputCap: false,
|
||||
|
||||
20
test/fx.ts
20
test/fx.ts
@@ -378,11 +378,9 @@ type PanelOpenOptions = {
|
||||
|
||||
export enum CommandBarButton {
|
||||
Save = "Save",
|
||||
Delete = "Delete",
|
||||
Execute = "Execute",
|
||||
ExecuteQuery = "Execute Query",
|
||||
UploadItem = "Upload Item",
|
||||
NewDocument = "New Document",
|
||||
}
|
||||
|
||||
/** Helper class that provides locator methods for DataExplorer components, on top of a Frame */
|
||||
@@ -480,7 +478,7 @@ export class DataExplorer {
|
||||
return await this.waitForNode(`${databaseId}/${containerId}/Documents`);
|
||||
}
|
||||
|
||||
async waitForCommandBarButton(label: CommandBarButton, timeout?: number): Promise<Locator> {
|
||||
async waitForCommandBarButton(label: string, timeout?: number): Promise<Locator> {
|
||||
const commandBar = this.commandBarButton(label);
|
||||
await commandBar.waitFor({ state: "visible", timeout });
|
||||
return commandBar;
|
||||
@@ -517,14 +515,14 @@ export class DataExplorer {
|
||||
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
||||
await containerNode.expand();
|
||||
|
||||
// // refresh tree to remove deleted database
|
||||
// const consoleMessages = await this.getNotificationConsoleMessages();
|
||||
// const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
|
||||
// await refreshButton.click();
|
||||
// await expect(consoleMessages).toContainText("Successfully refreshed databases", {
|
||||
// timeout: ONE_MINUTE_MS,
|
||||
// });
|
||||
// await this.collapseNotificationConsole();
|
||||
// refresh tree to remove deleted database
|
||||
const consoleMessages = await this.getNotificationConsoleMessages();
|
||||
const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
|
||||
await refreshButton.click();
|
||||
await expect(consoleMessages).toContainText("Successfully refreshed databases", {
|
||||
timeout: ONE_MINUTE_MS,
|
||||
});
|
||||
await this.collapseNotificationConsole();
|
||||
|
||||
const scaleAndSettingsButton = this.frame.getByTestId(
|
||||
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { setupCORSBypass } from "../CORSBypass";
|
||||
import { CommandBarButton, DataExplorer, DocumentsTab, TestAccount } from "../fx";
|
||||
import { DataExplorer, DocumentsTab, TestAccount } from "../fx";
|
||||
import { retry, serializeMongoToJson, setPartitionKeys } from "../testData";
|
||||
import { documentTestCases } from "./testCases";
|
||||
|
||||
@@ -26,8 +26,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
await documentsTab.documentsFilter.waitFor();
|
||||
await documentsTab.documentsListPane.waitFor();
|
||||
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
||||
|
||||
await explorer.expandNotificationConsole();
|
||||
});
|
||||
test.afterEach(async ({ page }) => {
|
||||
await page.unrouteAll({ behavior: "ignoreErrors" });
|
||||
@@ -50,7 +48,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
expect(resultData?._id).not.toBeNull();
|
||||
expect(resultData?._id).toEqual(docId);
|
||||
});
|
||||
test(`should be able to create and delete new document from ${docId}`, async ({ page }) => {
|
||||
test(`should be able to create and delete new document from ${docId}`, async () => {
|
||||
const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
|
||||
await span.waitFor();
|
||||
await expect(span).toBeVisible();
|
||||
@@ -58,7 +56,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
await span.click();
|
||||
let newDocumentId;
|
||||
await retry(async () => {
|
||||
const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewDocument, 5000);
|
||||
const newDocumentButton = await explorer.waitForCommandBarButton("New Document", 5000);
|
||||
await expect(newDocumentButton).toBeVisible();
|
||||
await expect(newDocumentButton).toBeEnabled();
|
||||
await newDocumentButton.click();
|
||||
@@ -73,12 +71,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
};
|
||||
|
||||
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
||||
// Verify that the document text was set correctly
|
||||
await expect
|
||||
.poll(async () => await documentsTab.resultsEditor.text(), { timeout: 5000 })
|
||||
.toEqual(JSON.stringify(newDocument));
|
||||
|
||||
const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000);
|
||||
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
|
||||
await saveButton.click({ timeout: 5000 });
|
||||
await expect(saveButton).toBeHidden({ timeout: 5000 });
|
||||
}, 3);
|
||||
@@ -91,7 +84,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
await newSpan.click();
|
||||
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
||||
|
||||
const deleteButton = await explorer.waitForCommandBarButton(CommandBarButton.Delete, 5000);
|
||||
const deleteButton = await explorer.waitForCommandBarButton("Delete", 5000);
|
||||
await deleteButton.click();
|
||||
|
||||
const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000);
|
||||
|
||||
@@ -1,258 +1,258 @@
|
||||
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
// import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
// import { truncateName } from "../../../src/Explorer/ContainerCopy/CopyJobUtils";
|
||||
// import {
|
||||
// ContainerCopy,
|
||||
// getAccountName,
|
||||
// getDropdownItemByNameOrPosition,
|
||||
// interceptAndInspectApiRequest,
|
||||
// TestAccount,
|
||||
// waitForApiResponse,
|
||||
// } from "../../fx";
|
||||
// import { createMultipleTestContainers } from "../../testData";
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
import { truncateName } from "../../../src/Explorer/ContainerCopy/CopyJobUtils";
|
||||
import {
|
||||
ContainerCopy,
|
||||
getAccountName,
|
||||
getDropdownItemByNameOrPosition,
|
||||
interceptAndInspectApiRequest,
|
||||
TestAccount,
|
||||
waitForApiResponse,
|
||||
} from "../../fx";
|
||||
import { createMultipleTestContainers } from "../../testData";
|
||||
|
||||
// test.describe("Container Copy - Offline Migration", () => {
|
||||
// let page: Page;
|
||||
// let wrapper: Locator;
|
||||
// let panel: Locator;
|
||||
// let frame: Frame;
|
||||
// let expectedJobName: string;
|
||||
// let targetAccountName: string;
|
||||
// let expectedSubscriptionName: string;
|
||||
// let expectedCopyJobNameInitial: string;
|
||||
test.describe("Container Copy - Offline Migration", () => {
|
||||
let page: Page;
|
||||
let wrapper: Locator;
|
||||
let panel: Locator;
|
||||
let frame: Frame;
|
||||
let expectedJobName: string;
|
||||
let targetAccountName: string;
|
||||
let expectedSubscriptionName: string;
|
||||
let expectedCopyJobNameInitial: string;
|
||||
|
||||
// test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
||||
// await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
||||
await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
|
||||
// page = await browser.newPage();
|
||||
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
// expectedJobName = `offline_test_job_${Date.now()}`;
|
||||
// targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
// });
|
||||
page = await browser.newPage();
|
||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
expectedJobName = `offline_test_job_${Date.now()}`;
|
||||
targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
});
|
||||
|
||||
// test.afterEach("Cleanup after offline migration test", async () => {
|
||||
// await page.unroute(/.*/, (route) => route.continue());
|
||||
// await page.close();
|
||||
// });
|
||||
test.afterEach("Cleanup after offline migration test", async () => {
|
||||
await page.unroute(/.*/, (route) => route.continue());
|
||||
await page.close();
|
||||
});
|
||||
|
||||
// test("Successfully create and manage offline migration copy job", async () => {
|
||||
// expect(wrapper).not.toBeNull();
|
||||
// await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||
test("Successfully create and manage offline migration copy job", async () => {
|
||||
expect(wrapper).not.toBeNull();
|
||||
await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||
|
||||
// // Open Create Copy Job panel
|
||||
// const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
// await expect(createCopyJobButton).toBeVisible();
|
||||
// await createCopyJobButton.click();
|
||||
// panel = frame.getByTestId("Panel:Create copy job");
|
||||
// await expect(panel).toBeVisible();
|
||||
// Open Create Copy Job panel
|
||||
const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
await expect(createCopyJobButton).toBeVisible();
|
||||
await createCopyJobButton.click();
|
||||
panel = frame.getByTestId("Panel:Create copy job");
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
// // Reduced wait time for better performance
|
||||
// await page.waitForTimeout(2000);
|
||||
// Reduced wait time for better performance
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// // Setup subscription and account
|
||||
// const subscriptionDropdown = panel.getByTestId("subscription-dropdown");
|
||||
// const expectedAccountName = targetAccountName;
|
||||
// expectedSubscriptionName = await subscriptionDropdown.locator("span.ms-Dropdown-title").innerText();
|
||||
// Setup subscription and account
|
||||
const subscriptionDropdown = panel.getByTestId("subscription-dropdown");
|
||||
const expectedAccountName = targetAccountName;
|
||||
expectedSubscriptionName = await subscriptionDropdown.locator("span.ms-Dropdown-title").innerText();
|
||||
|
||||
// await subscriptionDropdown.click();
|
||||
// const subscriptionItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { name: expectedSubscriptionName },
|
||||
// { ariaLabel: "Subscription" },
|
||||
// );
|
||||
// await subscriptionItem.click();
|
||||
await subscriptionDropdown.click();
|
||||
const subscriptionItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ name: expectedSubscriptionName },
|
||||
{ ariaLabel: "Subscription" },
|
||||
);
|
||||
await subscriptionItem.click();
|
||||
|
||||
// // Select account
|
||||
// const accountDropdown = panel.getByTestId("account-dropdown");
|
||||
// await expect(accountDropdown).toHaveText(new RegExp(expectedAccountName));
|
||||
// await accountDropdown.click();
|
||||
// Select account
|
||||
const accountDropdown = panel.getByTestId("account-dropdown");
|
||||
await expect(accountDropdown).toHaveText(new RegExp(expectedAccountName));
|
||||
await accountDropdown.click();
|
||||
|
||||
// const accountItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { name: expectedAccountName },
|
||||
// { ariaLabel: "Account" },
|
||||
// );
|
||||
// await accountItem.click();
|
||||
const accountItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ name: expectedAccountName },
|
||||
{ ariaLabel: "Account" },
|
||||
);
|
||||
await accountItem.click();
|
||||
|
||||
// // Test offline migration mode toggle functionality
|
||||
// const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||
// Test offline migration mode toggle functionality
|
||||
const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||
|
||||
// // First test online mode (should show permissions screen)
|
||||
// const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||
// await onlineCopyRadioButton.click({ force: true });
|
||||
// await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||
// First test online mode (should show permissions screen)
|
||||
const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||
await onlineCopyRadioButton.click({ force: true });
|
||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
// await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).toBeVisible();
|
||||
// await expect(panel.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).toBeVisible();
|
||||
await expect(panel.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
|
||||
// // Go back and switch to offline mode
|
||||
// await panel.getByRole("button", { name: "Previous" }).click();
|
||||
// Go back and switch to offline mode
|
||||
await panel.getByRole("button", { name: "Previous" }).click();
|
||||
|
||||
// const offlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Offline mode/i });
|
||||
// await offlineCopyRadioButton.click({ force: true });
|
||||
// await expect(migrationTypeContainer.getByTestId("migration-type-description-offline")).toBeVisible();
|
||||
const offlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Offline mode/i });
|
||||
await offlineCopyRadioButton.click({ force: true });
|
||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-offline")).toBeVisible();
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Verify we skip permissions screen in offline mode
|
||||
// await expect(panel.getByTestId("Panel:SelectSourceAndTargetContainers")).toBeVisible();
|
||||
// await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).not.toBeVisible();
|
||||
// Verify we skip permissions screen in offline mode
|
||||
await expect(panel.getByTestId("Panel:SelectSourceAndTargetContainers")).toBeVisible();
|
||||
await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).not.toBeVisible();
|
||||
|
||||
// // Test source and target container selection with validation
|
||||
// const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||
// expect(sourceContainerDropdown).toBeVisible();
|
||||
// await expect(sourceContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
// Test source and target container selection with validation
|
||||
const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||
expect(sourceContainerDropdown).toBeVisible();
|
||||
await expect(sourceContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
|
||||
// // Select source database first (containers are disabled until database is selected)
|
||||
// const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||
// await sourceDatabaseDropdown.click();
|
||||
// const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Database" },
|
||||
// );
|
||||
// await sourceDbDropdownItem.click();
|
||||
// Select source database first (containers are disabled until database is selected)
|
||||
const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||
await sourceDatabaseDropdown.click();
|
||||
const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Database" },
|
||||
);
|
||||
await sourceDbDropdownItem.click();
|
||||
|
||||
// // Now container dropdown should be enabled
|
||||
// await expect(sourceContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
// await sourceContainerDropdown.click();
|
||||
// const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Container" },
|
||||
// );
|
||||
// await sourceContainerDropdownItem.click();
|
||||
// Now container dropdown should be enabled
|
||||
await expect(sourceContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
await sourceContainerDropdown.click();
|
||||
const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Container" },
|
||||
);
|
||||
await sourceContainerDropdownItem.click();
|
||||
|
||||
// // Test target container selection
|
||||
// const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||
// expect(targetContainerDropdown).toBeVisible();
|
||||
// await expect(targetContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
// Test target container selection
|
||||
const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||
expect(targetContainerDropdown).toBeVisible();
|
||||
await expect(targetContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
|
||||
// const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||
// await targetDatabaseDropdown.click();
|
||||
// const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Database" },
|
||||
// );
|
||||
// await targetDbDropdownItem.click();
|
||||
const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||
await targetDatabaseDropdown.click();
|
||||
const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Database" },
|
||||
);
|
||||
await targetDbDropdownItem.click();
|
||||
|
||||
// await expect(targetContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
// await targetContainerDropdown.click();
|
||||
await expect(targetContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
await targetContainerDropdown.click();
|
||||
|
||||
// // First try selecting the same container (should show error)
|
||||
// const targetContainerDropdownItem1 = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Container" },
|
||||
// );
|
||||
// await targetContainerDropdownItem1.click();
|
||||
// First try selecting the same container (should show error)
|
||||
const targetContainerDropdownItem1 = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Container" },
|
||||
);
|
||||
await targetContainerDropdownItem1.click();
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Verify validation error for same source and target containers
|
||||
// const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||
// await expect(errorContainer).toBeVisible();
|
||||
// await expect(errorContainer).toHaveText(/Source and destination containers cannot be the same/i);
|
||||
// Verify validation error for same source and target containers
|
||||
const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||
await expect(errorContainer).toBeVisible();
|
||||
await expect(errorContainer).toHaveText(/Source and destination containers cannot be the same/i);
|
||||
|
||||
// // Select different target container
|
||||
// await targetContainerDropdown.click();
|
||||
// const targetContainerDropdownItem2 = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 1 },
|
||||
// { ariaLabel: "Container" },
|
||||
// );
|
||||
// await targetContainerDropdownItem2.click();
|
||||
// Select different target container
|
||||
await targetContainerDropdown.click();
|
||||
const targetContainerDropdownItem2 = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 1 },
|
||||
{ ariaLabel: "Container" },
|
||||
);
|
||||
await targetContainerDropdownItem2.click();
|
||||
|
||||
// // Generate expected job name based on selections
|
||||
// const selectedSourceDatabase = await sourceDatabaseDropdown.innerText();
|
||||
// const selectedSourceContainer = await sourceContainerDropdown.innerText();
|
||||
// const selectedTargetDatabase = await targetDatabaseDropdown.innerText();
|
||||
// const selectedTargetContainer = await targetContainerDropdown.innerText();
|
||||
// expectedCopyJobNameInitial = `${truncateName(selectedSourceDatabase)}.${truncateName(
|
||||
// selectedSourceContainer,
|
||||
// )}_${truncateName(selectedTargetDatabase)}.${truncateName(selectedTargetContainer)}`;
|
||||
// Generate expected job name based on selections
|
||||
const selectedSourceDatabase = await sourceDatabaseDropdown.innerText();
|
||||
const selectedSourceContainer = await sourceContainerDropdown.innerText();
|
||||
const selectedTargetDatabase = await targetDatabaseDropdown.innerText();
|
||||
const selectedTargetContainer = await targetContainerDropdown.innerText();
|
||||
expectedCopyJobNameInitial = `${truncateName(selectedSourceDatabase)}.${truncateName(
|
||||
selectedSourceContainer,
|
||||
)}_${truncateName(selectedTargetDatabase)}.${truncateName(selectedTargetContainer)}`;
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Error should disappear and preview should be visible
|
||||
// await expect(errorContainer).not.toBeVisible();
|
||||
// await expect(panel.getByTestId("Panel:PreviewCopyJob")).toBeVisible();
|
||||
// Error should disappear and preview should be visible
|
||||
await expect(errorContainer).not.toBeVisible();
|
||||
await expect(panel.getByTestId("Panel:PreviewCopyJob")).toBeVisible();
|
||||
|
||||
// // Verify job preview details
|
||||
// const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
// await expect(previewContainer).toBeVisible();
|
||||
// await expect(previewContainer.getByTestId("source-subscription-name")).toHaveText(expectedSubscriptionName);
|
||||
// await expect(previewContainer.getByTestId("source-account-name")).toHaveText(expectedAccountName);
|
||||
// Verify job preview details
|
||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
await expect(previewContainer).toBeVisible();
|
||||
await expect(previewContainer.getByTestId("source-subscription-name")).toHaveText(expectedSubscriptionName);
|
||||
await expect(previewContainer.getByTestId("source-account-name")).toHaveText(expectedAccountName);
|
||||
|
||||
// const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||
// await expect(jobNameInput).toHaveValue(new RegExp(expectedCopyJobNameInitial));
|
||||
const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||
await expect(jobNameInput).toHaveValue(new RegExp(expectedCopyJobNameInitial));
|
||||
|
||||
// const primaryBtn = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
// await expect(primaryBtn).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
const primaryBtn = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
await expect(primaryBtn).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
|
||||
// // Test invalid job name validation (spaces not allowed)
|
||||
// await jobNameInput.fill("test job name");
|
||||
// await expect(primaryBtn).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
// Test invalid job name validation (spaces not allowed)
|
||||
await jobNameInput.fill("test job name");
|
||||
await expect(primaryBtn).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
|
||||
// // Test duplicate job name error handling
|
||||
// const duplicateJobName = "test-job-name-1";
|
||||
// await jobNameInput.fill(duplicateJobName);
|
||||
// Test duplicate job name error handling
|
||||
const duplicateJobName = "test-job-name-1";
|
||||
await jobNameInput.fill(duplicateJobName);
|
||||
|
||||
// const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
// const expectedErrorMessage = `Duplicate job name '${duplicateJobName}'`;
|
||||
const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
const expectedErrorMessage = `Duplicate job name '${duplicateJobName}'`;
|
||||
|
||||
// await interceptAndInspectApiRequest(
|
||||
// page,
|
||||
// `${expectedAccountName}/dataTransferJobs/${duplicateJobName}`,
|
||||
// "PUT",
|
||||
// new Error(expectedErrorMessage),
|
||||
// (url?: string) => url?.includes(duplicateJobName) ?? false,
|
||||
// );
|
||||
await interceptAndInspectApiRequest(
|
||||
page,
|
||||
`${expectedAccountName}/dataTransferJobs/${duplicateJobName}`,
|
||||
"PUT",
|
||||
new Error(expectedErrorMessage),
|
||||
(url?: string) => url?.includes(duplicateJobName) ?? false,
|
||||
);
|
||||
|
||||
// let errorThrown = false;
|
||||
// try {
|
||||
// await copyButton.click();
|
||||
// await page.waitForTimeout(2000);
|
||||
// } catch (error: any) {
|
||||
// errorThrown = true;
|
||||
// expect(error.message).toContain("not allowed");
|
||||
// }
|
||||
let errorThrown = false;
|
||||
try {
|
||||
await copyButton.click();
|
||||
await page.waitForTimeout(2000);
|
||||
} catch (error: any) {
|
||||
errorThrown = true;
|
||||
expect(error.message).toContain("not allowed");
|
||||
}
|
||||
|
||||
// if (!errorThrown) {
|
||||
// const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||
// await expect(errorContainer).toBeVisible();
|
||||
// await expect(errorContainer).toHaveText(new RegExp(expectedErrorMessage, "i"));
|
||||
// }
|
||||
if (!errorThrown) {
|
||||
const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||
await expect(errorContainer).toBeVisible();
|
||||
await expect(errorContainer).toHaveText(new RegExp(expectedErrorMessage, "i"));
|
||||
}
|
||||
|
||||
// await expect(panel).toBeVisible();
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
// // Test successful job creation with valid job name
|
||||
// const validJobName = expectedJobName;
|
||||
// Test successful job creation with valid job name
|
||||
const validJobName = expectedJobName;
|
||||
|
||||
// const copyJobCreationPromise = waitForApiResponse(
|
||||
// page,
|
||||
// `${expectedAccountName}/dataTransferJobs/${validJobName}`,
|
||||
// "PUT",
|
||||
// );
|
||||
const copyJobCreationPromise = waitForApiResponse(
|
||||
page,
|
||||
`${expectedAccountName}/dataTransferJobs/${validJobName}`,
|
||||
"PUT",
|
||||
);
|
||||
|
||||
// await jobNameInput.fill(validJobName);
|
||||
// await expect(copyButton).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
await jobNameInput.fill(validJobName);
|
||||
await expect(copyButton).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||
|
||||
// await copyButton.click();
|
||||
await copyButton.click();
|
||||
|
||||
// const response = await copyJobCreationPromise;
|
||||
// expect(response.ok()).toBe(true);
|
||||
const response = await copyJobCreationPromise;
|
||||
expect(response.ok()).toBe(true);
|
||||
|
||||
// // Verify panel closes and job appears in the list
|
||||
// await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||
// Verify panel closes and job appears in the list
|
||||
await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||
|
||||
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
// await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||
|
||||
// const jobItem = jobsListContainer.getByText(validJobName);
|
||||
// await jobItem.waitFor({ state: "visible", timeout: 5000 });
|
||||
// await expect(jobItem).toBeVisible();
|
||||
// });
|
||||
// });
|
||||
const jobItem = jobsListContainer.getByText(validJobName);
|
||||
await jobItem.waitFor({ state: "visible", timeout: 5000 });
|
||||
await expect(jobItem).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,185 +1,185 @@
|
||||
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
// import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
// import {
|
||||
// ContainerCopy,
|
||||
// getAccountName,
|
||||
// getDropdownItemByNameOrPosition,
|
||||
// TestAccount,
|
||||
// waitForApiResponse,
|
||||
// } from "../../fx";
|
||||
// import { createMultipleTestContainers } from "../../testData";
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
import {
|
||||
ContainerCopy,
|
||||
getAccountName,
|
||||
getDropdownItemByNameOrPosition,
|
||||
TestAccount,
|
||||
waitForApiResponse,
|
||||
} from "../../fx";
|
||||
import { createMultipleTestContainers } from "../../testData";
|
||||
|
||||
// test.describe("Container Copy - Online Migration", () => {
|
||||
// let page: Page;
|
||||
// let wrapper: Locator;
|
||||
// let panel: Locator;
|
||||
// let frame: Frame;
|
||||
// let targetAccountName: string;
|
||||
test.describe("Container Copy - Online Migration", () => {
|
||||
let page: Page;
|
||||
let wrapper: Locator;
|
||||
let panel: Locator;
|
||||
let frame: Frame;
|
||||
let targetAccountName: string;
|
||||
|
||||
// test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
||||
// await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
||||
await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
|
||||
// page = await browser.newPage();
|
||||
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
// targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
// });
|
||||
page = await browser.newPage();
|
||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
});
|
||||
|
||||
// test.afterEach("Cleanup after online migration test", async () => {
|
||||
// await page.unroute(/.*/, (route) => route.continue());
|
||||
// await page.close();
|
||||
// });
|
||||
test.afterEach("Cleanup after online migration test", async () => {
|
||||
await page.unroute(/.*/, (route) => route.continue());
|
||||
await page.close();
|
||||
});
|
||||
|
||||
// test("Successfully create and manage online migration copy job", async () => {
|
||||
// expect(wrapper).not.toBeNull();
|
||||
// await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||
test("Successfully create and manage online migration copy job", async () => {
|
||||
expect(wrapper).not.toBeNull();
|
||||
await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||
|
||||
// // Open Create Copy Job panel
|
||||
// const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
// await expect(createCopyJobButton).toBeVisible();
|
||||
// await createCopyJobButton.click();
|
||||
// panel = frame.getByTestId("Panel:Create copy job");
|
||||
// await expect(panel).toBeVisible();
|
||||
// Open Create Copy Job panel
|
||||
const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
await expect(createCopyJobButton).toBeVisible();
|
||||
await createCopyJobButton.click();
|
||||
panel = frame.getByTestId("Panel:Create copy job");
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
// // Reduced wait time for better performance
|
||||
// await page.waitForTimeout(1000);
|
||||
// Reduced wait time for better performance
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// // Enable online migration mode
|
||||
// const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||
// const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||
// await onlineCopyRadioButton.click({ force: true });
|
||||
// Enable online migration mode
|
||||
const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||
const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||
await onlineCopyRadioButton.click({ force: true });
|
||||
|
||||
// await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Verify permissions screen is shown for online migration
|
||||
// const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
||||
// await expect(permissionScreen).toBeVisible();
|
||||
// await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
// Verify permissions screen is shown for online migration
|
||||
const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
||||
await expect(permissionScreen).toBeVisible();
|
||||
await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
|
||||
// // Skip permissions setup and proceed to container selection
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
// Skip permissions setup and proceed to container selection
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Configure source and target containers for online migration
|
||||
// const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||
// await sourceDatabaseDropdown.click();
|
||||
// const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Database" },
|
||||
// );
|
||||
// await sourceDbDropdownItem.click();
|
||||
// Configure source and target containers for online migration
|
||||
const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||
await sourceDatabaseDropdown.click();
|
||||
const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Database" },
|
||||
);
|
||||
await sourceDbDropdownItem.click();
|
||||
|
||||
// const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||
// await sourceContainerDropdown.click();
|
||||
// const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Container" },
|
||||
// );
|
||||
// await sourceContainerDropdownItem.click();
|
||||
const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||
await sourceContainerDropdown.click();
|
||||
const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Container" },
|
||||
);
|
||||
await sourceContainerDropdownItem.click();
|
||||
|
||||
// const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||
// await targetDatabaseDropdown.click();
|
||||
// const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 0 },
|
||||
// { ariaLabel: "Database" },
|
||||
// );
|
||||
// await targetDbDropdownItem.click();
|
||||
const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||
await targetDatabaseDropdown.click();
|
||||
const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 0 },
|
||||
{ ariaLabel: "Database" },
|
||||
);
|
||||
await targetDbDropdownItem.click();
|
||||
|
||||
// const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||
// await targetContainerDropdown.click();
|
||||
// const targetContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
// frame,
|
||||
// { position: 1 },
|
||||
// { ariaLabel: "Container" },
|
||||
// );
|
||||
// await targetContainerDropdownItem.click();
|
||||
const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||
await targetContainerDropdown.click();
|
||||
const targetContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||
frame,
|
||||
{ position: 1 },
|
||||
{ ariaLabel: "Container" },
|
||||
);
|
||||
await targetContainerDropdownItem.click();
|
||||
|
||||
// await panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Verify job preview and create the online migration job
|
||||
// const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
// await expect(previewContainer.getByTestId("source-account-name")).toHaveText(targetAccountName);
|
||||
// Verify job preview and create the online migration job
|
||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
await expect(previewContainer.getByTestId("source-account-name")).toHaveText(targetAccountName);
|
||||
|
||||
// const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||
// const onlineMigrationJobName = await jobNameInput.inputValue();
|
||||
const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||
const onlineMigrationJobName = await jobNameInput.inputValue();
|
||||
|
||||
// const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||
|
||||
// const copyJobCreationPromise = waitForApiResponse(
|
||||
// page,
|
||||
// `${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}`,
|
||||
// "PUT",
|
||||
// );
|
||||
// await copyButton.click();
|
||||
// await page.waitForTimeout(1000); // Reduced wait time
|
||||
const copyJobCreationPromise = waitForApiResponse(
|
||||
page,
|
||||
`${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}`,
|
||||
"PUT",
|
||||
);
|
||||
await copyButton.click();
|
||||
await page.waitForTimeout(1000); // Reduced wait time
|
||||
|
||||
// const response = await copyJobCreationPromise;
|
||||
// expect(response.ok()).toBe(true);
|
||||
const response = await copyJobCreationPromise;
|
||||
expect(response.ok()).toBe(true);
|
||||
|
||||
// // Verify panel closes and job appears in the list
|
||||
// await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||
// Verify panel closes and job appears in the list
|
||||
await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||
|
||||
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
// await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||
|
||||
// let jobRow, statusCell, actionMenuButton;
|
||||
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
// await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||
let jobRow, statusCell, actionMenuButton;
|
||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||
|
||||
// // Verify job status changes to queued state
|
||||
// await expect(statusCell).toContainText(/running|queued|pending/i, { timeout: 5000 });
|
||||
// Verify job status changes to queued state
|
||||
await expect(statusCell).toContainText(/running|queued|pending/i, { timeout: 5000 });
|
||||
|
||||
// // Test job lifecycle management through action menu
|
||||
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
// await actionMenuButton.click();
|
||||
// Test job lifecycle management through action menu
|
||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
await actionMenuButton.click();
|
||||
|
||||
// // Test pause functionality
|
||||
// const pauseAction = frame.locator(".ms-ContextualMenu-list button:has-text('Pause')");
|
||||
// await pauseAction.click();
|
||||
// Test pause functionality
|
||||
const pauseAction = frame.locator(".ms-ContextualMenu-list button:has-text('Pause')");
|
||||
await pauseAction.click();
|
||||
|
||||
// const pauseResponse = await waitForApiResponse(
|
||||
// page,
|
||||
// `${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}/pause`,
|
||||
// "POST",
|
||||
// );
|
||||
// expect(pauseResponse.ok()).toBe(true);
|
||||
const pauseResponse = await waitForApiResponse(
|
||||
page,
|
||||
`${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}/pause`,
|
||||
"POST",
|
||||
);
|
||||
expect(pauseResponse.ok()).toBe(true);
|
||||
|
||||
// // Verify job status changes to paused
|
||||
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
// await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
// await expect(statusCell).toContainText(/paused/i, { timeout: 5000 });
|
||||
// await page.waitForTimeout(1000);
|
||||
// Verify job status changes to paused
|
||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
await expect(statusCell).toContainText(/paused/i, { timeout: 5000 });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// // Test cancel job functionality
|
||||
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
// await actionMenuButton.click();
|
||||
// await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||
// Test cancel job functionality
|
||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
await actionMenuButton.click();
|
||||
await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||
|
||||
// // Verify cancellation confirmation dialog
|
||||
// await expect(frame.locator(".ms-Dialog-main")).toBeVisible({ timeout: 2000 });
|
||||
// await expect(frame.locator(".ms-Dialog-main")).toContainText(onlineMigrationJobName);
|
||||
// Verify cancellation confirmation dialog
|
||||
await expect(frame.locator(".ms-Dialog-main")).toBeVisible({ timeout: 2000 });
|
||||
await expect(frame.locator(".ms-Dialog-main")).toContainText(onlineMigrationJobName);
|
||||
|
||||
// const cancelDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Cancel");
|
||||
// await expect(cancelDialogButton).toBeVisible();
|
||||
// await cancelDialogButton.click();
|
||||
// await expect(frame.locator(".ms-Dialog-main")).not.toBeVisible();
|
||||
const cancelDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Cancel");
|
||||
await expect(cancelDialogButton).toBeVisible();
|
||||
await cancelDialogButton.click();
|
||||
await expect(frame.locator(".ms-Dialog-main")).not.toBeVisible();
|
||||
|
||||
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
// await actionMenuButton.click();
|
||||
// await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||
await actionMenuButton.click();
|
||||
await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||
|
||||
// const confirmDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Confirm");
|
||||
// await expect(confirmDialogButton).toBeVisible();
|
||||
// await confirmDialogButton.click();
|
||||
const confirmDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Confirm");
|
||||
await expect(confirmDialogButton).toBeVisible();
|
||||
await confirmDialogButton.click();
|
||||
|
||||
// // Verify final job status is cancelled
|
||||
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
// await expect(statusCell).toContainText(/cancelled/i, { timeout: 5000 });
|
||||
// });
|
||||
// });
|
||||
// Verify final job status is cancelled
|
||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||
await expect(statusCell).toContainText(/cancelled/i, { timeout: 5000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -136,7 +136,9 @@ test.describe.serial("Upload Item", () => {
|
||||
if (existsSync(uploadDocumentDirPath)) {
|
||||
rmdirSync(uploadDocumentDirPath);
|
||||
}
|
||||
await context?.dispose();
|
||||
if (!process.env.CI) {
|
||||
await context?.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
test.afterEach("Close Upload Items panel if still open", async () => {
|
||||
|
||||
@@ -30,9 +30,12 @@ test.beforeEach("Open new query tab", async ({ page }) => {
|
||||
await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
|
||||
});
|
||||
|
||||
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("Query results", async () => {
|
||||
// Run the query and verify the results
|
||||
|
||||
@@ -23,9 +23,12 @@ test.describe("Change Partition Key", () => {
|
||||
await PartitionKeyTab.click();
|
||||
});
|
||||
|
||||
test.afterEach("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
// Delete database only if not running in CI
|
||||
if (!process.env.CI) {
|
||||
test.afterEach("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Change partition key path", async ({ page }) => {
|
||||
await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();
|
||||
|
||||
169
test/sql/scaleAndSettings/dataMasking.spec.ts
Normal file
169
test/sql/scaleAndSettings/dataMasking.spec.ts
Normal file
@@ -0,0 +1,169 @@
|
||||
import { expect, Page, test } from "@playwright/test";
|
||||
import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, 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:
|
||||
* - Once DDM is enabled on a container, it cannot be disabled (isPolicyEnabled cannot be set to false)
|
||||
* - Tests focus on enabling DDM and modifying the masking policy configuration
|
||||
*/
|
||||
test.describe("Data Masking under Scale & Settings", () => {
|
||||
let context: TestContainerContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
|
||||
test.beforeAll("Create Test Database", async () => {
|
||||
context = await createTestSQLContainer();
|
||||
});
|
||||
|
||||
test.beforeEach("Open Data Masking tab under Scale & Settings", async ({ page }) => {
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
// Click Scale & Settings
|
||||
await explorer.openScaleAndSettings(context);
|
||||
|
||||
// Check if Data Masking tab is available (requires EnableDynamicDataMasking capability)
|
||||
const dataMaskingTab = explorer.frame.getByTestId("settings-tab-header/DataMaskingTab");
|
||||
const isTabVisible = await dataMaskingTab.isVisible().catch(() => false);
|
||||
|
||||
if (!isTabVisible) {
|
||||
test.skip(
|
||||
true,
|
||||
"Data Masking tab is not available. Test account may not have EnableDynamicDataMasking capability.",
|
||||
);
|
||||
}
|
||||
|
||||
await dataMaskingTab.click();
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
|
||||
test("Data Masking editor should be visible", async () => {
|
||||
// Verify the Data Masking editor is visible
|
||||
const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor");
|
||||
await expect(dataMaskingEditor).toBeVisible();
|
||||
});
|
||||
|
||||
test("Enable data masking policy with valid JSON", async ({ page }) => {
|
||||
await clearDataMaskingEditorContent({ page });
|
||||
|
||||
// Type a valid data masking policy
|
||||
// Note: Once DDM is enabled on a container, it cannot be disabled
|
||||
const validPolicy = JSON.stringify(
|
||||
{
|
||||
includedPaths: [
|
||||
{
|
||||
path: "/email",
|
||||
strategy: "Default",
|
||||
startPosition: 0,
|
||||
length: -1,
|
||||
},
|
||||
],
|
||||
excludedPaths: [],
|
||||
isPolicyEnabled: true,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
);
|
||||
|
||||
await page.keyboard.type(validPolicy);
|
||||
|
||||
// Wait a moment for the changes to be processed
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Click Save button
|
||||
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||
await expect(saveButton).toBeEnabled();
|
||||
await saveButton.click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated container ${context.container.id}`,
|
||||
{
|
||||
timeout: 2 * ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("Show validation error for invalid JSON", async ({ page }) => {
|
||||
await clearDataMaskingEditorContent({ page });
|
||||
|
||||
// Type invalid JSON
|
||||
await page.keyboard.type("{invalid json}");
|
||||
|
||||
// Wait a moment for validation
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Save button should be disabled due to invalid JSON
|
||||
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||
await expect(saveButton).toBeDisabled();
|
||||
});
|
||||
|
||||
test("Update data masking policy with multiple paths", async ({ page }) => {
|
||||
await clearDataMaskingEditorContent({ page });
|
||||
|
||||
// Type a policy with multiple included paths and excluded paths
|
||||
const multiPathPolicy = JSON.stringify(
|
||||
{
|
||||
includedPaths: [
|
||||
{
|
||||
path: "/email",
|
||||
strategy: "Default",
|
||||
startPosition: 0,
|
||||
length: -1,
|
||||
},
|
||||
{
|
||||
path: "/phoneNumber",
|
||||
strategy: "Default",
|
||||
startPosition: 0,
|
||||
length: -1,
|
||||
},
|
||||
],
|
||||
excludedPaths: ["/id", "/timestamp"],
|
||||
isPolicyEnabled: true,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
);
|
||||
|
||||
await page.keyboard.type(multiPathPolicy);
|
||||
|
||||
// Wait a moment for the changes to be processed
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Click Save button
|
||||
const saveButton = explorer.commandBarButton(CommandBarButton.Save);
|
||||
await expect(saveButton).toBeEnabled();
|
||||
await saveButton.click();
|
||||
|
||||
// Verify success message
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated container ${context.container.id}`,
|
||||
{
|
||||
timeout: 2 * ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper function to clear the data masking editor content.
|
||||
*/
|
||||
const clearDataMaskingEditorContent = async ({ page }: { page: Page }): Promise<void> => {
|
||||
// Wait for the Monaco editor to be visible
|
||||
await explorer.frame.waitForSelector(".settingsV2Editor", { state: "visible" });
|
||||
const dataMaskingEditor = explorer.frame.locator(".settingsV2Editor");
|
||||
await dataMaskingEditor.click();
|
||||
|
||||
// Clear existing content (Ctrl+A + Backspace does not work reliably with webkit)
|
||||
for (let i = 0; i < 100; i++) {
|
||||
await page.keyboard.press("Backspace");
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -118,5 +118,7 @@ async function openScaleTab(browser: Browser): Promise<SetupResult> {
|
||||
}
|
||||
|
||||
async function cleanup({ context }: Partial<SetupResult>) {
|
||||
await context?.dispose();
|
||||
if (!process.env.CI) {
|
||||
await context?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,12 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
await settingsTab.click();
|
||||
});
|
||||
|
||||
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("Update TTL to On (no default)", async () => {
|
||||
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
|
||||
|
||||
@@ -43,7 +43,7 @@ test.describe("Stored Procedures", () => {
|
||||
);
|
||||
|
||||
// Execute stored procedure
|
||||
const executeButton = explorer.commandBarButton(CommandBarButton.Execute).first();
|
||||
const executeButton = explorer.commandBarButton(CommandBarButton.Execute);
|
||||
await executeButton.click();
|
||||
const executeSidePanelButton = explorer.frame.getByTestId("Panel/OkButton");
|
||||
await executeSidePanelButton.click();
|
||||
|
||||
@@ -26,9 +26,11 @@ test.describe("Triggers", () => {
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
if (!process.env.CI) {
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Add and delete trigger", async ({ page }, testInfo) => {
|
||||
// Open container context menu and click New Trigger
|
||||
|
||||
@@ -19,9 +19,11 @@ test.describe("User Defined Functions", () => {
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
if (!process.env.CI) {
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Add, execute, and delete user defined function", async ({ page }, testInfo) => {
|
||||
// Open container context menu and click New UDF
|
||||
|
||||
Reference in New Issue
Block a user