mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-05-10 18:33:52 +01:00
Show system partition key value and add test cases
This commit is contained in:
parent
e90e1fc581
commit
68c42fb361
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -164,8 +164,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
||||||
shardTotal: [8]
|
shardTotal: [12]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: "Az CLI login"
|
- name: "Az CLI login"
|
||||||
|
@ -193,6 +193,7 @@ export const InputDataList: FC<InputDataListProps> = ({
|
|||||||
<>
|
<>
|
||||||
<Input
|
<Input
|
||||||
id="filterInput"
|
id="filterInput"
|
||||||
|
data-test={"DocumentsTab/FilterInput"}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -773,8 +773,11 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
[_collection, _partitionKey],
|
[_collection, _partitionKey],
|
||||||
);
|
);
|
||||||
const partitionKeyPropertyHeaders: string[] = useMemo(
|
const partitionKeyPropertyHeaders: string[] = useMemo(
|
||||||
() => (partitionKey?.systemKey ? [] : _collection?.partitionKeyPropertyHeaders || partitionKey?.paths),
|
() =>
|
||||||
[_collection?.partitionKeyPropertyHeaders, partitionKey?.paths, partitionKey?.systemKey],
|
isPreferredApiMongoDB && partitionKey?.systemKey
|
||||||
|
? []
|
||||||
|
: _collection?.partitionKeyPropertyHeaders || partitionKey?.paths,
|
||||||
|
[_collection?.partitionKeyPropertyHeaders, partitionKey?.paths, partitionKey?.systemKey, isPreferredApiMongoDB],
|
||||||
);
|
);
|
||||||
let partitionKeyProperties = useMemo(() => {
|
let partitionKeyProperties = useMemo(() => {
|
||||||
return partitionKeyPropertyHeaders?.map((partitionKeyPropertyHeader) =>
|
return partitionKeyPropertyHeaders?.map((partitionKeyPropertyHeader) =>
|
||||||
@ -2116,6 +2119,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
appearance="primary"
|
appearance="primary"
|
||||||
|
data-test={"DocumentsTab/ApplyFilter"}
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isExecuting) {
|
if (isExecuting) {
|
||||||
@ -2188,6 +2192,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
{tableItems.length > 0 && (
|
{tableItems.length > 0 && (
|
||||||
<a
|
<a
|
||||||
className={styles.loadMore}
|
className={styles.loadMore}
|
||||||
|
data-test={"DocumentsTab/LoadMore"}
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() => loadNextPage(documentsIterator.iterator, false)}
|
onClick={() => loadNextPage(documentsIterator.iterator, false)}
|
||||||
|
10
test/fx.ts
10
test/fx.ts
@ -223,6 +223,9 @@ export class DocumentsTab {
|
|||||||
documentsListPane: Locator;
|
documentsListPane: Locator;
|
||||||
documentResultsPane: Locator;
|
documentResultsPane: Locator;
|
||||||
resultsEditor: Editor;
|
resultsEditor: Editor;
|
||||||
|
loadMoreButton: Locator;
|
||||||
|
filterInput: Locator;
|
||||||
|
filterButton: Locator;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public frame: Frame,
|
public frame: Frame,
|
||||||
@ -234,6 +237,13 @@ export class DocumentsTab {
|
|||||||
this.documentsListPane = this.locator.getByTestId("DocumentsTab/DocumentsPane");
|
this.documentsListPane = this.locator.getByTestId("DocumentsTab/DocumentsPane");
|
||||||
this.documentResultsPane = this.locator.getByTestId("DocumentsTab/ResultsPane");
|
this.documentResultsPane = this.locator.getByTestId("DocumentsTab/ResultsPane");
|
||||||
this.resultsEditor = new Editor(this.frame, this.documentResultsPane.getByTestId("EditorReact/Host/Loaded"));
|
this.resultsEditor = new Editor(this.frame, this.documentResultsPane.getByTestId("EditorReact/Host/Loaded"));
|
||||||
|
this.loadMoreButton = this.documentsListPane.getByTestId("DocumentsTab/LoadMore");
|
||||||
|
this.filterInput = this.documentsFilter.getByTestId("DocumentsTab/FilterInput");
|
||||||
|
this.filterButton = this.documentsFilter.getByTestId("DocumentsTab/ApplyFilter");
|
||||||
|
}
|
||||||
|
|
||||||
|
async setFilter(text: string) {
|
||||||
|
await this.filterInput.fill(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,12 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
|||||||
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
||||||
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
|
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
|
||||||
await saveButton.click({ timeout: 5000 });
|
await saveButton.click({ timeout: 5000 });
|
||||||
|
await expect(saveButton).toBeHidden({ timeout: 5000 });
|
||||||
}, 3);
|
}, 3);
|
||||||
|
|
||||||
|
await documentsTab.setFilter(`{_id: "${newDocumentId}"}`);
|
||||||
|
await documentsTab.filterButton.click();
|
||||||
|
|
||||||
const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
|
const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
|
||||||
await newSpan.waitFor();
|
await newSpan.waitFor();
|
||||||
await newSpan.click();
|
await newSpan.click();
|
||||||
|
@ -51,10 +51,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
|||||||
let newDocumentId;
|
let newDocumentId;
|
||||||
await page.waitForTimeout(5000);
|
await page.waitForTimeout(5000);
|
||||||
await retry(async () => {
|
await retry(async () => {
|
||||||
// const discardButton = await explorer.waitForCommandBarButton("Discard", 5000);
|
|
||||||
// if (await discardButton.isEnabled()) {
|
|
||||||
// await discardButton.click();
|
|
||||||
// }
|
|
||||||
const newDocumentButton = await explorer.waitForCommandBarButton("New Item", 5000);
|
const newDocumentButton = await explorer.waitForCommandBarButton("New Item", 5000);
|
||||||
await expect(newDocumentButton).toBeVisible();
|
await expect(newDocumentButton).toBeVisible();
|
||||||
await expect(newDocumentButton).toBeEnabled();
|
await expect(newDocumentButton).toBeEnabled();
|
||||||
@ -72,10 +68,15 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
|||||||
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
||||||
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
|
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
|
||||||
await saveButton.click({ timeout: 5000 });
|
await saveButton.click({ timeout: 5000 });
|
||||||
|
await expect(saveButton).toBeHidden({ timeout: 5000 });
|
||||||
}, 3);
|
}, 3);
|
||||||
|
|
||||||
|
await documentsTab.setFilter(`WHERE c.id = "${newDocumentId}"`);
|
||||||
|
await documentsTab.filterButton.click();
|
||||||
|
|
||||||
const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
|
const newSpan = documentsTab.documentsListPane.getByText(newDocumentId, { exact: true }).nth(0);
|
||||||
await newSpan.waitFor();
|
await newSpan.waitFor();
|
||||||
|
|
||||||
await newSpan.click();
|
await newSpan.click();
|
||||||
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
||||||
|
|
||||||
|
@ -5,7 +5,24 @@ export const documentTestCases: DocumentTestCase[] = [
|
|||||||
name: "System Partition Key",
|
name: "System Partition Key",
|
||||||
databaseId: "e2etests-sql-readonly",
|
databaseId: "e2etests-sql-readonly",
|
||||||
containerId: "systemPartitionKey",
|
containerId: "systemPartitionKey",
|
||||||
documents: [{ documentId: "systempartition", partitionKeys: [] }],
|
documents: [
|
||||||
|
{
|
||||||
|
documentId: "systempartition",
|
||||||
|
partitionKeys: [{ key: "/_partitionKey", value: "partitionKey" }],
|
||||||
|
skipCreateDelete: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
documentId: "systempartition_empty",
|
||||||
|
partitionKeys: [{ key: "/_partitionKey", value: "" }],
|
||||||
|
skipCreateDelete: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
documentId: "systempartition_null",
|
||||||
|
partitionKeys: [{ key: "/_partitionKey", value: null }],
|
||||||
|
skipCreateDelete: true,
|
||||||
|
},
|
||||||
|
{ documentId: "systempartition_missing", partitionKeys: [] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Single Partition Key",
|
name: "Single Partition Key",
|
||||||
|
@ -26,6 +26,7 @@ export interface DocumentTestCase {
|
|||||||
export interface TestDocument {
|
export interface TestDocument {
|
||||||
documentId: string;
|
documentId: string;
|
||||||
partitionKeys?: PartitionKey[];
|
partitionKeys?: PartitionKey[];
|
||||||
|
skipCreateDelete?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PartitionKey {
|
export interface PartitionKey {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user