Added more test cases and fix system partition key load issue (#2126)

* Added more test cases and fix system partition key load issue

* Fix unit tests and fix ci

* Updated test snapsho
This commit is contained in:
sunghyunkang1111
2025-04-30 15:18:11 -05:00
committed by GitHub
parent fe73d0a1c6
commit bb66deb3a4
11 changed files with 136 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import { expect, test } from "@playwright/test";
import { setupCORSBypass } from "../CORSBypass";
import { DataExplorer, DocumentsTab, TestAccount } from "../fx";
import { retry, serializeMongoToJson, setPartitionKeys } from "../testData";
import { documentTestCases } from "./testCases";
@@ -9,8 +10,9 @@ 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.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);
@@ -25,6 +27,9 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
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;
@@ -68,8 +73,12 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
const saveButton = await explorer.waitForCommandBarButton("Save", 5000);
await saveButton.click({ timeout: 5000 });
await expect(saveButton).toBeHidden({ timeout: 5000 });
}, 3);
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();