mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-07-20 20:37:18 +01:00
Remove all of the test.skip() calls.
This commit is contained in:
@@ -3,7 +3,6 @@ import { expect, test } from "@playwright/test";
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
|
||||
test("Gremlin graph CRUD", async ({ page }) => {
|
||||
test.skip();
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = "testgraph"; // A unique graph name isn't needed because the database is unique
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUnique
|
||||
] as [string, TestAccount][]
|
||||
).forEach(([apiVersionDescription, accountType]) => {
|
||||
test(`Mongo CRUD using ${apiVersionDescription}`, async ({ page }) => {
|
||||
test.skip();
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = "testcollection"; // A unique collection name isn't needed because the database is unique
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
const { documentId: docId, partitionKeys } = 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();
|
||||
@@ -50,7 +49,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
expect(resultData?._id).toEqual(docId);
|
||||
});
|
||||
test(`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();
|
||||
|
||||
@@ -33,7 +33,6 @@ test.describe("Test Mongo Pagination", () => {
|
||||
});
|
||||
|
||||
test("should execute a query and load more results", async ({ page }) => {
|
||||
test.skip();
|
||||
const query = "{}";
|
||||
|
||||
await queryEditor.locator.click();
|
||||
|
||||
@@ -1,265 +1,264 @@
|
||||
// /* 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, TestContainerContext } 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, TestContainerContext } from "../../testData";
|
||||
|
||||
// test.describe("Container Copy - Offline Migration", () => {
|
||||
// let contexts: TestContainerContext[];
|
||||
// let page: Page;
|
||||
// let wrapper: Locator;
|
||||
// let panel: Locator;
|
||||
// let frame: Frame;
|
||||
// let expectedJobName: string;
|
||||
// let sourceAccountName: string;
|
||||
// let expectedSubscriptionName: string;
|
||||
// let expectedCopyJobNameInitial: string;
|
||||
test.describe("Container Copy - Offline Migration", () => {
|
||||
let contexts: TestContainerContext[];
|
||||
let page: Page;
|
||||
let wrapper: Locator;
|
||||
let panel: Locator;
|
||||
let frame: Frame;
|
||||
let expectedJobName: string;
|
||||
let sourceAccountName: string;
|
||||
let expectedSubscriptionName: string;
|
||||
let expectedCopyJobNameInitial: string;
|
||||
|
||||
// test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
||||
// contexts = await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
||||
contexts = 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()}`;
|
||||
// sourceAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
// });
|
||||
page = await browser.newPage();
|
||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
expectedJobName = `offline_test_job_${Date.now()}`;
|
||||
sourceAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
});
|
||||
|
||||
// test.afterEach("Cleanup after offline migration test", async () => {
|
||||
// await page.unroute(/.*/, (route) => route.continue());
|
||||
// await page.close();
|
||||
// await Promise.all(contexts.map((context) => context?.dispose()));
|
||||
// });
|
||||
test.afterEach("Cleanup after offline migration test", async () => {
|
||||
await page.unroute(/.*/, (route) => route.continue());
|
||||
await page.close();
|
||||
await Promise.all(contexts.map((context) => context?.dispose()));
|
||||
});
|
||||
|
||||
// test("Successfully create and manage offline migration copy job", async () => {
|
||||
// test.skip();
|
||||
// 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 = sourceAccountName;
|
||||
// expectedSubscriptionName = await subscriptionDropdown.locator("span.ms-Dropdown-title").innerText();
|
||||
// Setup subscription and account
|
||||
const subscriptionDropdown = panel.getByTestId("subscription-dropdown");
|
||||
const expectedAccountName = sourceAccountName;
|
||||
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("destination-subscription-name")).toHaveText(expectedSubscriptionName);
|
||||
// await expect(previewContainer.getByTestId("destination-account-name")).toHaveText(expectedAccountName);
|
||||
// Verify job preview details
|
||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
await expect(previewContainer).toBeVisible();
|
||||
await expect(previewContainer.getByTestId("destination-subscription-name")).toHaveText(expectedSubscriptionName);
|
||||
await expect(previewContainer.getByTestId("destination-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();
|
||||
// Verify panel closes and job appears in the list
|
||||
await expect(panel).not.toBeVisible();
|
||||
|
||||
// const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||
// await filterTextField.waitFor({ state: "visible" });
|
||||
// await filterTextField.fill(validJobName);
|
||||
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||
await filterTextField.waitFor({ state: "visible" });
|
||||
await filterTextField.fill(validJobName);
|
||||
|
||||
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
// await jobsListContainer.waitFor({ state: "visible" });
|
||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
await jobsListContainer.waitFor({ state: "visible" });
|
||||
|
||||
// const jobItem = jobsListContainer.getByText(validJobName);
|
||||
// await jobItem.waitFor({ state: "visible" });
|
||||
// await expect(jobItem).toBeVisible();
|
||||
// });
|
||||
// });
|
||||
const jobItem = jobsListContainer.getByText(validJobName);
|
||||
await jobItem.waitFor({ state: "visible" });
|
||||
await expect(jobItem).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,192 +1,191 @@
|
||||
// /* 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, TestContainerContext } 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, TestContainerContext } from "../../testData";
|
||||
|
||||
// test.describe("Container Copy - Online Migration", () => {
|
||||
// let contexts: TestContainerContext[];
|
||||
// let page: Page;
|
||||
// let wrapper: Locator;
|
||||
// let panel: Locator;
|
||||
// let frame: Frame;
|
||||
// let sourceAccountName: string;
|
||||
test.describe("Container Copy - Online Migration", () => {
|
||||
let contexts: TestContainerContext[];
|
||||
let page: Page;
|
||||
let wrapper: Locator;
|
||||
let panel: Locator;
|
||||
let frame: Frame;
|
||||
let sourceAccountName: string;
|
||||
|
||||
// test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
||||
// contexts = await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
||||
contexts = await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||
|
||||
// page = await browser.newPage();
|
||||
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
// sourceAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
// });
|
||||
page = await browser.newPage();
|
||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||
sourceAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
});
|
||||
|
||||
// test.afterEach("Cleanup after online migration test", async () => {
|
||||
// await page.unroute(/.*/, (route) => route.continue());
|
||||
// await page.close();
|
||||
// await Promise.all(contexts.map((context) => context?.dispose()));
|
||||
// });
|
||||
test.afterEach("Cleanup after online migration test", async () => {
|
||||
await page.unroute(/.*/, (route) => route.continue());
|
||||
await page.close();
|
||||
await Promise.all(contexts.map((context) => context?.dispose()));
|
||||
});
|
||||
|
||||
// test("Successfully create and manage online migration copy job", async () => {
|
||||
// test.skip();
|
||||
// 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("destination-account-name")).toHaveText(sourceAccountName);
|
||||
// Verify job preview and create the online migration job
|
||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||
await expect(previewContainer.getByTestId("destination-account-name")).toHaveText(sourceAccountName);
|
||||
|
||||
// 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,
|
||||
// `${sourceAccountName}/dataTransferJobs/${onlineMigrationJobName}`,
|
||||
// "PUT",
|
||||
// );
|
||||
// await copyButton.click();
|
||||
// await page.waitForTimeout(1000); // Reduced wait time
|
||||
const copyJobCreationPromise = waitForApiResponse(
|
||||
page,
|
||||
`${sourceAccountName}/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();
|
||||
// Verify panel closes and job appears in the list
|
||||
await expect(panel).not.toBeVisible();
|
||||
|
||||
// const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||
// await filterTextField.waitFor({ state: "visible" });
|
||||
// await filterTextField.fill(onlineMigrationJobName);
|
||||
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||
await filterTextField.waitFor({ state: "visible" });
|
||||
await filterTextField.fill(onlineMigrationJobName);
|
||||
|
||||
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
// await jobsListContainer.waitFor({ state: "visible" });
|
||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||
await jobsListContainer.waitFor({ state: "visible" });
|
||||
|
||||
// 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" });
|
||||
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" });
|
||||
|
||||
// // Verify job status changes to queued state
|
||||
// await expect(statusCell).toContainText(/running|queued|pending/i);
|
||||
// Verify job status changes to queued state
|
||||
await expect(statusCell).toContainText(/running|queued|pending/i);
|
||||
|
||||
// // 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,
|
||||
// `${sourceAccountName}/dataTransferJobs/${onlineMigrationJobName}/pause`,
|
||||
// "POST",
|
||||
// );
|
||||
// expect(pauseResponse.ok()).toBe(true);
|
||||
const pauseResponse = await waitForApiResponse(
|
||||
page,
|
||||
`${sourceAccountName}/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 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,297 +1,296 @@
|
||||
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
// import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
// import { set } from "lodash";
|
||||
// import { ContainerCopy, getAccountName, TestAccount } from "../../fx";
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||
import { set } from "lodash";
|
||||
import { ContainerCopy, getAccountName, TestAccount } from "../../fx";
|
||||
|
||||
// const VISIBLE_TIMEOUT_MS = 30 * 1000;
|
||||
const VISIBLE_TIMEOUT_MS = 30 * 1000;
|
||||
|
||||
// test.describe("Container Copy - Permission Screen Verification", () => {
|
||||
// let page: Page;
|
||||
// let wrapper: Locator;
|
||||
// let panel: Locator;
|
||||
// let frame: Frame;
|
||||
// let sourceAccountName: string;
|
||||
// let targetAccountName: string;
|
||||
test.describe("Container Copy - Permission Screen Verification", () => {
|
||||
let page: Page;
|
||||
let wrapper: Locator;
|
||||
let panel: Locator;
|
||||
let frame: Frame;
|
||||
let sourceAccountName: string;
|
||||
let targetAccountName: string;
|
||||
|
||||
// test.beforeEach("Setup for each test", async ({ browser }) => {
|
||||
// page = await browser.newPage();
|
||||
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQL));
|
||||
// targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
// sourceAccountName = getAccountName(TestAccount.SQL);
|
||||
// });
|
||||
test.beforeEach("Setup for each test", async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQL));
|
||||
targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||
sourceAccountName = getAccountName(TestAccount.SQL);
|
||||
});
|
||||
|
||||
// test.afterEach("Cleanup after each test", async () => {
|
||||
// await page.unrouteAll({ behavior: "ignoreErrors" });
|
||||
// await page.close();
|
||||
// });
|
||||
test.afterEach("Cleanup after each test", async () => {
|
||||
await page.unrouteAll({ behavior: "ignoreErrors" });
|
||||
await page.close();
|
||||
});
|
||||
|
||||
// test("Verify online container copy permissions panel functionality", async () => {
|
||||
// test.skip();
|
||||
// expect(wrapper).not.toBeNull();
|
||||
test("Verify online container copy permissions panel functionality", async () => {
|
||||
expect(wrapper).not.toBeNull();
|
||||
|
||||
// // Verify all command bar buttons are visible
|
||||
// await wrapper.locator(".commandBarContainer").waitFor({ state: "visible", timeout: VISIBLE_TIMEOUT_MS });
|
||||
// Verify all command bar buttons are visible
|
||||
await wrapper.locator(".commandBarContainer").waitFor({ state: "visible", timeout: VISIBLE_TIMEOUT_MS });
|
||||
|
||||
// const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
// await expect(createCopyJobButton).toBeVisible();
|
||||
// await expect(wrapper.getByTestId("CommandBar/Button:Refresh")).toBeVisible();
|
||||
// await expect(wrapper.getByTestId("CommandBar/Button:Feedback")).toBeVisible();
|
||||
const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||
await expect(createCopyJobButton).toBeVisible();
|
||||
await expect(wrapper.getByTestId("CommandBar/Button:Refresh")).toBeVisible();
|
||||
await expect(wrapper.getByTestId("CommandBar/Button:Feedback")).toBeVisible();
|
||||
|
||||
// // Mock Resource Graph API — fires on auto-subscription selection to populate account dropdown
|
||||
// await page.route(
|
||||
// "https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
|
||||
// async (route) => {
|
||||
// const request = route.request();
|
||||
// if (
|
||||
// request.method() === "POST" &&
|
||||
// (request.postDataJSON()?.query as string) ===
|
||||
// "resources | where type =~ 'microsoft.documentdb/databaseaccounts'"
|
||||
// ) {
|
||||
// const response = await route.fetch();
|
||||
// const responseData = await response.json();
|
||||
// if (responseData.data && Array.isArray(responseData.data)) {
|
||||
// responseData.data = responseData.data.map((d: any) => {
|
||||
// d.properties.backupPolicy.type = "Periodic";
|
||||
// return d;
|
||||
// });
|
||||
// }
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify(responseData),
|
||||
// });
|
||||
// } else {
|
||||
// await route.continue();
|
||||
// }
|
||||
// },
|
||||
// { times: 2 },
|
||||
// );
|
||||
// Mock Resource Graph API — fires on auto-subscription selection to populate account dropdown
|
||||
await page.route(
|
||||
"https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",
|
||||
async (route) => {
|
||||
const request = route.request();
|
||||
if (
|
||||
request.method() === "POST" &&
|
||||
(request.postDataJSON()?.query as string) ===
|
||||
"resources | where type =~ 'microsoft.documentdb/databaseaccounts'"
|
||||
) {
|
||||
const response = await route.fetch();
|
||||
const responseData = await response.json();
|
||||
if (responseData.data && Array.isArray(responseData.data)) {
|
||||
responseData.data = responseData.data.map((d: any) => {
|
||||
d.properties.backupPolicy.type = "Periodic";
|
||||
return d;
|
||||
});
|
||||
}
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(responseData),
|
||||
});
|
||||
} else {
|
||||
await route.continue();
|
||||
}
|
||||
},
|
||||
{ times: 2 },
|
||||
);
|
||||
|
||||
// // Open the Create Copy Job panel
|
||||
// await createCopyJobButton.click();
|
||||
// panel = frame.getByTestId("Panel:Create copy job");
|
||||
// await expect(panel).toBeVisible();
|
||||
// await expect(panel.getByRole("heading", { name: "Create copy job" })).toBeVisible();
|
||||
// Open the Create Copy Job panel
|
||||
await createCopyJobButton.click();
|
||||
panel = frame.getByTestId("Panel:Create copy job");
|
||||
await expect(panel).toBeVisible();
|
||||
await expect(panel.getByRole("heading", { name: "Create copy job" })).toBeVisible();
|
||||
|
||||
// // Select a different account for cross-account testing
|
||||
// const accountDropdown = panel.getByTestId("account-dropdown");
|
||||
// await accountDropdown.click();
|
||||
// Select a different account for cross-account testing
|
||||
const accountDropdown = panel.getByTestId("account-dropdown");
|
||||
await accountDropdown.click();
|
||||
|
||||
// const dropdownItemsWrapper = frame.locator("div.ms-Dropdown-items");
|
||||
// expect(await dropdownItemsWrapper.getAttribute("aria-label")).toEqual("Account");
|
||||
const dropdownItemsWrapper = frame.locator("div.ms-Dropdown-items");
|
||||
expect(await dropdownItemsWrapper.getAttribute("aria-label")).toEqual("Account");
|
||||
|
||||
// const allDropdownItems = await dropdownItemsWrapper.locator(`button.ms-Dropdown-item[role='option']`).all();
|
||||
const allDropdownItems = await dropdownItemsWrapper.locator(`button.ms-Dropdown-item[role='option']`).all();
|
||||
|
||||
// for (const item of allDropdownItems) {
|
||||
// const testContent = (await item.textContent()) ?? "";
|
||||
// if (testContent.trim() === targetAccountName.trim()) {
|
||||
// await item.click();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
for (const item of allDropdownItems) {
|
||||
const testContent = (await item.textContent()) ?? "";
|
||||
if (testContent.trim() === targetAccountName.trim()) {
|
||||
await item.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// // 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();
|
||||
// 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 panel.getByRole("button", { name: "Next" }).click();
|
||||
await panel.getByRole("button", { name: "Next" }).click();
|
||||
|
||||
// // Verify Assign Permissions panel for online copy
|
||||
// const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
||||
// await expect(permissionScreen).toBeVisible();
|
||||
// await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
// await expect(permissionScreen.getByText("Cross-account container copy", { exact: true })).toBeVisible();
|
||||
// Verify Assign Permissions panel for online copy
|
||||
const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
||||
await expect(permissionScreen).toBeVisible();
|
||||
await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||
await expect(permissionScreen.getByText("Cross-account container copy", { exact: true })).toBeVisible();
|
||||
|
||||
// // Setup API mocking for the source account
|
||||
// await page.route(`**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}**`, async (route) => {
|
||||
// const mockData = {
|
||||
// identity: {
|
||||
// type: "SystemAssigned",
|
||||
// principalId: "00-11-22-33",
|
||||
// },
|
||||
// properties: {
|
||||
// defaultIdentity: "SystemAssignedIdentity",
|
||||
// backupPolicy: {
|
||||
// type: "Continuous",
|
||||
// },
|
||||
// capabilities: [{ name: "EnableOnlineContainerCopy" }],
|
||||
// },
|
||||
// };
|
||||
// if (route.request().method() === "GET") {
|
||||
// const response = await route.fetch();
|
||||
// const actualData = await response.json();
|
||||
// const mergedData = { ...actualData };
|
||||
// Setup API mocking for the source account
|
||||
await page.route(`**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}**`, async (route) => {
|
||||
const mockData = {
|
||||
identity: {
|
||||
type: "SystemAssigned",
|
||||
principalId: "00-11-22-33",
|
||||
},
|
||||
properties: {
|
||||
defaultIdentity: "SystemAssignedIdentity",
|
||||
backupPolicy: {
|
||||
type: "Continuous",
|
||||
},
|
||||
capabilities: [{ name: "EnableOnlineContainerCopy" }],
|
||||
},
|
||||
};
|
||||
if (route.request().method() === "GET") {
|
||||
const response = await route.fetch();
|
||||
const actualData = await response.json();
|
||||
const mergedData = { ...actualData };
|
||||
|
||||
// set(mergedData, "identity", mockData.identity);
|
||||
// set(mergedData, "properties.defaultIdentity", mockData.properties.defaultIdentity);
|
||||
// set(mergedData, "properties.backupPolicy", mockData.properties.backupPolicy);
|
||||
// set(mergedData, "properties.capabilities", mockData.properties.capabilities);
|
||||
set(mergedData, "identity", mockData.identity);
|
||||
set(mergedData, "properties.defaultIdentity", mockData.properties.defaultIdentity);
|
||||
set(mergedData, "properties.backupPolicy", mockData.properties.backupPolicy);
|
||||
set(mergedData, "properties.capabilities", mockData.properties.capabilities);
|
||||
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify(mergedData),
|
||||
// });
|
||||
// } else {
|
||||
// await route.continue();
|
||||
// }
|
||||
// });
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(mergedData),
|
||||
});
|
||||
} else {
|
||||
await route.continue();
|
||||
}
|
||||
});
|
||||
|
||||
// // Verify Point-in-Time Restore functionality
|
||||
// const expandedOnlineAccordionHeader = permissionScreen
|
||||
// .getByTestId("permission-group-container-onlineConfigs")
|
||||
// .locator("button[aria-expanded='true']");
|
||||
// await expect(expandedOnlineAccordionHeader).toBeVisible();
|
||||
// Verify Point-in-Time Restore functionality
|
||||
const expandedOnlineAccordionHeader = permissionScreen
|
||||
.getByTestId("permission-group-container-onlineConfigs")
|
||||
.locator("button[aria-expanded='true']");
|
||||
await expect(expandedOnlineAccordionHeader).toBeVisible();
|
||||
|
||||
// const accordionItem = expandedOnlineAccordionHeader
|
||||
// .locator("xpath=ancestor::*[contains(@class, 'fui-AccordionItem') or contains(@data-test, 'accordion-item')]")
|
||||
// .first();
|
||||
const accordionItem = expandedOnlineAccordionHeader
|
||||
.locator("xpath=ancestor::*[contains(@class, 'fui-AccordionItem') or contains(@data-test, 'accordion-item')]")
|
||||
.first();
|
||||
|
||||
// const accordionPanel = accordionItem
|
||||
// .locator("[role='tabpanel'], .fui-AccordionPanel, [data-test*='panel']")
|
||||
// .first();
|
||||
const accordionPanel = accordionItem
|
||||
.locator("[role='tabpanel'], .fui-AccordionPanel, [data-test*='panel']")
|
||||
.first();
|
||||
|
||||
// // Install clock mock and test PITR functionality
|
||||
// await page.clock.install({ time: new Date("2024-01-01T10:00:00Z") });
|
||||
// Install clock mock and test PITR functionality
|
||||
await page.clock.install({ time: new Date("2024-01-01T10:00:00Z") });
|
||||
|
||||
// const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
||||
// await expect(pitrBtn).toBeVisible();
|
||||
// await pitrBtn.click({ force: true });
|
||||
const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
||||
await expect(pitrBtn).toBeVisible();
|
||||
await pitrBtn.click({ force: true });
|
||||
|
||||
// // Verify new page opens with correct URL pattern
|
||||
// page.context().on("page", async (newPage) => {
|
||||
// const expectedUrlEndPattern = new RegExp(
|
||||
// `/providers/Microsoft.(DocumentDB|DocumentDb)/databaseAccounts/${sourceAccountName}/backupRestore`,
|
||||
// );
|
||||
// expect(newPage.url()).toMatch(expectedUrlEndPattern);
|
||||
// await newPage.close();
|
||||
// });
|
||||
// Verify new page opens with correct URL pattern
|
||||
page.context().on("page", async (newPage) => {
|
||||
const expectedUrlEndPattern = new RegExp(
|
||||
`/providers/Microsoft.(DocumentDB|DocumentDb)/databaseAccounts/${sourceAccountName}/backupRestore`,
|
||||
);
|
||||
expect(newPage.url()).toMatch(expectedUrlEndPattern);
|
||||
await newPage.close();
|
||||
});
|
||||
|
||||
// const loadingOverlay = frame.locator("[data-test='loading-overlay']");
|
||||
// await expect(loadingOverlay).toBeVisible();
|
||||
const loadingOverlay = frame.locator("[data-test='loading-overlay']");
|
||||
await expect(loadingOverlay).toBeVisible();
|
||||
|
||||
// const refreshBtn = accordionPanel.getByTestId("pointInTimeRestore:RefreshBtn");
|
||||
// await expect(refreshBtn).not.toBeVisible();
|
||||
const refreshBtn = accordionPanel.getByTestId("pointInTimeRestore:RefreshBtn");
|
||||
await expect(refreshBtn).not.toBeVisible();
|
||||
|
||||
// // Fast forward time by 11 minutes
|
||||
// await page.clock.fastForward(11 * 60 * 1000);
|
||||
// Fast forward time by 11 minutes
|
||||
await page.clock.fastForward(11 * 60 * 1000);
|
||||
|
||||
// await expect(refreshBtn).toBeVisible({ timeout: 5000 });
|
||||
// await expect(pitrBtn).not.toBeVisible();
|
||||
await expect(refreshBtn).toBeVisible({ timeout: 5000 });
|
||||
await expect(pitrBtn).not.toBeVisible();
|
||||
|
||||
// // Setup additional API mocks for role assignments and permissions
|
||||
// // In the redesigned flow, role assignments are checked on the SOURCE account (current account = sourceAccountName).
|
||||
// // The destination account (selectedAccountName) manages identity; source account holds the role assignments.
|
||||
// await page.route(
|
||||
// `**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}/sqlRoleAssignments*`,
|
||||
// async (route) => {
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify({
|
||||
// value: [
|
||||
// {
|
||||
// principalId: "00-11-22-33",
|
||||
// roleDefinitionId: `Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}/77-88-99`,
|
||||
// },
|
||||
// ],
|
||||
// }),
|
||||
// });
|
||||
// },
|
||||
// );
|
||||
// Setup additional API mocks for role assignments and permissions
|
||||
// In the redesigned flow, role assignments are checked on the SOURCE account (current account = sourceAccountName).
|
||||
// The destination account (selectedAccountName) manages identity; source account holds the role assignments.
|
||||
await page.route(
|
||||
`**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}/sqlRoleAssignments*`,
|
||||
async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
value: [
|
||||
{
|
||||
principalId: "00-11-22-33",
|
||||
roleDefinitionId: `Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}/77-88-99`,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
// await page.route("**/Microsoft.DocumentDB/databaseAccounts/*/77-88-99**", async (route) => {
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify({
|
||||
// value: [
|
||||
// {
|
||||
// // Built-in Cosmos DB Data Contributor role (read-write), required by checkTargetHasReadWriteRoleOnSource
|
||||
// name: "00000000-0000-0000-0000-000000000002",
|
||||
// },
|
||||
// ],
|
||||
// }),
|
||||
// });
|
||||
// });
|
||||
await page.route("**/Microsoft.DocumentDB/databaseAccounts/*/77-88-99**", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
value: [
|
||||
{
|
||||
// Built-in Cosmos DB Data Contributor role (read-write), required by checkTargetHasReadWriteRoleOnSource
|
||||
name: "00000000-0000-0000-0000-000000000002",
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
// await page.route(`**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}**`, async (route) => {
|
||||
// const mockData = {
|
||||
// identity: {
|
||||
// type: "SystemAssigned",
|
||||
// principalId: "00-11-22-33",
|
||||
// },
|
||||
// properties: {
|
||||
// defaultIdentity: "SystemAssignedIdentity",
|
||||
// backupPolicy: {
|
||||
// type: "Continuous",
|
||||
// },
|
||||
// capabilities: [{ name: "EnableOnlineContainerCopy" }],
|
||||
// },
|
||||
// };
|
||||
await page.route(`**/Microsoft.DocumentDB/databaseAccounts/${sourceAccountName}**`, async (route) => {
|
||||
const mockData = {
|
||||
identity: {
|
||||
type: "SystemAssigned",
|
||||
principalId: "00-11-22-33",
|
||||
},
|
||||
properties: {
|
||||
defaultIdentity: "SystemAssignedIdentity",
|
||||
backupPolicy: {
|
||||
type: "Continuous",
|
||||
},
|
||||
capabilities: [{ name: "EnableOnlineContainerCopy" }],
|
||||
},
|
||||
};
|
||||
|
||||
// if (route.request().method() === "PATCH") {
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify({ status: "Succeeded" }),
|
||||
// });
|
||||
// } else if (route.request().method() === "GET") {
|
||||
// const response = await route.fetch();
|
||||
// const actualData = await response.json();
|
||||
// const mergedData = { ...actualData };
|
||||
// set(mergedData, "identity", mockData.identity);
|
||||
// set(mergedData, "properties.defaultIdentity", mockData.properties.defaultIdentity);
|
||||
// set(mergedData, "properties.backupPolicy", mockData.properties.backupPolicy);
|
||||
// set(mergedData, "properties.capabilities", mockData.properties.capabilities);
|
||||
if (route.request().method() === "PATCH") {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ status: "Succeeded" }),
|
||||
});
|
||||
} else if (route.request().method() === "GET") {
|
||||
const response = await route.fetch();
|
||||
const actualData = await response.json();
|
||||
const mergedData = { ...actualData };
|
||||
set(mergedData, "identity", mockData.identity);
|
||||
set(mergedData, "properties.defaultIdentity", mockData.properties.defaultIdentity);
|
||||
set(mergedData, "properties.backupPolicy", mockData.properties.backupPolicy);
|
||||
set(mergedData, "properties.capabilities", mockData.properties.capabilities);
|
||||
|
||||
// await route.fulfill({
|
||||
// status: 200,
|
||||
// contentType: "application/json",
|
||||
// body: JSON.stringify(mergedData),
|
||||
// });
|
||||
// } else {
|
||||
// await route.continue();
|
||||
// }
|
||||
// });
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(mergedData),
|
||||
});
|
||||
} else {
|
||||
await route.continue();
|
||||
}
|
||||
});
|
||||
|
||||
// // Verify cross-account permissions functionality
|
||||
// const expandedCrossAccordionHeader = permissionScreen
|
||||
// .getByTestId("permission-group-container-crossAccountConfigs")
|
||||
// .locator("button[aria-expanded='true']");
|
||||
// await expect(expandedCrossAccordionHeader).toBeVisible();
|
||||
// Verify cross-account permissions functionality
|
||||
const expandedCrossAccordionHeader = permissionScreen
|
||||
.getByTestId("permission-group-container-crossAccountConfigs")
|
||||
.locator("button[aria-expanded='true']");
|
||||
await expect(expandedCrossAccordionHeader).toBeVisible();
|
||||
|
||||
// const crossAccordionItem = expandedCrossAccordionHeader
|
||||
// .locator("xpath=ancestor::*[contains(@class, 'fui-AccordionItem') or contains(@data-test, 'accordion-item')]")
|
||||
// .first();
|
||||
const crossAccordionItem = expandedCrossAccordionHeader
|
||||
.locator("xpath=ancestor::*[contains(@class, 'fui-AccordionItem') or contains(@data-test, 'accordion-item')]")
|
||||
.first();
|
||||
|
||||
// const crossAccordionPanel = crossAccordionItem
|
||||
// .locator("[role='tabpanel'], .fui-AccordionPanel, [data-test*='panel']")
|
||||
// .first();
|
||||
const crossAccordionPanel = crossAccordionItem
|
||||
.locator("[role='tabpanel'], .fui-AccordionPanel, [data-test*='panel']")
|
||||
.first();
|
||||
|
||||
// const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
||||
// await expect(toggleButton).toBeVisible();
|
||||
// await toggleButton.click({ force: true });
|
||||
const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
||||
await expect(toggleButton).toBeVisible();
|
||||
await toggleButton.click({ force: true });
|
||||
|
||||
// // Verify popover functionality
|
||||
// const popover = frame.locator("[data-test='popover-container']");
|
||||
// await expect(popover).toBeVisible();
|
||||
// Verify popover functionality
|
||||
const popover = frame.locator("[data-test='popover-container']");
|
||||
await expect(popover).toBeVisible();
|
||||
|
||||
// const yesButton = popover.getByRole("button", { name: /Yes/i });
|
||||
// const noButton = popover.getByRole("button", { name: /No/i });
|
||||
// await expect(yesButton).toBeVisible();
|
||||
// await expect(noButton).toBeVisible();
|
||||
const yesButton = popover.getByRole("button", { name: /Yes/i });
|
||||
const noButton = popover.getByRole("button", { name: /No/i });
|
||||
await expect(yesButton).toBeVisible();
|
||||
await expect(noButton).toBeVisible();
|
||||
|
||||
// await yesButton.click({ force: true });
|
||||
await yesButton.click({ force: true });
|
||||
|
||||
// // Verify loading states
|
||||
// await expect(loadingOverlay).toBeVisible();
|
||||
// await expect(loadingOverlay).toBeHidden({ timeout: 10 * 1000 });
|
||||
// await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
||||
// Verify loading states
|
||||
await expect(loadingOverlay).toBeVisible();
|
||||
await expect(loadingOverlay).toBeHidden({ timeout: 10 * 1000 });
|
||||
await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
||||
|
||||
// // Cancel the panel to clean up
|
||||
// await panel.getByRole("button", { name: "Cancel" }).click({ force: true });
|
||||
// });
|
||||
// });
|
||||
// Cancel the panel to clean up
|
||||
await panel.getByRole("button", { name: "Cancel" }).click({ force: true });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,7 +41,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
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();
|
||||
@@ -57,7 +56,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
||||
|
||||
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();
|
||||
@@ -149,7 +147,6 @@ test.describe.serial("Upload Item", () => {
|
||||
});
|
||||
|
||||
test("upload document", async () => {
|
||||
test.skip();
|
||||
// Create file to upload
|
||||
const TestDataJsonString: string = JSON.stringify(TestData, null, 2);
|
||||
writeFileSync(uploadDocumentFilePath, TestDataJsonString);
|
||||
@@ -186,7 +183,6 @@ test.describe.serial("Upload Item", () => {
|
||||
});
|
||||
|
||||
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
|
||||
|
||||
@@ -19,7 +19,6 @@ test.beforeEach("Open Data Explorer", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("Duplicate Items tab opens a second Items tab", async () => {
|
||||
test.skip();
|
||||
// Open Items tab
|
||||
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
||||
await containerNode.expand();
|
||||
@@ -47,7 +46,6 @@ test("Duplicate Items tab opens a second Items tab", async () => {
|
||||
});
|
||||
|
||||
test("Duplicate Query tab preserves query text in new tab", async () => {
|
||||
test.skip();
|
||||
// Open a new SQL query tab via container context menu
|
||||
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
||||
await containerNode.openContextMenu();
|
||||
@@ -80,7 +78,6 @@ test("Duplicate Query tab preserves query text in new tab", async () => {
|
||||
});
|
||||
|
||||
test("Right-click context menu does not appear for the Home tab", async () => {
|
||||
test.skip();
|
||||
// The Home tab (ReactTabKind) is never duplicable — no context menu should appear
|
||||
await explorer.tabNavHeader("Home").click({ button: "right" });
|
||||
|
||||
@@ -90,7 +87,6 @@ test("Right-click context menu does not appear for the Home tab", async () => {
|
||||
});
|
||||
|
||||
test("Close tab from right-click menu closes the tab", async () => {
|
||||
test.skip();
|
||||
// Open Items tab
|
||||
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
||||
await containerNode.expand();
|
||||
|
||||
@@ -56,13 +56,11 @@ async function setupIndexAdvisorTab(page: Page, customQuery?: string) {
|
||||
}
|
||||
|
||||
test("Index Advisor tab loads without errors", async ({ page }) => {
|
||||
test.skip();
|
||||
const { indexAdvisorTab } = await setupIndexAdvisorTab(page);
|
||||
await expect(indexAdvisorTab).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
|
||||
test("Verify UI sections are collapsible", async ({ page }) => {
|
||||
test.skip();
|
||||
const { explorer } = await setupIndexAdvisorTab(page);
|
||||
|
||||
// Verify both section headers exist
|
||||
@@ -86,7 +84,6 @@ test("Verify UI sections are collapsible", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("Verify SDK response structure - Case 1: Empty response", async ({ page }) => {
|
||||
test.skip();
|
||||
const { explorer } = await setupIndexAdvisorTab(page);
|
||||
|
||||
// Verify both section headers still exist even with no data
|
||||
@@ -104,7 +101,6 @@ test("Verify SDK response structure - Case 1: Empty response", async ({ page })
|
||||
});
|
||||
|
||||
test("Verify index suggestions and apply potential index", async ({ page }) => {
|
||||
test.skip();
|
||||
const customQuery = 'SELECT * FROM c WHERE c.partitionKey = "partition_1" ORDER BY c.randomData';
|
||||
const { explorer } = await setupIndexAdvisorTab(page, customQuery);
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ test.afterAll("Delete Test Database", async () => {
|
||||
});
|
||||
|
||||
test("Query results", async () => {
|
||||
test.skip();
|
||||
// Run the query and verify the results
|
||||
await queryEditor.locator.click();
|
||||
const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
|
||||
@@ -58,7 +57,6 @@ test("Query results", async () => {
|
||||
});
|
||||
|
||||
test("Query stats", async () => {
|
||||
test.skip();
|
||||
// Run the query and verify the results
|
||||
await queryEditor.locator.click();
|
||||
const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
|
||||
@@ -115,7 +113,6 @@ test("View button toggles between vertical and horizontal layout", async () => {
|
||||
});
|
||||
|
||||
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/);
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { getNoSqlRbacToken } from "../NoSqlTestSetup";
|
||||
|
||||
test("SQL account using Resource token", async ({ page }) => {
|
||||
test.skip();
|
||||
const nosqlAccountRbacToken = getNoSqlRbacToken() ?? "";
|
||||
test.skip(nosqlAccountRbacToken.length > 0, "Resource tokens not supported when using data plane RBAC.");
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ test.describe("Change Partition Key", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
|
||||
@@ -29,7 +29,6 @@ test.describe("Computed Properties", () => {
|
||||
});
|
||||
|
||||
test("Add valid computed property", async ({ page }) => {
|
||||
test.skip();
|
||||
await clearComputedPropertiesTextBoxContent({ page });
|
||||
|
||||
// Create computed property
|
||||
@@ -55,7 +54,6 @@ test.describe("Computed Properties", () => {
|
||||
});
|
||||
|
||||
test("Add computed property with invalid query", async ({ page }) => {
|
||||
test.skip();
|
||||
await clearComputedPropertiesTextBoxContent({ page });
|
||||
|
||||
// Create computed property with no VALUE keyword in query
|
||||
@@ -81,7 +79,6 @@ test.describe("Computed Properties", () => {
|
||||
});
|
||||
|
||||
test("Add computed property with invalid json", async ({ page }) => {
|
||||
test.skip();
|
||||
await clearComputedPropertiesTextBoxContent({ page });
|
||||
|
||||
// Create computed property with no VALUE keyword in query
|
||||
|
||||
@@ -73,7 +73,6 @@ test.describe("Vector Policy under Scale & Settings", () => {
|
||||
};
|
||||
|
||||
test("Add new vector embedding policy", async () => {
|
||||
test.skip();
|
||||
const existingCount = await getPolicyCount();
|
||||
|
||||
// Click Add vector embedding button
|
||||
@@ -103,7 +102,6 @@ test.describe("Vector Policy under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
test("Existing vector embedding policy fields are disabled", async () => {
|
||||
test.skip();
|
||||
// Ensure there is at least one saved policy
|
||||
await ensureExistingPolicy();
|
||||
|
||||
@@ -117,7 +115,6 @@ test.describe("Vector Policy under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
|
||||
@@ -141,7 +138,6 @@ test.describe("Vector Policy under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
test("Delete existing vector embedding policy", async () => {
|
||||
test.skip();
|
||||
// Ensure there is at least one saved policy to delete
|
||||
const existingCount = await ensureExistingPolicy();
|
||||
|
||||
@@ -175,7 +171,6 @@ test.describe("Vector Policy under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
test("Validation error for empty path", async () => {
|
||||
test.skip();
|
||||
const existingCount = await getPolicyCount();
|
||||
|
||||
const addButton = explorer.frame.locator("#add-vector-policy");
|
||||
|
||||
@@ -88,7 +88,6 @@ test.describe("Data Masking under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@@ -109,7 +108,6 @@ test.describe("Data Masking under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ test.describe("Autoscale throughput", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
|
||||
@@ -48,7 +47,6 @@ test.describe("Autoscale throughput", () => {
|
||||
});
|
||||
|
||||
test("Update autoscale max throughput passed allowed limit", async () => {
|
||||
test.skip();
|
||||
const softAllowedMaxThroughputString = await setup.explorer.frame
|
||||
.getByTestId("soft-allowed-maximum-throughput")
|
||||
.innerText();
|
||||
@@ -60,7 +58,6 @@ test.describe("Autoscale throughput", () => {
|
||||
});
|
||||
|
||||
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(
|
||||
@@ -81,7 +78,6 @@ test.describe("Manual throughput", () => {
|
||||
});
|
||||
|
||||
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(
|
||||
@@ -91,7 +87,6 @@ test.describe("Manual throughput", () => {
|
||||
});
|
||||
|
||||
test("Update manual throughput passed allowed limit", async () => {
|
||||
test.skip();
|
||||
const softAllowedMaxThroughputString = await setup.explorer.frame
|
||||
.getByTestId("soft-allowed-maximum-throughput")
|
||||
.innerText();
|
||||
|
||||
@@ -22,7 +22,6 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
|
||||
@@ -36,7 +35,6 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
test("Update TTL to On (with user entry)", async () => {
|
||||
test.skip();
|
||||
const ttlOnRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-option" });
|
||||
await ttlOnRadioButton.click();
|
||||
|
||||
@@ -54,7 +52,6 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
});
|
||||
|
||||
test("Set Geospatial Config to Geometry then Geography", async () => {
|
||||
test.skip();
|
||||
const geometryRadioButton = explorer.frame.getByRole("radio", { name: "geometry-option" });
|
||||
await geometryRadioButton.click();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ test.describe("Shared Throughput Option Removed from Creation Dialogs", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
@@ -38,7 +37,6 @@ test.describe("Shared Throughput Option Removed from Creation Dialogs", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
@@ -63,7 +61,6 @@ test.describe("Shared Throughput Option Removed from Creation Dialogs", () => {
|
||||
});
|
||||
|
||||
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 });
|
||||
|
||||
@@ -103,7 +100,6 @@ test.describe("Shared Throughput Option Removed from Creation Dialogs", () => {
|
||||
});
|
||||
|
||||
test.describe("Database with Shared Throughput", () => {
|
||||
test.skip();
|
||||
let dbContext: TestDatabaseContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
const containerId = "sharedcontainer";
|
||||
@@ -123,7 +119,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
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 });
|
||||
@@ -142,7 +137,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
test("Add container to shared database without dedicated throughput", async () => {
|
||||
test.skip();
|
||||
// Create database with shared manual throughput
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
@@ -196,7 +190,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
test("Scale shared database manual throughput", async () => {
|
||||
test.skip();
|
||||
// Create database with shared manual throughput (400 RU/s)
|
||||
dbContext = await createTestDB({ throughput: 400 });
|
||||
|
||||
@@ -222,7 +215,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
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 });
|
||||
|
||||
@@ -257,7 +249,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
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)
|
||||
@@ -277,7 +268,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
test("Scale shared database autoscale throughput", async () => {
|
||||
test.skip();
|
||||
// Create database with shared autoscale throughput (max 1000 RU/s)
|
||||
dbContext = await createTestDB({ maxThroughput: 1000 });
|
||||
|
||||
@@ -303,7 +293,6 @@ test.describe("Database with Shared Throughput", () => {
|
||||
});
|
||||
|
||||
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 });
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ test.describe("Throughput bucket settings", () => {
|
||||
}
|
||||
|
||||
test("Activate throughput bucket #2", async () => {
|
||||
test.skip();
|
||||
// Activate bucket 2
|
||||
const bucket2Toggle = explorer.frame.getByTestId("bucket-2-active-toggle");
|
||||
await bucket2Toggle.click();
|
||||
@@ -43,7 +42,6 @@ test.describe("Throughput bucket settings", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
@@ -61,7 +59,6 @@ test.describe("Throughput bucket settings", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
@@ -82,7 +79,6 @@ test.describe("Throughput bucket settings", () => {
|
||||
});
|
||||
|
||||
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();
|
||||
|
||||
@@ -2,7 +2,6 @@ import { expect, test } from "@playwright/test";
|
||||
import { DataExplorer, TestAccount } from "../fx";
|
||||
|
||||
test("Self Serve", async ({ page, browserName }) => {
|
||||
test.skip();
|
||||
/* Skipping this test which fails on webkit only. Clicking on the dropdown does not open the dropdown.
|
||||
It fails with the error below which seems to indicate that some <div> (with class "ms-Stack css-128", the label of the dropdown?) is intercepting the click.
|
||||
- retrying click action, attempt #555
|
||||
|
||||
@@ -3,7 +3,6 @@ import { expect, test } from "@playwright/test";
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
|
||||
test("Tables CRUD", async ({ page }) => {
|
||||
test.skip();
|
||||
const tableId = generateUniqueName("table"); // A unique table name IS needed because the database is shared when using Table Storage.
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
Reference in New Issue
Block a user