mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-24 12:14:17 +00:00
cleanup tests
This commit is contained in:
12
test/fx.ts
12
test/fx.ts
@@ -63,9 +63,6 @@ export const TEST_MANUAL_THROUGHPUT_RU_2K = 2000;
|
|||||||
export const ONE_MINUTE_MS: number = 60 * 1000;
|
export const ONE_MINUTE_MS: number = 60 * 1000;
|
||||||
|
|
||||||
function tryGetStandardName(accountType: TestAccount) {
|
function tryGetStandardName(accountType: TestAccount) {
|
||||||
// if (accountType === TestAccount.MongoReadonly) {
|
|
||||||
// return "aisayas-e2e-mongo-readonly";
|
|
||||||
// }
|
|
||||||
if (process.env.DE_TEST_ACCOUNT_PREFIX) {
|
if (process.env.DE_TEST_ACCOUNT_PREFIX) {
|
||||||
const actualPrefix = process.env.DE_TEST_ACCOUNT_PREFIX.endsWith("-")
|
const actualPrefix = process.env.DE_TEST_ACCOUNT_PREFIX.endsWith("-")
|
||||||
? process.env.DE_TEST_ACCOUNT_PREFIX
|
? process.env.DE_TEST_ACCOUNT_PREFIX
|
||||||
@@ -520,15 +517,6 @@ export class DataExplorer {
|
|||||||
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
||||||
await containerNode.expand();
|
await containerNode.expand();
|
||||||
|
|
||||||
// // refresh tree to remove deleted database
|
|
||||||
// const consoleMessages = await this.getNotificationConsoleMessages();
|
|
||||||
// const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
|
|
||||||
// await refreshButton.click();
|
|
||||||
// await expect(consoleMessages).toContainText("Successfully refreshed databases", {
|
|
||||||
// timeout: ONE_MINUTE_MS,
|
|
||||||
// });
|
|
||||||
// await this.collapseNotificationConsole();
|
|
||||||
|
|
||||||
const scaleAndSettingsButton = this.frame.getByTestId(
|
const scaleAndSettingsButton = this.frame.getByTestId(
|
||||||
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
|||||||
await documentsTab.documentsFilter.waitFor();
|
await documentsTab.documentsFilter.waitFor();
|
||||||
await documentsTab.documentsListPane.waitFor();
|
await documentsTab.documentsListPane.waitFor();
|
||||||
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
||||||
|
|
||||||
await explorer.expandNotificationConsole();
|
|
||||||
});
|
});
|
||||||
test.afterEach(async ({ page }) => {
|
test.afterEach(async ({ page }) => {
|
||||||
await page.unrouteAll({ behavior: "ignoreErrors" });
|
await page.unrouteAll({ behavior: "ignoreErrors" });
|
||||||
@@ -56,40 +54,28 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
|
|||||||
await expect(span).toBeVisible();
|
await expect(span).toBeVisible();
|
||||||
|
|
||||||
await span.click();
|
await span.click();
|
||||||
// await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
|
||||||
await page.waitForTimeout(5000); // wait for 5 seconds to ensure document is fully loaded. waitforTimeout is not recommended generally but here we are working around flakiness in the test env
|
await page.waitForTimeout(5000); // wait for 5 seconds to ensure document is fully loaded. waitforTimeout is not recommended generally but here we are working around flakiness in the test env
|
||||||
|
|
||||||
let newDocumentId;
|
let newDocumentId;
|
||||||
let retryCount = 0;
|
|
||||||
await retry(async () => {
|
await retry(async () => {
|
||||||
try {
|
const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewDocument, 5000);
|
||||||
const newDocumentButton = await explorer.waitForCommandBarButton(CommandBarButton.NewDocument, 5000);
|
await expect(newDocumentButton).toBeVisible();
|
||||||
await expect(newDocumentButton).toBeVisible();
|
await expect(newDocumentButton).toBeEnabled();
|
||||||
await expect(newDocumentButton).toBeEnabled();
|
await newDocumentButton.click();
|
||||||
await newDocumentButton.click();
|
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
||||||
console.log(`DEBUG: Clicked New Document button - retryCount=${retryCount}`);
|
|
||||||
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
|
|
||||||
|
|
||||||
newDocumentId = `${Date.now().toString()}-delete`;
|
newDocumentId = `${Date.now().toString()}-delete`;
|
||||||
|
|
||||||
const newDocument = {
|
const newDocument = {
|
||||||
_id: newDocumentId,
|
_id: newDocumentId,
|
||||||
...setPartitionKeys(partitionKeys || []),
|
...setPartitionKeys(partitionKeys || []),
|
||||||
};
|
};
|
||||||
|
|
||||||
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
await documentsTab.resultsEditor.setText(JSON.stringify(newDocument));
|
||||||
const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000);
|
const saveButton = await explorer.waitForCommandBarButton(CommandBarButton.Save, 5000);
|
||||||
await saveButton.click({ timeout: 5000 });
|
await saveButton.click({ timeout: 5000 });
|
||||||
console.log(`DEBUG: Clicked Save button - retryCount=${retryCount}`);
|
|
||||||
|
|
||||||
await expect(saveButton).toBeHidden({ timeout: 5000 });
|
await expect(saveButton).toBeHidden({ timeout: 5000 });
|
||||||
} catch (err) {
|
|
||||||
retryCount++;
|
|
||||||
console.warn(
|
|
||||||
`DEBUG: Attempt ${retryCount} to create new document from ${docId} failed: ${(err as Error).message}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}, 3);
|
}, 3);
|
||||||
|
|
||||||
await documentsTab.setFilter(`{_id: "${newDocumentId}"}`);
|
await documentsTab.setFilter(`{_id: "${newDocumentId}"}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user