Revert "Pk missing fix (#2094)" (#2099)

This reverts commit af0a890516.
This commit is contained in:
sunghyunkang1111
2025-04-09 13:04:44 -05:00
committed by GitHub
parent 0666e11d89
commit a3bfc89318
8 changed files with 21 additions and 259 deletions

View File

@@ -26,7 +26,7 @@ export function getAzureCLICredentials(): AzureCliCredential {
export async function getAzureCLICredentialsToken(): Promise<string> {
const credentials = getAzureCLICredentials();
const token = (await credentials.getToken("https://management.core.windows.net//.default"))?.token || "";
const token = (await credentials.getToken("https://management.core.windows.net//.default")).token;
return token;
}
@@ -37,7 +37,6 @@ export enum TestAccount {
Mongo = "Mongo",
Mongo32 = "Mongo32",
SQL = "SQL",
SQLReadOnly = "SQLReadOnly",
}
export const defaultAccounts: Record<TestAccount, string> = {
@@ -47,7 +46,6 @@ export const defaultAccounts: Record<TestAccount, string> = {
[TestAccount.Mongo]: "github-e2etests-mongo",
[TestAccount.Mongo32]: "github-e2etests-mongo32",
[TestAccount.SQL]: "github-e2etests-sql",
[TestAccount.SQLReadOnly]: "github-e2etests-sql-readonly",
};
export const resourceGroupName = process.env.DE_TEST_RESOURCE_GROUP ?? "de-e2e-tests";
@@ -216,25 +214,6 @@ export class QueryTab {
}
}
export class DocumentsTab {
documentsFilter: Locator;
documentsListPane: Locator;
documentResultsPane: Locator;
resultsEditor: Editor;
constructor(
public frame: Frame,
public tabId: string,
public tab: Locator,
public locator: Locator,
) {
this.documentsFilter = this.locator.getByTestId("DocumentsTab/Filter");
this.documentsListPane = this.locator.getByTestId("DocumentsTab/DocumentsPane");
this.documentResultsPane = this.locator.getByTestId("DocumentsTab/ResultsPane");
this.resultsEditor = new Editor(this.frame, this.documentResultsPane.getByTestId("EditorReact/Host/Loaded"));
}
}
type PanelOpenOptions = {
closeTimeout?: number;
};
@@ -253,12 +232,6 @@ export class DataExplorer {
return new QueryTab(this.frame, tabId, tab, queryTab);
}
documentsTab(tabId: string): DocumentsTab {
const tab = this.tab(tabId);
const documentsTab = tab.getByTestId("DocumentsTab");
return new DocumentsTab(this.frame, tabId, tab, documentsTab);
}
/** Select the primary global command button.
*
* There's only a single "primary" button, but we still require you to pass the label to confirm you're selecting the right button.
@@ -321,10 +294,6 @@ export class DataExplorer {
return await this.waitForNode(`${databaseId}/${containerId}`);
}
async waitForContainerItemsNode(databaseId: string, containerId: string): Promise<TreeNode> {
return await this.waitForNode(`${databaseId}/${containerId}/Items`);
}
/** Select the tree node with the specified id */
treeNode(id: string): TreeNode {
return new TreeNode(this.frame.getByTestId(`TreeNode:${id}`), this.frame, id);

View File

@@ -1,45 +0,0 @@
import { expect, test } from "@playwright/test";
import { DataExplorer, DocumentsTab, TestAccount } from "../fx";
import { documentTestCases } from "./testCases";
let explorer: DataExplorer = null!;
let documentsTab: DocumentsTab = null!;
for (const { name, databaseId, containerId, expectedDocumentIds } of documentTestCases) {
test.describe(`Test Documents with ${name}`, () => {
test.beforeEach("Open documents tab", async ({ page }) => {
explorer = await DataExplorer.open(page, TestAccount.SQLReadOnly);
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
await containerNode.expand();
const containerMenuNode = await explorer.waitForContainerItemsNode(databaseId, containerId);
await containerMenuNode.element.click();
documentsTab = explorer.documentsTab("tab0");
await documentsTab.documentsFilter.waitFor();
await documentsTab.documentsListPane.waitFor();
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
});
for (const docId of expectedDocumentIds) {
test.describe(`Document ID: ${docId}`, () => {
test(`should load and view document ${docId}`, async () => {
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 });
const resultText = await documentsTab.resultsEditor.text();
const resultData = JSON.parse(resultText!);
expect(resultText).not.toBeNull();
expect(resultData?.id).toEqual(docId);
});
});
}
});
}

View File

@@ -1,88 +0,0 @@
type ContainerTestCase = {
name: string;
databaseId: string;
containerId: string;
expectedDocumentIds: string[];
};
export const documentTestCases: ContainerTestCase[] = [
{
name: "System Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "systemPartitionKey",
expectedDocumentIds: ["systempartition"],
},
{
name: "Single Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "singlePartitionKey",
expectedDocumentIds: [
"singlePartitionKey",
"singlePartitionKey_empty_string",
"singlePartitionKey_null",
"singlePartitionKey_missing",
],
},
{
name: "Single Nested Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "singleNestedPartitionKey",
expectedDocumentIds: [
"singlePartitionKey_nested",
"singlePartitionKey_nested_empty_string",
"singlePartitionKey_nested_null",
"singlePartitionKey_nested_missing",
],
},
{
name: "2-Level Hierarchical Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "twoLevelPartitionKey",
expectedDocumentIds: [
"twoLevelPartitionKey_value_empty",
"twoLevelPartitionKey_value_null",
"twoLevelPartitionKey_value_missing",
"twoLevelPartitionKey_empty_null",
"twoLevelPartitionKey_null_missing",
"twoLevelPartitionKey_missing_value",
],
},
{
name: "2-Level Hierarchical Nested Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "twoLevelNestedPartitionKey",
expectedDocumentIds: [
"twoLevelNestedPartitionKey_nested_value_empty",
"twoLevelNestedPartitionKey_nested_null_missing",
"twoLevelNestedPartitionKey_nested_missing_value",
],
},
{
name: "3-Level Hierarchical Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "threeLevelPartitionKey",
expectedDocumentIds: [
"threeLevelPartitionKey_value_empty_null",
"threeLevelPartitionKey_value_null_missing",
"threeLevelPartitionKey_value_missing_null",
"threeLevelPartitionKey_null_empty_value",
"threeLevelPartitionKey_missing_value_value",
"threeLevelPartitionKey_empty_value_missing",
],
},
{
name: "3-Level Nested Hierarchical Partition Key",
databaseId: "e2etests-sql-readonly",
containerId: "threeLevelNestedPartitionKey",
expectedDocumentIds: [
"threeLevelNestedPartitionKey_nested_empty_value_null",
"threeLevelNestedPartitionKey_nested_null_value_missing",
"threeLevelNestedPartitionKey_nested_missing_value_null",
"threeLevelNestedPartitionKey_nested_null_empty_missing",
"threeLevelNestedPartitionKey_nested_value_missing_empty",
"threeLevelNestedPartitionKey_nested_missing_null_empty",
"threeLevelNestedPartitionKey_nested_empty_null_value",
"threeLevelNestedPartitionKey_nested_value_null_empty",
],
},
];