mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-07-22 05:17:11 +01:00
e-enable more tests.
This commit is contained in:
@@ -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