e-enable more tests.

This commit is contained in:
Jade Welton
2026-07-10 07:57:39 -07:00
parent 6645752873
commit c19c1dc5fd
7 changed files with 668 additions and 668 deletions
@@ -1,251 +1,251 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// const FIXTURE_URL = "https://127.0.0.1:1234/searchableDropdownFixture.html"; const FIXTURE_URL = "https://127.0.0.1:1234/searchableDropdownFixture.html";
// test.describe("SearchableDropdown Component", () => { test.describe("SearchableDropdown Component", () => {
// test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// await page.goto(FIXTURE_URL); await page.goto(FIXTURE_URL);
// await page.waitForSelector("[data-test='subscription-dropdown']"); await page.waitForSelector("[data-test='subscription-dropdown']");
// }); });
// test("renders subscription dropdown with label and placeholder", async ({ page }) => { test("renders subscription dropdown with label and placeholder", async ({ page }) => {
// await expect(page.getByText("Subscription", { exact: true })).toBeVisible(); await expect(page.getByText("Subscription", { exact: true })).toBeVisible();
// await expect(page.getByText("Select a Subscription")).toBeVisible(); await expect(page.getByText("Select a Subscription")).toBeVisible();
// }); });
// test("renders account dropdown as disabled when no subscription is selected", async ({ page }) => { test("renders account dropdown as disabled when no subscription is selected", async ({ page }) => {
// const accountButton = page.locator("[data-test='account-dropdown'] button"); const accountButton = page.locator("[data-test='account-dropdown'] button");
// await expect(accountButton).toBeDisabled(); await expect(accountButton).toBeDisabled();
// }); });
// test("opens subscription dropdown and shows all mock items", async ({ page }) => { test("opens subscription dropdown and shows all mock items", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await expect(page.getByText("Development Subscription")).toBeVisible(); await expect(page.getByText("Development Subscription")).toBeVisible();
// await expect(page.getByText("Production Subscription")).toBeVisible(); await expect(page.getByText("Production Subscription")).toBeVisible();
// await expect(page.getByText("Testing Subscription")).toBeVisible(); await expect(page.getByText("Testing Subscription")).toBeVisible();
// await expect(page.getByText("Staging Subscription")).toBeVisible(); await expect(page.getByText("Staging Subscription")).toBeVisible();
// await expect(page.getByText("QA Subscription")).toBeVisible(); await expect(page.getByText("QA Subscription")).toBeVisible();
// }); });
// test("filters subscription items by search text", async ({ page }) => { test("filters subscription items by search text", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// const searchBox = page.getByPlaceholder("Search by Subscription name"); const searchBox = page.getByPlaceholder("Search by Subscription name");
// await searchBox.fill("Dev"); await searchBox.fill("Dev");
// await expect(page.getByText("Development Subscription")).toBeVisible(); await expect(page.getByText("Development Subscription")).toBeVisible();
// await expect(page.getByText("Production Subscription")).not.toBeVisible(); await expect(page.getByText("Production Subscription")).not.toBeVisible();
// await expect(page.getByText("Testing Subscription")).not.toBeVisible(); await expect(page.getByText("Testing Subscription")).not.toBeVisible();
// }); });
// test("performs case-insensitive filtering", async ({ page }) => { test("performs case-insensitive filtering", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// const searchBox = page.getByPlaceholder("Search by Subscription name"); const searchBox = page.getByPlaceholder("Search by Subscription name");
// await searchBox.fill("production"); await searchBox.fill("production");
// await expect(page.getByText("Production Subscription")).toBeVisible(); await expect(page.getByText("Production Subscription")).toBeVisible();
// await expect(page.getByText("Development Subscription")).not.toBeVisible(); await expect(page.getByText("Development Subscription")).not.toBeVisible();
// }); });
// test("shows 'No items found' when search yields no results", async ({ page }) => { test("shows 'No items found' when search yields no results", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// const searchBox = page.getByPlaceholder("Search by Subscription name"); const searchBox = page.getByPlaceholder("Search by Subscription name");
// await searchBox.fill("NonexistentSubscription"); await searchBox.fill("NonexistentSubscription");
// await expect(page.getByText("No items found")).toBeVisible(); await expect(page.getByText("No items found")).toBeVisible();
// }); });
// test("selects a subscription and updates button text", async ({ page }) => { test("selects a subscription and updates button text", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Development Subscription").click(); await page.getByText("Development Subscription").click();
// // Dropdown should close and show selected item // Dropdown should close and show selected item
// await expect( await expect(
// page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription"), page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription"),
// ).toBeVisible(); ).toBeVisible();
// // External state should update // External state should update
// await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Development Subscription"); await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Development Subscription");
// }); });
// test("enables account dropdown after subscription is selected", async ({ page }) => { test("enables account dropdown after subscription is selected", async ({ page }) => {
// // Select a subscription first // Select a subscription first
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Production Subscription").click(); await page.getByText("Production Subscription").click();
// // Account dropdown should now be enabled // Account dropdown should now be enabled
// const accountButton = page.locator("[data-test='account-dropdown'] button"); const accountButton = page.locator("[data-test='account-dropdown'] button");
// await expect(accountButton).toBeEnabled(); await expect(accountButton).toBeEnabled();
// }); });
// test("shows account items after subscription selection", async ({ page }) => { test("shows account items after subscription selection", async ({ page }) => {
// // Select subscription // Select subscription
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Development Subscription").click(); await page.getByText("Development Subscription").click();
// // Open account dropdown // Open account dropdown
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
// await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
// await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
// await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
// }); });
// test("filters account items by search text", async ({ page }) => { test("filters account items by search text", async ({ page }) => {
// // Select subscription // Select subscription
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Testing Subscription").click(); await page.getByText("Testing Subscription").click();
// // Open account dropdown and filter // Open account dropdown and filter
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// const searchBox = page.getByPlaceholder("Search by Account name"); const searchBox = page.getByPlaceholder("Search by Account name");
// await searchBox.fill("prod"); await searchBox.fill("prod");
// await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
// await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible(); await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible();
// }); });
// test("selects an account and updates both dropdowns", async ({ page }) => { test("selects an account and updates both dropdowns", async ({ page }) => {
// // Select subscription // Select subscription
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Staging Subscription").click(); await page.getByText("Staging Subscription").click();
// // Select account // Select account
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// await page.getByText("cosmos-dev-westus").click(); await page.getByText("cosmos-dev-westus").click();
// // Verify both selections // Verify both selections
// await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Staging Subscription"); await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Staging Subscription");
// await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-dev-westus"); await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-dev-westus");
// }); });
// test("clears search filter when dropdown is closed and reopened", async ({ page }) => { test("clears search filter when dropdown is closed and reopened", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// const searchBox = page.getByPlaceholder("Search by Subscription name"); const searchBox = page.getByPlaceholder("Search by Subscription name");
// await searchBox.fill("Dev"); await searchBox.fill("Dev");
// // Select an item to close dropdown // Select an item to close dropdown
// await page.getByText("Development Subscription").click(); await page.getByText("Development Subscription").click();
// // Reopen dropdown // Reopen dropdown
// await page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription").click(); await page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription").click();
// // Search box should be cleared // Search box should be cleared
// const reopenedSearchBox = page.getByPlaceholder("Search by Subscription name"); const reopenedSearchBox = page.getByPlaceholder("Search by Subscription name");
// await expect(reopenedSearchBox).toHaveValue(""); await expect(reopenedSearchBox).toHaveValue("");
// // All items should be visible again // All items should be visible again
// await expect(page.getByText("Production Subscription")).toBeVisible(); await expect(page.getByText("Production Subscription")).toBeVisible();
// await expect(page.getByText("Testing Subscription")).toBeVisible(); await expect(page.getByText("Testing Subscription")).toBeVisible();
// }); });
// test("renders account dropdown with label and placeholder after subscription selected", async ({ page }) => { test("renders account dropdown with label and placeholder after subscription selected", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Development Subscription").click(); await page.getByText("Development Subscription").click();
// await expect(page.getByText("Cosmos DB Account")).toBeVisible(); await expect(page.getByText("Cosmos DB Account")).toBeVisible();
// await expect(page.getByText("Select an Account")).toBeVisible(); await expect(page.getByText("Select an Account")).toBeVisible();
// }); });
// test("performs case-insensitive filtering on account dropdown", async ({ page }) => { test("performs case-insensitive filtering on account dropdown", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Development Subscription").click(); await page.getByText("Development Subscription").click();
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// const searchBox = page.getByPlaceholder("Search by Account name"); const searchBox = page.getByPlaceholder("Search by Account name");
// await searchBox.fill("COSMOS-TEST"); await searchBox.fill("COSMOS-TEST");
// await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
// await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible(); await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible();
// await expect(page.getByText("cosmos-prod-eastus")).not.toBeVisible(); await expect(page.getByText("cosmos-prod-eastus")).not.toBeVisible();
// await expect(page.getByText("cosmos-staging-westus2")).not.toBeVisible(); await expect(page.getByText("cosmos-staging-westus2")).not.toBeVisible();
// }); });
// test("shows 'No items found' in account dropdown when search yields no results", async ({ page }) => { test("shows 'No items found' in account dropdown when search yields no results", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Production Subscription").click(); await page.getByText("Production Subscription").click();
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// const searchBox = page.getByPlaceholder("Search by Account name"); const searchBox = page.getByPlaceholder("Search by Account name");
// await searchBox.fill("nonexistent-account"); await searchBox.fill("nonexistent-account");
// await expect(page.getByText("No items found")).toBeVisible(); await expect(page.getByText("No items found")).toBeVisible();
// }); });
// test("clears account search filter when dropdown is closed and reopened", async ({ page }) => { test("clears account search filter when dropdown is closed and reopened", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Testing Subscription").click(); await page.getByText("Testing Subscription").click();
// // Open account dropdown and filter // Open account dropdown and filter
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// const searchBox = page.getByPlaceholder("Search by Account name"); const searchBox = page.getByPlaceholder("Search by Account name");
// await searchBox.fill("prod"); await searchBox.fill("prod");
// // Select an item to close // Select an item to close
// await page.getByText("cosmos-prod-eastus").click(); await page.getByText("cosmos-prod-eastus").click();
// // Reopen and verify filter is cleared // Reopen and verify filter is cleared
// await page.locator("[data-test='account-dropdown']").getByText("cosmos-prod-eastus").click(); await page.locator("[data-test='account-dropdown']").getByText("cosmos-prod-eastus").click();
// const reopenedSearchBox = page.getByPlaceholder("Search by Account name"); const reopenedSearchBox = page.getByPlaceholder("Search by Account name");
// await expect(reopenedSearchBox).toHaveValue(""); await expect(reopenedSearchBox).toHaveValue("");
// // All items visible again // All items visible again
// await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
// await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
// await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
// }); });
// test("account dropdown updates button text after selection", async ({ page }) => { test("account dropdown updates button text after selection", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("QA Subscription").click(); await page.getByText("QA Subscription").click();
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// await page.getByText("cosmos-test-northeurope").click(); await page.getByText("cosmos-test-northeurope").click();
// // Button should show selected account name // Button should show selected account name
// await expect(page.locator("[data-test='account-dropdown']").getByText("cosmos-test-northeurope")).toBeVisible(); await expect(page.locator("[data-test='account-dropdown']").getByText("cosmos-test-northeurope")).toBeVisible();
// await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-test-northeurope"); await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-test-northeurope");
// }); });
// test("account dropdown shows all 4 mock accounts", async ({ page }) => { test("account dropdown shows all 4 mock accounts", async ({ page }) => {
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// await page.getByText("Staging Subscription").click(); await page.getByText("Staging Subscription").click();
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
// await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
// await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
// await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
// }); });
// test("shows 'No Cosmos DB Accounts Found' when account list is empty (no subscription selected)", async ({ test("shows 'No Cosmos DB Accounts Found' when account list is empty (no subscription selected)", async ({
// page, page,
// }) => { }) => {
// // The account dropdown shows "No Cosmos DB Accounts Found" when disabled with no items // The account dropdown shows "No Cosmos DB Accounts Found" when disabled with no items
// const accountButtonText = page.locator("[data-test='account-dropdown'] button"); const accountButtonText = page.locator("[data-test='account-dropdown'] button");
// await expect(accountButtonText).toHaveText("No Cosmos DB Accounts Found"); await expect(accountButtonText).toHaveText("No Cosmos DB Accounts Found");
// }); });
// test("full flow: select subscription, filter accounts, select account", async ({ page }) => { test("full flow: select subscription, filter accounts, select account", async ({ page }) => {
// // Step 1: Select a subscription // Step 1: Select a subscription
// await page.getByText("Select a Subscription").click(); await page.getByText("Select a Subscription").click();
// const subSearchBox = page.getByPlaceholder("Search by Subscription name"); const subSearchBox = page.getByPlaceholder("Search by Subscription name");
// await subSearchBox.fill("QA"); await subSearchBox.fill("QA");
// await page.getByText("QA Subscription").click(); await page.getByText("QA Subscription").click();
// // Step 2: Open account dropdown and filter // Step 2: Open account dropdown and filter
// await page.getByText("Select an Account").click(); await page.getByText("Select an Account").click();
// const accountSearchBox = page.getByPlaceholder("Search by Account name"); const accountSearchBox = page.getByPlaceholder("Search by Account name");
// await accountSearchBox.fill("staging"); await accountSearchBox.fill("staging");
// await page.getByText("cosmos-staging-westus2").click(); await page.getByText("cosmos-staging-westus2").click();
// // Step 3: Verify final state // Step 3: Verify final state
// await expect(page.locator("[data-test='selected-subscription']")).toHaveText("QA Subscription"); await expect(page.locator("[data-test='selected-subscription']")).toHaveText("QA Subscription");
// await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-staging-westus2"); await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-staging-westus2");
// }); });
// }); });
+82 -82
View File
@@ -1,103 +1,103 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { setupCORSBypass } from "../CORSBypass"; import { setupCORSBypass } from "../CORSBypass";
// import { CommandBarButton, DataExplorer, DocumentsTab, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, DocumentsTab, TestAccount } from "../fx";
// import { retry, serializeMongoToJson, setPartitionKeys } from "../testData"; import { retry, serializeMongoToJson, setPartitionKeys } from "../testData";
// import { documentTestCases } from "./testCases"; import { documentTestCases } from "./testCases";
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// let documentsTab: DocumentsTab = null!; let documentsTab: DocumentsTab = null!;
// for (const { name, databaseId, containerId, documents } of documentTestCases) { for (const { name, databaseId, containerId, documents } of documentTestCases) {
// test.describe(`Test MongoRU Documents with ${name}`, () => { test.describe(`Test MongoRU Documents with ${name}`, () => {
// // test.skip(true, "Temporarily disabling all tests in this spec file"); // test.skip(true, "Temporarily disabling all tests in this spec file");
// test.beforeEach("Open documents tab", async ({ page }) => { test.beforeEach("Open documents tab", async ({ page }) => {
// await setupCORSBypass(page); await setupCORSBypass(page);
// explorer = await DataExplorer.open(page, TestAccount.MongoReadonly); explorer = await DataExplorer.open(page, TestAccount.MongoReadonly);
// const containerNode = await explorer.waitForContainerNode(databaseId, containerId); const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
// await containerNode.expand(); await containerNode.expand();
// const containerMenuNode = await explorer.waitForContainerDocumentsNode(databaseId, containerId); const containerMenuNode = await explorer.waitForContainerDocumentsNode(databaseId, containerId);
// await containerMenuNode.element.click(); await containerMenuNode.element.click();
// documentsTab = explorer.documentsTab("tab0"); documentsTab = explorer.documentsTab("tab0");
// await documentsTab.documentsFilter.waitFor(); await documentsTab.documentsFilter.waitFor();
// await documentsTab.documentsListPane.waitFor(); await documentsTab.documentsListPane.waitFor();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// }); });
// test.afterEach(async ({ page }) => { test.afterEach(async ({ page }) => {
// await page.unrouteAll({ behavior: "ignoreErrors" }); await page.unrouteAll({ behavior: "ignoreErrors" });
// }); });
// for (const document of documents) { for (const document of documents) {
// const { documentId: docId, partitionKeys } = document; const { documentId: docId, partitionKeys } = document;
// test.describe(`Document ID: ${docId}`, () => { test.describe(`Document ID: ${docId}`, () => {
// test(`should load and view document ${docId}`, async () => { test(`should load and view document ${docId}`, async () => {
// test.skip(); test.skip();
// const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0); const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
// await span.waitFor(); await span.waitFor();
// await expect(span).toBeVisible(); await expect(span).toBeVisible();
// await span.click(); await span.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// const resultText = await documentsTab.resultsEditor.text(); const resultText = await documentsTab.resultsEditor.text();
// const resultData = serializeMongoToJson(resultText!); const resultData = serializeMongoToJson(resultText!);
// expect(resultText).not.toBeNull(); expect(resultText).not.toBeNull();
// expect(resultData?._id).not.toBeNull(); expect(resultData?._id).not.toBeNull();
// expect(resultData?._id).toEqual(docId); 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 ({ page }) => {
// test.skip(); test.skip();
// const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0); const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
// await span.waitFor(); await span.waitFor();
// await expect(span).toBeVisible(); await expect(span).toBeVisible();
// await span.click(); await span.click();
// await page.waitForTimeout(5000); // wait for 5 seconds to ensure document is fully loaded. waitforTimeout is not recommended generally but here we are working around flakiness in the test env await page.waitForTimeout(5000); // wait for 5 seconds to ensure document is fully loaded. waitforTimeout is not recommended generally but here we are working around flakiness in the test env
// let newDocumentId; let newDocumentId;
// await retry(async () => { await retry(async () => {
// const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewDocument, 5000); const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewDocument, 5000);
// await expect(newDocumentButton).toBeVisible(); await expect(newDocumentButton).toBeVisible();
// await expect(newDocumentButton).toBeEnabled(); await expect(newDocumentButton).toBeEnabled();
// await newDocumentButton.click(); await newDocumentButton.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// newDocumentId = `${Date.now().toString()}-delete`; newDocumentId = `${Date.now().toString()}-delete`;
// const newDocument = { const newDocument = {
// _id: newDocumentId, _id: newDocumentId,
// ...setPartitionKeys(partitionKeys || []), ...setPartitionKeys(partitionKeys || []),
// }; };
// await documentsTab.resultsEditor.setText(JSON.stringify(newDocument)); await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
// const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000); const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000);
// await saveButton.click({ timeout: 5000 }); await saveButton.click({ timeout: 5000 });
// await expect(saveButton).toBeHidden({ timeout: 5000 }); await expect(saveButton).toBeHidden({ timeout: 5000 });
// }, 3); }, 3);
// await documentsTab.setFilter(`{_id: "${newDocumentId}"}`); await documentsTab.setFilter(`{_id: "${newDocumentId}"}`);
// await documentsTab.filterButton.click(); await documentsTab.filterButton.click();
// const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0); const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
// await newSpan.waitFor(); await newSpan.waitFor();
// await newSpan.click(); await newSpan.click();
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// const deleteButton = await explorer.waitForCommandBarButton(CommandBarButton.Delete, 5000); const deleteButton = await explorer.waitForCommandBarButton(CommandBarButton.Delete, 5000);
// await deleteButton.click(); await deleteButton.click();
// const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000); const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000);
// await deleteDialogButton.click(); await deleteDialogButton.click();
// const deletedSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0); const deletedSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
// await expect(deletedSpan).toHaveCount(0); await expect(deletedSpan).toHaveCount(0);
// }); });
// }); });
// } }
// }); });
// } }
+104 -104
View File
@@ -1,133 +1,133 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { setupCORSBypass } from "../CORSBypass"; import { setupCORSBypass } from "../CORSBypass";
// import { CommandBarButton, DataExplorer, Editor, QueryTab, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, Editor, QueryTab, TestAccount } from "../fx";
// import { serializeMongoToJson } from "../testData"; import { serializeMongoToJson } from "../testData";
// const databaseId = "test-e2etests-mongo-pagination"; const databaseId = "test-e2etests-mongo-pagination";
// const collectionId = "test-coll-mongo-pagination"; const collectionId = "test-coll-mongo-pagination";
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.setTimeout(5 * 60 * 1000); test.setTimeout(5 * 60 * 1000);
// test.describe("Test Mongo Pagination", () => { test.describe("Test Mongo Pagination", () => {
// let queryTab: QueryTab; let queryTab: QueryTab;
// let queryEditor: Editor; let queryEditor: Editor;
// test.beforeEach("Open query tab", async ({ page }) => { test.beforeEach("Open query tab", async ({ page }) => {
// await setupCORSBypass(page); await setupCORSBypass(page);
// explorer = await DataExplorer.open(page, TestAccount.MongoReadonly); explorer = await DataExplorer.open(page, TestAccount.MongoReadonly);
// const containerNode = await explorer.waitForContainerNode(databaseId, collectionId); const containerNode = await explorer.waitForContainerNode(databaseId, collectionId);
// await containerNode.expand(); await containerNode.expand();
// const containerMenuNode = await explorer.waitForContainerDocumentsNode(databaseId, collectionId); const containerMenuNode = await explorer.waitForContainerDocumentsNode(databaseId, collectionId);
// await containerMenuNode.openContextMenu(); await containerMenuNode.openContextMenu();
// await containerMenuNode.contextMenuItem("New Query").click(); await containerMenuNode.contextMenuItem("New Query").click();
// queryTab = explorer.queryTab("tab0"); queryTab = explorer.queryTab("tab0");
// queryEditor = queryTab.editor(); queryEditor = queryTab.editor();
// await queryEditor.locator.waitFor({ timeout: 30 * 1000 }); await queryEditor.locator.waitFor({ timeout: 30 * 1000 });
// await queryTab.executeCTA.waitFor(); await queryTab.executeCTA.waitFor();
// await explorer.frame.getByTestId("NotificationConsole/ExpandCollapseButton").click(); await explorer.frame.getByTestId("NotificationConsole/ExpandCollapseButton").click();
// await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor(); await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
// }); });
// test("should execute a query and load more results", async ({ page }) => { test("should execute a query and load more results", async ({ page }) => {
// test.skip(); test.skip();
// const query = "{}"; const query = "{}";
// await queryEditor.locator.click(); await queryEditor.locator.click();
// await queryEditor.setText(query); await queryEditor.setText(query);
// const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery); const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
// await executeQueryButton.click(); await executeQueryButton.click();
// // Wait for query execution to complete // Wait for query execution to complete
// await expect(queryTab.resultsView).toBeVisible({ timeout: 60000 }); await expect(queryTab.resultsView).toBeVisible({ timeout: 60000 });
// await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 30000 }); await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 30000 });
// // Get initial results // Get initial results
// const resultText = await queryTab.resultsEditor.text(); const resultText = await queryTab.resultsEditor.text();
// if (!resultText || resultText.trim() === "" || resultText.trim() === "[]") { if (!resultText || resultText.trim() === "" || resultText.trim() === "[]") {
// throw new Error("Query returned no results - the collection appears to be empty"); throw new Error("Query returned no results - the collection appears to be empty");
// } }
// const resultData = serializeMongoToJson(resultText); const resultData = serializeMongoToJson(resultText);
// if (resultData.length === 0) { if (resultData.length === 0) {
// throw new Error("Parsed results contain 0 documents - collection is empty"); throw new Error("Parsed results contain 0 documents - collection is empty");
// } }
// if (resultData.length < 100) { if (resultData.length < 100) {
// expect(resultData.length).toBeGreaterThan(0); expect(resultData.length).toBeGreaterThan(0);
// return; return;
// } }
// expect(resultData.length).toBe(100); expect(resultData.length).toBe(100);
// // Pagination test // Pagination test
// let totalPagesLoaded = 1; let totalPagesLoaded = 1;
// const maxLoadMoreAttempts = 10; const maxLoadMoreAttempts = 10;
// for (let loadMoreAttempts = 0; loadMoreAttempts < maxLoadMoreAttempts; loadMoreAttempts++) { for (let loadMoreAttempts = 0; loadMoreAttempts < maxLoadMoreAttempts; loadMoreAttempts++) {
// const loadMoreButton = queryTab.resultsView.getByText("Load more"); const loadMoreButton = queryTab.resultsView.getByText("Load more");
// try { try {
// await expect(loadMoreButton).toBeVisible({ timeout: 5000 }); await expect(loadMoreButton).toBeVisible({ timeout: 5000 });
// } catch { } catch {
// // Load more button not visible - pagination complete // Load more button not visible - pagination complete
// break; break;
// } }
// const beforeClickText = await queryTab.resultsEditor.text(); const beforeClickText = await queryTab.resultsEditor.text();
// const beforeClickHash = Buffer.from(beforeClickText || "") const beforeClickHash = Buffer.from(beforeClickText || "")
// .toString("base64") .toString("base64")
// .substring(0, 50); .substring(0, 50);
// await loadMoreButton.click(); await loadMoreButton.click();
// // Wait for content to update // Wait for content to update
// let editorContentChanged = false; let editorContentChanged = false;
// for (let waitAttempt = 1; waitAttempt <= 3; waitAttempt++) { for (let waitAttempt = 1; waitAttempt <= 3; waitAttempt++) {
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// const currentEditorText = await queryTab.resultsEditor.text(); const currentEditorText = await queryTab.resultsEditor.text();
// const currentHash = Buffer.from(currentEditorText || "") const currentHash = Buffer.from(currentEditorText || "")
// .toString("base64") .toString("base64")
// .substring(0, 50); .substring(0, 50);
// if (currentHash !== beforeClickHash) { if (currentHash !== beforeClickHash) {
// editorContentChanged = true; editorContentChanged = true;
// break; break;
// } }
// } }
// if (editorContentChanged) { if (editorContentChanged) {
// totalPagesLoaded++; totalPagesLoaded++;
// } else { } else {
// // No content change detected, stop pagination // No content change detected, stop pagination
// break; break;
// } }
// await page.waitForTimeout(1000); await page.waitForTimeout(1000);
// } }
// // Final verification // Final verification
// const finalIndicator = queryTab.resultsView.locator("text=/\\d+ - \\d+/"); const finalIndicator = queryTab.resultsView.locator("text=/\\d+ - \\d+/");
// const finalIndicatorText = await finalIndicator.textContent(); const finalIndicatorText = await finalIndicator.textContent();
// if (finalIndicatorText) { if (finalIndicatorText) {
// const match = finalIndicatorText.match(/(\d+) - (\d+)/); const match = finalIndicatorText.match(/(\d+) - (\d+)/);
// if (match) { if (match) {
// const totalDocuments = parseInt(match[2]); const totalDocuments = parseInt(match[2]);
// expect(totalDocuments).toBe(405); expect(totalDocuments).toBe(405);
// expect(totalPagesLoaded).toBe(5); expect(totalPagesLoaded).toBe(5);
// } else { } else {
// throw new Error(`Invalid results indicator format: ${finalIndicatorText}`); throw new Error(`Invalid results indicator format: ${finalIndicatorText}`);
// } }
// } else { } else {
// expect(totalPagesLoaded).toBe(5); expect(totalPagesLoaded).toBe(5);
// } }
// }); });
// }); });
+85 -85
View File
@@ -1,109 +1,109 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { DataExplorer, TestAccount } from "../fx"; import { DataExplorer, TestAccount } from "../fx";
// import { createTestSQLContainer, TestContainerContext } from "../testData"; import { createTestSQLContainer, TestContainerContext } from "../testData";
// let context: TestContainerContext = null!; let context: TestContainerContext = null!;
// let explorer: DataExplorer = null!; let explorer: DataExplorer = null!;
// test.beforeAll("Create Test Database", async () => { test.beforeAll("Create Test Database", async () => {
// context = await createTestSQLContainer({ includeTestData: false }); context = await createTestSQLContainer({ includeTestData: false });
// }); });
// test.afterAll("Delete Test Database", async () => { test.afterAll("Delete Test Database", async () => {
// await context?.dispose(); await context?.dispose();
// }); });
// test.beforeEach("Open Data Explorer", async ({ page }) => { test.beforeEach("Open Data Explorer", async ({ page }) => {
// explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
// }); });
// test("Duplicate Items tab opens a second Items tab", async () => { test("Duplicate Items tab opens a second Items tab", async () => {
// test.skip(); test.skip();
// // Open Items tab // Open Items tab
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.expand(); await containerNode.expand();
// const itemsNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id); const itemsNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id);
// await itemsNode.element.click(); await itemsNode.element.click();
// const documentsTab = explorer.documentsTab("tab0"); const documentsTab = explorer.documentsTab("tab0");
// await documentsTab.documentsFilter.waitFor({ timeout: 30_000 }); await documentsTab.documentsFilter.waitFor({ timeout: 30_000 });
// // Right-click the tab nav header // Right-click the tab nav header
// await explorer.tabNavHeader("tab0").click({ button: "right" }); await explorer.tabNavHeader("tab0").click({ button: "right" });
// // "Duplicate tab" should be visible in the context menu // "Duplicate tab" should be visible in the context menu
// const duplicateMenuItem = explorer.tabContextMenuItem("Duplicate tab"); const duplicateMenuItem = explorer.tabContextMenuItem("Duplicate tab");
// await expect(duplicateMenuItem).toBeVisible(); await expect(duplicateMenuItem).toBeVisible();
// await duplicateMenuItem.click(); await duplicateMenuItem.click();
// // A second tab should appear // A second tab should appear
// const tab1 = explorer.tab("tab1"); const tab1 = explorer.tab("tab1");
// await expect(tab1).toBeAttached({ timeout: 30_000 }); await expect(tab1).toBeAttached({ timeout: 30_000 });
// // The duplicated tab should also show the Documents content // The duplicated tab should also show the Documents content
// const duplicatedTab = explorer.documentsTab("tab1"); const duplicatedTab = explorer.documentsTab("tab1");
// await duplicatedTab.documentsFilter.waitFor({ timeout: 30_000 }); await duplicatedTab.documentsFilter.waitFor({ timeout: 30_000 });
// }); });
// test("Duplicate Query tab preserves query text in new tab", async () => { test("Duplicate Query tab preserves query text in new tab", async () => {
// test.skip(); test.skip();
// // Open a new SQL query tab via container context menu // Open a new SQL query tab via container context menu
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.openContextMenu(); await containerNode.openContextMenu();
// await containerNode.contextMenuItem("New SQL Query").click(); await containerNode.contextMenuItem("New SQL Query").click();
// const queryTab = explorer.queryTab("tab0"); const queryTab = explorer.queryTab("tab0");
// const editor = queryTab.editor(); const editor = queryTab.editor();
// await editor.locator.waitFor({ timeout: 30_000 }); await editor.locator.waitFor({ timeout: 30_000 });
// // Type a custom query // Type a custom query
// const customQuery = 'SELECT * FROM c WHERE c.id = "duplicate-query-test"'; const customQuery = 'SELECT * FROM c WHERE c.id = "duplicate-query-test"';
// await editor.setText(customQuery); await editor.setText(customQuery);
// // Right-click the tab nav header // Right-click the tab nav header
// await explorer.tabNavHeader("tab0").click({ button: "right" }); await explorer.tabNavHeader("tab0").click({ button: "right" });
// const duplicateMenuItem = explorer.tabContextMenuItem("Duplicate tab"); const duplicateMenuItem = explorer.tabContextMenuItem("Duplicate tab");
// await expect(duplicateMenuItem).toBeVisible(); await expect(duplicateMenuItem).toBeVisible();
// await duplicateMenuItem.click(); await duplicateMenuItem.click();
// // Second query tab should appear // Second query tab should appear
// const tab1 = explorer.tab("tab1"); const tab1 = explorer.tab("tab1");
// await expect(tab1).toBeAttached({ timeout: 30_000 }); await expect(tab1).toBeAttached({ timeout: 30_000 });
// // The duplicated tab should contain the same query text // The duplicated tab should contain the same query text
// const duplicatedQueryTab = explorer.queryTab("tab1"); const duplicatedQueryTab = explorer.queryTab("tab1");
// await duplicatedQueryTab.editor().locator.waitFor({ timeout: 30_000 }); await duplicatedQueryTab.editor().locator.waitFor({ timeout: 30_000 });
// const editorText = await duplicatedQueryTab.editor().text(); const editorText = await duplicatedQueryTab.editor().text();
// expect(editorText).toContain("duplicate-query-test"); expect(editorText).toContain("duplicate-query-test");
// }); });
// test("Right-click context menu does not appear for the Home tab", async () => { test("Right-click context menu does not appear for the Home tab", async () => {
// test.skip(); test.skip();
// // The Home tab (ReactTabKind) is never duplicable — no context menu should appear // The Home tab (ReactTabKind) is never duplicable — no context menu should appear
// await explorer.tabNavHeader("Home").click({ button: "right" }); await explorer.tabNavHeader("Home").click({ button: "right" });
// // Neither menu item should be visible // Neither menu item should be visible
// await expect(explorer.tabContextMenuItem("Duplicate tab")).not.toBeVisible(); await expect(explorer.tabContextMenuItem("Duplicate tab")).not.toBeVisible();
// await expect(explorer.tabContextMenuItem("Close tab")).not.toBeVisible(); await expect(explorer.tabContextMenuItem("Close tab")).not.toBeVisible();
// }); });
// test("Close tab from right-click menu closes the tab", async () => { test("Close tab from right-click menu closes the tab", async () => {
// test.skip(); test.skip();
// // Open Items tab // Open Items tab
// const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id); const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
// await containerNode.expand(); await containerNode.expand();
// const itemsNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id); const itemsNode = await explorer.waitForContainerItemsNode(context.database.id, context.container.id);
// await itemsNode.element.click(); await itemsNode.element.click();
// const documentsTab = explorer.documentsTab("tab0"); const documentsTab = explorer.documentsTab("tab0");
// await documentsTab.documentsFilter.waitFor({ timeout: 30_000 }); await documentsTab.documentsFilter.waitFor({ timeout: 30_000 });
// // Right-click the tab nav header and close the tab // Right-click the tab nav header and close the tab
// await explorer.tabNavHeader("tab0").click({ button: "right" }); await explorer.tabNavHeader("tab0").click({ button: "right" });
// await explorer.tabContextMenuItem("Close tab").click(); await explorer.tabContextMenuItem("Close tab").click();
// // The tab pane should be removed // The tab pane should be removed
// await expect(explorer.tab("tab0")).not.toBeAttached({ timeout: 15_000 }); await expect(explorer.tab("tab0")).not.toBeAttached({ timeout: 15_000 });
// }); });
+117 -117
View File
@@ -1,149 +1,149 @@
// import { expect, test, type Page } from "@playwright/test"; import { expect, test, type Page } from "@playwright/test";
// import { CommandBarButton, DataExplorer, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, TestAccount } from "../fx";
// import { createTestSQLContainer, TestContainerContext } from "../testData"; import { createTestSQLContainer, TestContainerContext } from "../testData";
// // Test container context for setup and cleanup // Test container context for setup and cleanup
// let testContainer: TestContainerContext; let testContainer: TestContainerContext;
// let DATABASE_ID: string; let DATABASE_ID: string;
// let CONTAINER_ID: string; let CONTAINER_ID: string;
// // Set up test database and container with data before all tests // Set up test database and container with data before all tests
// test.beforeAll(async () => { test.beforeAll(async () => {
// testContainer = await createTestSQLContainer({ includeTestData: true }); testContainer = await createTestSQLContainer({ includeTestData: true });
// DATABASE_ID = testContainer.database.id; DATABASE_ID = testContainer.database.id;
// CONTAINER_ID = testContainer.container.id; CONTAINER_ID = testContainer.container.id;
// }); });
// // Clean up test database after all tests // Clean up test database after all tests
// test.afterAll(async () => { test.afterAll(async () => {
// if (testContainer) { if (testContainer) {
// await testContainer.dispose(); await testContainer.dispose();
// } }
// }); });
// // Helper function to set up query tab and navigate to Index Advisor // Helper function to set up query tab and navigate to Index Advisor
// async function setupIndexAdvisorTab(page: Page, customQuery?: string) { async function setupIndexAdvisorTab(page: Page, customQuery?: string) {
// const explorer = await DataExplorer.open(page, TestAccount.SQL); const explorer = await DataExplorer.open(page, TestAccount.SQL);
// const databaseNode = await explorer.waitForNode(DATABASE_ID); const databaseNode = await explorer.waitForNode(DATABASE_ID);
// await databaseNode.expand(); await databaseNode.expand();
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// const containerNode = await explorer.waitForNode(`${DATABASE_ID}/${CONTAINER_ID}`); const containerNode = await explorer.waitForNode(`${DATABASE_ID}/${CONTAINER_ID}`);
// await containerNode.openContextMenu(); await containerNode.openContextMenu();
// await containerNode.contextMenuItem("New SQL Query").click(); await containerNode.contextMenuItem("New SQL Query").click();
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// const queryTab = explorer.queryTab("tab0"); const queryTab = explorer.queryTab("tab0");
// const queryEditor = queryTab.editor(); const queryEditor = queryTab.editor();
// await queryEditor.locator.waitFor({ timeout: 30 * 1000 }); await queryEditor.locator.waitFor({ timeout: 30 * 1000 });
// await queryTab.executeCTA.waitFor(); await queryTab.executeCTA.waitFor();
// if (customQuery) { if (customQuery) {
// await queryEditor.locator.click(); await queryEditor.locator.click();
// await queryEditor.setText(customQuery); await queryEditor.setText(customQuery);
// } }
// const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery); const executeQueryButton = explorer.commandBarButton(CommandBarButton.ExecuteQuery);
// await executeQueryButton.click(); await executeQueryButton.click();
// await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(queryTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
// const indexAdvisorTab = queryTab.resultsView.getByTestId("QueryTab/ResultsPane/ResultsView/IndexAdvisorTab"); const indexAdvisorTab = queryTab.resultsView.getByTestId("QueryTab/ResultsPane/ResultsView/IndexAdvisorTab");
// await indexAdvisorTab.click(); await indexAdvisorTab.click();
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// return { explorer, queryTab, indexAdvisorTab }; return { explorer, queryTab, indexAdvisorTab };
// } }
// test("Index Advisor tab loads without errors", async ({ page }) => { test("Index Advisor tab loads without errors", async ({ page }) => {
// test.skip(); test.skip();
// const { indexAdvisorTab } = await setupIndexAdvisorTab(page); const { indexAdvisorTab } = await setupIndexAdvisorTab(page);
// await expect(indexAdvisorTab).toHaveAttribute("aria-selected", "true"); await expect(indexAdvisorTab).toHaveAttribute("aria-selected", "true");
// }); });
// test("Verify UI sections are collapsible", async ({ page }) => { test("Verify UI sections are collapsible", async ({ page }) => {
// test.skip(); test.skip();
// const { explorer } = await setupIndexAdvisorTab(page); const { explorer } = await setupIndexAdvisorTab(page);
// // Verify both section headers exist // Verify both section headers exist
// const includedHeader = explorer.frame.getByText("Included in Current Policy", { exact: true }); const includedHeader = explorer.frame.getByText("Included in Current Policy", { exact: true });
// const notIncludedHeader = explorer.frame.getByText("Not Included in Current Policy", { exact: true }); const notIncludedHeader = explorer.frame.getByText("Not Included in Current Policy", { exact: true });
// await expect(includedHeader).toBeVisible(); await expect(includedHeader).toBeVisible();
// await expect(notIncludedHeader).toBeVisible(); await expect(notIncludedHeader).toBeVisible();
// // Test collapsibility by checking if chevron/arrow icon changes state // Test collapsibility by checking if chevron/arrow icon changes state
// // Both sections should be expandable/collapsible regardless of content // Both sections should be expandable/collapsible regardless of content
// await includedHeader.click(); await includedHeader.click();
// await page.waitForTimeout(300); await page.waitForTimeout(300);
// await includedHeader.click(); await includedHeader.click();
// await page.waitForTimeout(300); await page.waitForTimeout(300);
// await notIncludedHeader.click(); await notIncludedHeader.click();
// await page.waitForTimeout(300); await page.waitForTimeout(300);
// await notIncludedHeader.click(); await notIncludedHeader.click();
// await page.waitForTimeout(300); await page.waitForTimeout(300);
// }); });
// test("Verify SDK response structure - Case 1: Empty response", async ({ page }) => { test("Verify SDK response structure - Case 1: Empty response", async ({ page }) => {
// test.skip(); test.skip();
// const { explorer } = await setupIndexAdvisorTab(page); const { explorer } = await setupIndexAdvisorTab(page);
// // Verify both section headers still exist even with no data // Verify both section headers still exist even with no data
// await expect(explorer.frame.getByText("Included in Current Policy", { exact: true })).toBeVisible(); await expect(explorer.frame.getByText("Included in Current Policy", { exact: true })).toBeVisible();
// await expect(explorer.frame.getByText("Not Included in Current Policy", { exact: true })).toBeVisible(); await expect(explorer.frame.getByText("Not Included in Current Policy", { exact: true })).toBeVisible();
// // Verify table headers // Verify table headers
// const table = explorer.frame.locator("table"); const table = explorer.frame.locator("table");
// await expect(table.getByText("Index", { exact: true })).toBeVisible(); await expect(table.getByText("Index", { exact: true })).toBeVisible();
// await expect(table.getByText("Estimated Impact", { exact: true })).toBeVisible(); await expect(table.getByText("Estimated Impact", { exact: true })).toBeVisible();
// // Verify "Update Indexing Policy" button is NOT visible when there are no potential indexes // Verify "Update Indexing Policy" button is NOT visible when there are no potential indexes
// const updateButton = explorer.frame.getByRole("button", { name: /Update Indexing Policy/i }); const updateButton = explorer.frame.getByRole("button", { name: /Update Indexing Policy/i });
// await expect(updateButton).not.toBeVisible(); await expect(updateButton).not.toBeVisible();
// }); });
// test("Verify index suggestions and apply potential index", async ({ page }) => { test("Verify index suggestions and apply potential index", async ({ page }) => {
// test.skip(); test.skip();
// const customQuery = 'SELECT * FROM c WHERE c.partitionKey = "partition_1" ORDER BY c.randomData'; const customQuery = 'SELECT * FROM c WHERE c.partitionKey = "partition_1" ORDER BY c.randomData';
// const { explorer } = await setupIndexAdvisorTab(page, customQuery); const { explorer } = await setupIndexAdvisorTab(page, customQuery);
// // Wait for Index Advisor to process the query // Wait for Index Advisor to process the query
// await page.waitForTimeout(2000); await page.waitForTimeout(2000);
// // Verify "Not Included in Current Policy" section has suggestions // Verify "Not Included in Current Policy" section has suggestions
// const notIncludedHeader = explorer.frame.getByText("Not Included in Current Policy", { exact: true }); const notIncludedHeader = explorer.frame.getByText("Not Included in Current Policy", { exact: true });
// await expect(notIncludedHeader).toBeVisible(); await expect(notIncludedHeader).toBeVisible();
// // Find the checkbox for the suggested composite index // Find the checkbox for the suggested composite index
// // The composite index should be /partitionKey ASC, /randomData ASC // The composite index should be /partitionKey ASC, /randomData ASC
// const checkboxes = explorer.frame.locator('input[type="checkbox"]'); const checkboxes = explorer.frame.locator('input[type="checkbox"]');
// const checkboxCount = await checkboxes.count(); const checkboxCount = await checkboxes.count();
// // Should have at least one checkbox for the potential index // Should have at least one checkbox for the potential index
// expect(checkboxCount).toBeGreaterThan(0); expect(checkboxCount).toBeGreaterThan(0);
// // Select the first checkbox (the high-impact composite index) // Select the first checkbox (the high-impact composite index)
// await checkboxes.first().check(); await checkboxes.first().check();
// await page.waitForTimeout(500); await page.waitForTimeout(500);
// // Verify "Update Indexing Policy" button becomes visible // Verify "Update Indexing Policy" button becomes visible
// const updateButton = explorer.frame.getByRole("button", { name: /Update Indexing Policy/i }); const updateButton = explorer.frame.getByRole("button", { name: /Update Indexing Policy/i });
// await expect(updateButton).toBeVisible(); await expect(updateButton).toBeVisible();
// // Click the "Update Indexing Policy" button // Click the "Update Indexing Policy" button
// await updateButton.click(); await updateButton.click();
// await page.waitForTimeout(1000); await page.waitForTimeout(1000);
// // Verify success message appears // Verify success message appears
// const successMessage = explorer.frame.getByText(/Your indexing policy has been updated with the new included paths/i); const successMessage = explorer.frame.getByText(/Your indexing policy has been updated with the new included paths/i);
// await expect(successMessage).toBeVisible(); await expect(successMessage).toBeVisible();
// // Verify the message mentions reviewing changes in Scale & Settings // Verify the message mentions reviewing changes in Scale & Settings
// const reviewMessage = explorer.frame.getByText(/You may review the changes in Scale & Settings/i); const reviewMessage = explorer.frame.getByText(/You may review the changes in Scale & Settings/i);
// await expect(reviewMessage).toBeVisible(); await expect(reviewMessage).toBeVisible();
// // Verify the checkmark icon is shown // Verify the checkmark icon is shown
// const checkmarkIcon = explorer.frame.locator('[data-icon-name="CheckMark"]'); const checkmarkIcon = explorer.frame.locator('[data-icon-name="CheckMark"]');
// await expect(checkmarkIcon).toBeVisible(); await expect(checkmarkIcon).toBeVisible();
// }); });
+52 -52
View File
@@ -1,60 +1,60 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { CosmosDBManagementClient } from "@azure/arm-cosmosdb"; import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
// import { CosmosClient, PermissionMode } from "@azure/cosmos"; import { CosmosClient, PermissionMode } from "@azure/cosmos";
// import { import {
// DataExplorer, DataExplorer,
// TestAccount, TestAccount,
// generateUniqueName, generateUniqueName,
// getAccountName, getAccountName,
// getAzureCLICredentials, getAzureCLICredentials,
// resourceGroupName, resourceGroupName,
// subscriptionId, subscriptionId,
// } from "../fx"; } from "../fx";
// import { getNoSqlRbacToken } from "../NoSqlTestSetup"; import { getNoSqlRbacToken } from "../NoSqlTestSetup";
// test("SQL account using Resource token", async ({ page }) => { test("SQL account using Resource token", async ({ page }) => {
// test.skip(); test.skip();
// const nosqlAccountRbacToken = getNoSqlRbacToken() ?? ""; const nosqlAccountRbacToken = getNoSqlRbacToken() ?? "";
// test.skip(nosqlAccountRbacToken.length > 0, "Resource tokens not supported when using data plane RBAC."); test.skip(nosqlAccountRbacToken.length > 0, "Resource tokens not supported when using data plane RBAC.");
// const credentials = getAzureCLICredentials(); const credentials = getAzureCLICredentials();
// const armClient = new CosmosDBManagementClient(credentials, subscriptionId); const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
// const accountName = getAccountName(TestAccount.SQL); const accountName = getAccountName(TestAccount.SQL);
// const account = await armClient.databaseAccounts.get(resourceGroupName, accountName); const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
// const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName); const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName);
// const dbId = generateUniqueName("db"); const dbId = generateUniqueName("db");
// const collectionId = "testcollection"; const collectionId = "testcollection";
// const client = new CosmosClient({ const client = new CosmosClient({
// endpoint: account.documentEndpoint!, endpoint: account.documentEndpoint!,
// key: keys.primaryMasterKey, key: keys.primaryMasterKey,
// }); });
// const { database } = await client.databases.createIfNotExists({ id: dbId }); const { database } = await client.databases.createIfNotExists({ id: dbId });
// const { container } = await database.containers.createIfNotExists({ id: collectionId }); const { container } = await database.containers.createIfNotExists({ id: collectionId });
// const { user } = await database.users.upsert({ id: "testUser" }); const { user } = await database.users.upsert({ id: "testUser" });
// const { resource: containerPermission } = await user.permissions.upsert({ const { resource: containerPermission } = await user.permissions.upsert({
// id: "partitionLevelPermission", id: "partitionLevelPermission",
// permissionMode: PermissionMode.All, permissionMode: PermissionMode.All,
// resource: container.url, resource: container.url,
// }); });
// await expect(containerPermission).toBeDefined(); await expect(containerPermission).toBeDefined();
// const resourceTokenConnectionString = `AccountEndpoint=${account.documentEndpoint};DatabaseId=${ const resourceTokenConnectionString = `AccountEndpoint=${account.documentEndpoint};DatabaseId=${
// database.id database.id
// };CollectionId=${container.id};${containerPermission!._token}`; };CollectionId=${container.id};${containerPermission!._token}`;
// await page.goto("https://localhost:1234/hostedExplorer.html"); await page.goto("https://localhost:1234/hostedExplorer.html");
// const switchConnectionLink = page.getByTestId("Link:SwitchConnectionType"); const switchConnectionLink = page.getByTestId("Link:SwitchConnectionType");
// await switchConnectionLink.waitFor(); await switchConnectionLink.waitFor();
// await switchConnectionLink.click(); await switchConnectionLink.click();
// await page.getByPlaceholder("Please enter a connection string").fill(resourceTokenConnectionString); await page.getByPlaceholder("Please enter a connection string").fill(resourceTokenConnectionString);
// await page.getByRole("button", { name: "Connect" }).click(); await page.getByRole("button", { name: "Connect" }).click();
// const explorer = await DataExplorer.waitForExplorer(page); const explorer = await DataExplorer.waitForExplorer(page);
// const collectionNode = explorer.treeNode(`${collectionId}`); const collectionNode = explorer.treeNode(`${collectionId}`);
// await collectionNode.element.waitFor(); await collectionNode.element.waitFor();
// await expect(collectionNode.element).toBeAttached(); await expect(collectionNode.element).toBeAttached();
// await database.delete(); await database.delete();
// }); });
+34 -34
View File
@@ -1,41 +1,41 @@
// import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
// import { DataExplorer, TestAccount } from "../fx"; import { DataExplorer, TestAccount } from "../fx";
// test("Self Serve", async ({ page, browserName }) => { test("Self Serve", async ({ page, browserName }) => {
// test.skip(); test.skip();
// /* Skipping this test which fails on webkit only. Clicking on the dropdown does not open the dropdown. /* 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. 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 - retrying click action, attempt #555
// - waiting 500ms - waiting 500ms
// - waiting for element to be visible, enabled and stable - waiting for element to be visible, enabled and stable
// - element is visible, enabled and stable - element is visible, enabled and stable
// - scrolling into view if needed - scrolling into view if needed
// - done scrolling - done scrolling
// - <div class="ms-Stack css-128">…</div> from <div id="selfServeContent" class="selfServeComponentC…>…</div> subtree intercepts pointer events - <div class="ms-Stack css-128">…</div> from <div id="selfServeContent" class="selfServeComponentC…>…</div> subtree intercepts pointer events
// Adding waiting for page to load, forcing click with .click({ force: true }) or setting page viewport with page.setViewportSize() did not help. Adding waiting for page to load, forcing click with .click({ force: true }) or setting page viewport with page.setViewportSize() did not help.
// */ */
// test.skip( test.skip(
// browserName === "webkit", browserName === "webkit",
// "This test only fails on Webkit: clicking on the dropdown does not open the dropdown.", "This test only fails on Webkit: clicking on the dropdown does not open the dropdown.",
// ); );
// const explorer = await DataExplorer.open(page, TestAccount.SQL, "selfServe.html"); const explorer = await DataExplorer.open(page, TestAccount.SQL, "selfServe.html");
// const loggingToggle = explorer.frame.locator("#enableLogging-toggle-input"); const loggingToggle = explorer.frame.locator("#enableLogging-toggle-input");
// await expect(loggingToggle).toBeEnabled(); await expect(loggingToggle).toBeEnabled();
// const regionDropdown = explorer.frame.getByText("Select a region"); const regionDropdown = explorer.frame.getByText("Select a region");
// await regionDropdown.click(); await regionDropdown.click();
// await explorer.frame.getByRole("option").first().click(); await explorer.frame.getByRole("option").first().click();
// const currentRegionLabel = explorer.frame.getByLabel("Current Region"); const currentRegionLabel = explorer.frame.getByLabel("Current Region");
// await currentRegionLabel.waitFor(); await currentRegionLabel.waitFor();
// await expect(currentRegionLabel).toHaveText(/current region selected is .*/); await expect(currentRegionLabel).toHaveText(/current region selected is .*/);
// await expect(loggingToggle).toBeDisabled(); await expect(loggingToggle).toBeDisabled();
// await explorer.frame.locator("#enableDbLevelThroughput-toggle-input").click(); await explorer.frame.locator("#enableDbLevelThroughput-toggle-input").click();
// const slider = explorer.frame.getByLabel("Database Throughput"); const slider = explorer.frame.getByLabel("Database Throughput");
// await slider.waitFor(); await slider.waitFor();
// await expect(slider).toBeAttached(); await expect(slider).toBeAttached();
// }); });