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