Pk missing fix (#2094)

* fix partition key missing not being able to load the document

* Implement E2E tests for documents with different partitionkeys

* Implement E2E tests for documents with different partitionkeys

* Implement E2E tests for documents with different partitionkeys

* Updated snapshot
This commit is contained in:
sunghyunkang1111
2025-04-07 10:45:29 -05:00
committed by GitHub
parent e3c3a8b1b7
commit af0a890516
8 changed files with 259 additions and 21 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,6 +37,7 @@ export enum TestAccount {
Mongo = "Mongo",
Mongo32 = "Mongo32",
SQL = "SQL",
SQLReadOnly = "SQLReadOnly",
}
export const defaultAccounts: Record<TestAccount, string> = {
@@ -46,6 +47,7 @@ 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";
@@ -214,6 +216,25 @@ 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;
};
@@ -232,6 +253,12 @@ 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.
@@ -294,6 +321,10 @@ 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);