Compare commits

...

25 Commits

Author SHA1 Message Date
Asier Isayas
9cc9ef7331 fix test and update node version 2026-01-26 07:40:27 -08:00
Asier Isayas
4b849e92b3 Merge branch 'users/aisayas/delete-after-each-test' of https://github.com/Azure/cosmos-explorer into users/aisayas/dependabot-1 2026-01-26 07:23:39 -08:00
Asier Isayas
45327dbfb2 Merge branch 'master' of https://github.com/Azure/cosmos-explorer into users/aisayas/dependabot-1 2026-01-26 07:23:07 -08:00
Asier Isayas
237e45f1b3 dependabot round 1 2026-01-26 07:22:58 -08:00
Asier Isayas
3552cd3e9d change cleanup frequency to once a day 2026-01-26 06:36:47 -08:00
Asier Isayas
27d85a450b run test account cleanup every 12 hours 2026-01-23 14:20:50 -08:00
Asier Isayas
3acaf560fd uncomment container copy tests 2026-01-23 13:53:12 -08:00
Asier Isayas
0fbf8b6a2f cleanup tests 2026-01-23 13:52:18 -08:00
Asier Isayas
ea7f2d513f do forced wait instead 2026-01-23 13:37:53 -08:00
Asier Isayas
7eecfa28c5 wait for results to attach 2026-01-23 13:25:35 -08:00
Asier Isayas
19ffb5696d remove debug statement 2026-01-23 12:37:45 -08:00
Asier Isayas
b3501e7dc8 wait for document to be loaded 2026-01-23 09:34:02 -08:00
Asier Isayas
574769ba89 when loading a document, wait for document text to appear then click new document 2026-01-23 09:13:14 -08:00
Asier Isayas
a5e7b53783 Merge branch 'master' of https://github.com/Azure/cosmos-explorer into users/aisayas/delete-after-each-test 2026-01-23 08:25:59 -08:00
Asier Isayas
8027e5899d debug new document and save document count 2026-01-23 08:20:01 -08:00
Asier Isayas
c5da4eb25b keep document spec as original 2026-01-23 07:46:01 -08:00
Asier Isayas
fd9cb0026c verify document text was set 2026-01-22 14:28:54 -08:00
Asier Isayas
4a5ed80c6c increase wait time to 5s 2026-01-22 13:54:10 -08:00
Asier Isayas
544ac890c6 DEBUG: wait for editor to process changes 2026-01-22 13:34:17 -08:00
Asier Isayas
094fd4d6f4 find first execute button for stored procedure 2026-01-22 12:33:17 -08:00
Asier Isayas
7665f60fdd DEBUG: expand console for mongo testing 2026-01-22 12:32:58 -08:00
Asier Isayas
561eb6d1fa delete db after each test 2026-01-22 08:30:15 -08:00
Asier Isayas
d24400198d Merge branch 'master' of https://github.com/Azure/cosmos-explorer into users/aisayas/delete-after-each-test 2026-01-22 08:26:59 -08:00
Asier Isayas
d32ccfef13 disable offline/online migration tests 2026-01-21 09:13:46 -08:00
Asier Isayas
3f01ce5ff0 dont refresh tree when opening scale & settings 2026-01-21 08:06:18 -08:00
20 changed files with 1017 additions and 4093 deletions

View File

@@ -18,10 +18,10 @@ jobs:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: node utils/codeMetrics.js - run: node utils/codeMetrics.js
env: env:
@@ -31,10 +31,10 @@ jobs:
name: "Compile TypeScript" name: "Compile TypeScript"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npm run compile - run: npm run compile
- run: npm run compile:strict - run: npm run compile:strict
@@ -43,10 +43,10 @@ jobs:
name: "Check Format" name: "Check Format"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npm run format:check - run: npm run format:check
lint: lint:
@@ -54,10 +54,10 @@ jobs:
name: "Lint" name: "Lint"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npm run lint - run: npm run lint
unittest: unittest:
@@ -65,10 +65,10 @@ jobs:
name: "Unit Tests" name: "Unit Tests"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npm run test - run: npm run test
build: build:
@@ -76,10 +76,10 @@ jobs:
name: "Build" name: "Build"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npm run build:contracts - run: npm run build:contracts
- name: Restore Build Cache - name: Restore Build Cache
@@ -168,10 +168,10 @@ jobs:
shardTotal: [20] shardTotal: [20]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: npx playwright install --with-deps - run: npx playwright install --with-deps
- name: "Az CLI login" - name: "Az CLI login"
@@ -236,7 +236,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 24.13.0
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

View File

@@ -6,8 +6,8 @@ on:
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
schedule: schedule:
# Once every two hours # Once every day at 7 AM PST
- cron: "0 */2 * * *" - cron: "0 13 * * *"
permissions: permissions:
id-token: write id-token: write
@@ -22,7 +22,7 @@ jobs:
env: env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: "Az CLI login" - name: "Az CLI login"
uses: azure/login@v1 uses: azure/login@v1
@@ -31,9 +31,9 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Use Node.js 18.x - name: Use Node.js 24.13.0
uses: actions/setup-node@v1 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 24.13.0
- run: npm ci - run: npm ci
- run: node utils/cleanupDBs.js - run: node utils/cleanupDBs.js

4784
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "Cosmos Explorer", "description": "Cosmos Explorer",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@azure/arm-cosmosdb": "9.1.0", "@azure/arm-cosmosdb": "16.4.0",
"@azure/cosmos": "4.7.0", "@azure/cosmos": "4.7.0",
"@azure/cosmos-language-service": "0.0.5", "@azure/cosmos-language-service": "0.0.5",
"@azure/identity": "4.5.0", "@azure/identity": "4.5.0",
@@ -19,7 +19,7 @@
"@nteract/commutable": "7.5.1", "@nteract/commutable": "7.5.1",
"@nteract/connected-components": "6.8.2", "@nteract/connected-components": "6.8.2",
"@nteract/core": "15.1.9", "@nteract/core": "15.1.9",
"@nteract/data-explorer": "8.0.3", "@nteract/data-explorer": "8.2.12",
"@nteract/directory-listing": "2.0.6", "@nteract/directory-listing": "2.0.6",
"@nteract/dropdown-menu": "1.0.1", "@nteract/dropdown-menu": "1.0.1",
"@nteract/editor": "10.1.12", "@nteract/editor": "10.1.12",
@@ -44,14 +44,14 @@
"@testing-library/jest-dom": "6.4.6", "@testing-library/jest-dom": "6.4.6",
"@types/lodash": "4.14.171", "@types/lodash": "4.14.171",
"@types/mkdirp": "1.0.1", "@types/mkdirp": "1.0.1",
"@types/node-fetch": "2.5.7", "@types/node-fetch": "2.6.13",
"@xmldom/xmldom": "0.7.13", "@xmldom/xmldom": "0.7.13",
"@xterm/addon-fit": "0.10.0", "@xterm/addon-fit": "0.10.0",
"@xterm/xterm": "5.5.0", "@xterm/xterm": "5.5.0",
"allotment": "1.20.2", "allotment": "1.20.2",
"applicationinsights": "1.8.0", "applicationinsights": "1.8.0",
"bootstrap": "3.4.1", "bootstrap": "3.4.1",
"canvas": "2.11.2", "canvas": "3.2.1",
"clean-webpack-plugin": "4.0.0", "clean-webpack-plugin": "4.0.0",
"clipboard-copy": "4.0.1", "clipboard-copy": "4.0.1",
"copy-webpack-plugin": "11.0.0", "copy-webpack-plugin": "11.0.0",
@@ -79,7 +79,7 @@
"jquery-typeahead": "2.11.1", "jquery-typeahead": "2.11.1",
"jquery-ui-dist": "1.13.2", "jquery-ui-dist": "1.13.2",
"knockout": "3.5.1", "knockout": "3.5.1",
"loader-utils": "2.0.3", "loader-utils": "2.0.4",
"mkdirp": "1.0.4", "mkdirp": "1.0.4",
"monaco-editor": "0.44.0", "monaco-editor": "0.44.0",
"ms": "2.1.3", "ms": "2.1.3",
@@ -111,8 +111,8 @@
"tinykeys": "2.1.0", "tinykeys": "2.1.0",
"underscore": "1.12.1", "underscore": "1.12.1",
"utility-types": "3.10.0", "utility-types": "3.10.0",
"web-vitals": "4.2.4",
"uuid": "9.0.0", "uuid": "9.0.0",
"web-vitals": "4.2.4",
"zustand": "3.5.0" "zustand": "3.5.0"
}, },
"devDependencies": { "devDependencies": {
@@ -177,12 +177,12 @@
"jest-html-loader": "1.0.0", "jest-html-loader": "1.0.0",
"jest-react-hooks-shallow": "1.5.1", "jest-react-hooks-shallow": "1.5.1",
"jest-trx-results-processor": "3.0.2", "jest-trx-results-processor": "3.0.2",
"less": "3.8.1", "less": "4.5.1",
"less-loader": "11.1.3", "less-loader": "11.1.3",
"less-vars-loader": "1.1.0", "less-vars-loader": "1.1.0",
"mini-css-extract-plugin": "2.1.0", "mini-css-extract-plugin": "2.1.0",
"monaco-editor-webpack-plugin": "7.1.0", "monaco-editor-webpack-plugin": "7.1.0",
"node-fetch": "2.6.7", "node-fetch": "3.3.2",
"prettier": "3.0.3", "prettier": "3.0.3",
"process": "0.11.10", "process": "0.11.10",
"querystring-es3": "0.2.1", "querystring-es3": "0.2.1",
@@ -195,7 +195,7 @@
"typedoc": "0.26.2", "typedoc": "0.26.2",
"typescript": "4.9.5", "typescript": "4.9.5",
"url-loader": "4.1.1", "url-loader": "4.1.1",
"wait-on": "4.0.2", "wait-on": "9.0.3",
"webpack": "5.88.2", "webpack": "5.88.2",
"webpack-bundle-analyzer": "4.9.1", "webpack-bundle-analyzer": "4.9.1",
"webpack-cli": "5.1.4", "webpack-cli": "5.1.4",

View File

@@ -1,7 +1,7 @@
import { armRequest } from "./request"; import fetch, { Headers } from "node-fetch";
import fetch from "node-fetch";
import { updateUserContext } from "../../UserContext";
import { AuthType } from "../../AuthType"; import { AuthType } from "../../AuthType";
import { updateUserContext } from "../../UserContext";
import { armRequest } from "./request";
interface Global { interface Global {
Headers: unknown; Headers: unknown;

View File

@@ -378,9 +378,11 @@ type PanelOpenOptions = {
export enum CommandBarButton { export enum CommandBarButton {
Save = "Save", Save = "Save",
Delete = "Delete",
Execute = "Execute", Execute = "Execute",
ExecuteQuery = "Execute Query", ExecuteQuery = "Execute Query",
UploadItem = "Upload Item", UploadItem = "Upload Item",
NewDocument = "New Document",
} }
/** Helper class that provides locator methods for DataExplorer components, on top of a Frame */ /** Helper class that provides locator methods for DataExplorer components, on top of a Frame */
@@ -478,7 +480,7 @@ export class DataExplorer {
return await this.waitForNode(`${databaseId}/${containerId}/Documents`); return await this.waitForNode(`${databaseId}/${containerId}/Documents`);
} }
async waitForCommandBarButton(label: string, timeout?: number): Promise<Locator> { async waitForCommandBarButton(label: CommandBarButton, timeout?: number): Promise<Locator> {
const commandBar = this.commandBarButton(label); const commandBar = this.commandBarButton(label);
await commandBar.waitFor({ state: "visible", timeout }); await commandBar.waitFor({ state: "visible", timeout });
return commandBar; return commandBar;
@@ -515,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`,
); );

View File

@@ -1,7 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { setupCORSBypass } from "../CORSBypass"; import { setupCORSBypass } from "../CORSBypass";
import { DataExplorer, DocumentsTab, TestAccount } from "../fx"; import { CommandBarButton, DataExplorer, DocumentsTab, TestAccount } from "../fx";
import { retry, serializeMongoToJson, setPartitionKeys } from "../testData"; import { retry, serializeMongoToJson, setPartitionKeys } from "../testData";
import { documentTestCases } from "./testCases"; import { documentTestCases } from "./testCases";
@@ -48,19 +48,20 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
expect(resultData?._id).not.toBeNull(); expect(resultData?._id).not.toBeNull();
expect(resultData?._id).toEqual(docId); expect(resultData?._id).toEqual(docId);
}); });
test(`should be able to create and delete new document from ${docId}`, async () => { test(`should be able to create and delete new document from ${docId}`, async ({ page }) => {
const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0); const span = documentsTab.documentsListPane.getByText(docId, { exact: true }).nth(0);
await span.waitFor(); await span.waitFor();
await expect(span).toBeVisible(); await expect(span).toBeVisible();
await span.click(); await span.click();
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;
await retry(async () => { await retry(async () => {
const newDocumentButton = await explorer.waitForCommandBarButton("New Document", 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 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
newDocumentId = `${Date.now().toString()}-delete`; newDocumentId = `${Date.now().toString()}-delete`;
@@ -71,8 +72,9 @@ 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(CommandBarButton.Save, 5000);
await saveButton.click({ timeout: 5000 }); await saveButton.click({ timeout: 5000 });
await expect(saveButton).toBeHidden({ timeout: 5000 }); await expect(saveButton).toBeHidden({ timeout: 5000 });
}, 3); }, 3);
@@ -84,7 +86,7 @@ for (const { name, databaseId, containerId, documents } of documentTestCases) {
await newSpan.click(); await newSpan.click();
await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 }); await expect(documentsTab.resultsEditor.locator).toBeAttached({ timeout: 60 * 1000 });
const deleteButton = await explorer.waitForCommandBarButton("Delete", 5000); const deleteButton = await explorer.waitForCommandBarButton(CommandBarButton.Delete, 5000);
await deleteButton.click(); await deleteButton.click();
const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000); const deleteDialogButton = await explorer.waitForDialogButton("Delete", 5000);

View File

@@ -136,9 +136,7 @@ test.describe.serial("Upload Item", () => {
if (existsSync(uploadDocumentDirPath)) { if (existsSync(uploadDocumentDirPath)) {
rmdirSync(uploadDocumentDirPath); rmdirSync(uploadDocumentDirPath);
} }
if (!process.env.CI) { await context?.dispose();
await context?.dispose();
}
}); });
test.afterEach("Close Upload Items panel if still open", async () => { test.afterEach("Close Upload Items panel if still open", async () => {

View File

@@ -30,12 +30,9 @@ test.beforeEach("Open new query tab", async ({ page }) => {
await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor(); await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
}); });
// Delete database only if not running in CI test.afterAll("Delete Test Database", async () => {
if (!process.env.CI) { await context?.dispose();
test.afterAll("Delete Test Database", async () => { });
await context?.dispose();
});
}
test("Query results", async () => { test("Query results", async () => {
// Run the query and verify the results // Run the query and verify the results

View File

@@ -2,7 +2,6 @@ import { expect, test } from "@playwright/test";
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb"; import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
import { CosmosClient, PermissionMode } from "@azure/cosmos"; import { CosmosClient, PermissionMode } from "@azure/cosmos";
import { AzureIdentityCredentialAdapter } from "@azure/ms-rest-js";
import { import {
DataExplorer, DataExplorer,
TestAccount, TestAccount,
@@ -18,8 +17,7 @@ test("SQL account using Resource token", async ({ page }) => {
test.skip(nosqlAccountRbacToken.length > 0, "Resource tokens not supported when using data plane RBAC."); test.skip(nosqlAccountRbacToken.length > 0, "Resource tokens not supported when using data plane RBAC.");
const credentials = getAzureCLICredentials(); const credentials = getAzureCLICredentials();
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials); const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
const accountName = getAccountName(TestAccount.SQL); const accountName = getAccountName(TestAccount.SQL);
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName); const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName); const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, accountName);

View File

@@ -23,12 +23,9 @@ test.describe("Change Partition Key", () => {
await PartitionKeyTab.click(); await PartitionKeyTab.click();
}); });
// Delete database only if not running in CI test.afterEach("Delete Test Database", async () => {
if (!process.env.CI) { await context?.dispose();
test.afterEach("Delete Test Database", async () => { });
await context?.dispose();
});
}
test("Change partition key path", async ({ page }) => { test("Change partition key path", async ({ page }) => {
await expect(explorer.frame.getByText("/partitionKey")).toBeVisible(); await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();

View File

@@ -118,7 +118,5 @@ async function openScaleTab(browser: Browser): Promise<SetupResult> {
} }
async function cleanup({ context }: Partial<SetupResult>) { async function cleanup({ context }: Partial<SetupResult>) {
if (!process.env.CI) { await context?.dispose();
await context?.dispose();
}
} }

View File

@@ -17,12 +17,9 @@ test.describe("Settings under Scale & Settings", () => {
await settingsTab.click(); await settingsTab.click();
}); });
// Delete database only if not running in CI test.afterAll("Delete Test Database", async () => {
if (!process.env.CI) { await context?.dispose();
test.afterAll("Delete Test Database", async () => { });
await context?.dispose();
});
}
test("Update TTL to On (no default)", async () => { test("Update TTL to On (no default)", async () => {
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" }); const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });

View File

@@ -43,7 +43,7 @@ test.describe("Stored Procedures", () => {
); );
// Execute stored procedure // Execute stored procedure
const executeButton = explorer.commandBarButton(CommandBarButton.Execute); const executeButton = explorer.commandBarButton(CommandBarButton.Execute).first();
await executeButton.click(); await executeButton.click();
const executeSidePanelButton = explorer.frame.getByTestId("Panel/OkButton"); const executeSidePanelButton = explorer.frame.getByTestId("Panel/OkButton");
await executeSidePanelButton.click(); await executeSidePanelButton.click();

View File

@@ -26,11 +26,9 @@ test.describe("Triggers", () => {
explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
}); });
if (!process.env.CI) { test.afterAll("Delete Test Database", async () => {
test.afterAll("Delete Test Database", async () => { await context?.dispose();
await context?.dispose(); });
});
}
test("Add and delete trigger", async ({ page }, testInfo) => { test("Add and delete trigger", async ({ page }, testInfo) => {
// Open container context menu and click New Trigger // Open container context menu and click New Trigger

View File

@@ -19,11 +19,9 @@ test.describe("User Defined Functions", () => {
explorer = await DataExplorer.open(page, TestAccount.SQL); explorer = await DataExplorer.open(page, TestAccount.SQL);
}); });
if (!process.env.CI) { test.afterAll("Delete Test Database", async () => {
test.afterAll("Delete Test Database", async () => { await context?.dispose();
await context?.dispose(); });
});
}
test("Add, execute, and delete user defined function", async ({ page }, testInfo) => { test("Add, execute, and delete user defined function", async ({ page }, testInfo) => {
// Open container context menu and click New UDF // Open container context menu and click New UDF

View File

@@ -2,7 +2,6 @@ import crypto from "crypto";
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb"; import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
import { BulkOperationType, Container, CosmosClient, CosmosClientOptions, Database, JSONObject } from "@azure/cosmos"; import { BulkOperationType, Container, CosmosClient, CosmosClientOptions, Database, JSONObject } from "@azure/cosmos";
import { AzureIdentityCredentialAdapter } from "@azure/ms-rest-js";
import { import {
generateUniqueName, generateUniqueName,
@@ -37,6 +36,10 @@ export interface PartitionKey {
value: string | null; value: string | null;
} }
export interface PartitionKeyResult {
[key: string]: unknown;
}
export const partitionCount = 4; export const partitionCount = 4;
// If we increase this number, we need to split bulk creates into multiple batches. // If we increase this number, we need to split bulk creates into multiple batches.
@@ -105,8 +108,7 @@ export async function createMultipleTestContainers({
const databaseId = databaseName ? databaseName : generateUniqueName("db"); const databaseId = databaseName ? databaseName : generateUniqueName("db");
const credentials = getAzureCLICredentials(); const credentials = getAzureCLICredentials();
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials); const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
const accountName = getAccountName(accountType); const accountName = getAccountName(accountType);
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName); const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
@@ -159,8 +161,7 @@ export async function createTestSQLContainer({
const databaseId = databaseName ? databaseName : generateUniqueName("db"); const databaseId = databaseName ? databaseName : generateUniqueName("db");
const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique
const credentials = getAzureCLICredentials(); const credentials = getAzureCLICredentials();
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials); const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
const accountName = getAccountName(TestAccount.SQL); const accountName = getAccountName(TestAccount.SQL);
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName); const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
@@ -211,20 +212,20 @@ export async function createTestSQLContainer({
} }
export const setPartitionKeys = (partitionKeys: PartitionKey[]) => { export const setPartitionKeys = (partitionKeys: PartitionKey[]) => {
const result = {}; const result: PartitionKeyResult = {};
partitionKeys.forEach((partitionKey) => { partitionKeys.forEach((partitionKey) => {
const { key: keyPath, value: keyValue } = partitionKey; const { key: keyPath, value: keyValue } = partitionKey;
const cleanPath = keyPath.startsWith("/") ? keyPath.slice(1) : keyPath; const cleanPath = keyPath.startsWith("/") ? keyPath.slice(1) : keyPath;
const keys = cleanPath.split("/"); const keys = cleanPath.split("/");
let current = result; let current: PartitionKeyResult = result;
keys.forEach((key, index) => { keys.forEach((key, index) => {
if (index === keys.length - 1) { if (index === keys.length - 1) {
current[key] = keyValue; current[key] = keyValue;
} else { } else {
current[key] = current[key] || {}; current[key] = current[key] || {};
current = current[key]; current = current[key] as PartitionKeyResult;
} }
}); });
}); });

View File

@@ -161,7 +161,8 @@ const propertyToType = (property: Property, prop: string, required: boolean) =>
async function main() { async function main() {
const response = await fetch(schemaURL); const response = await fetch(schemaURL);
const schema = await response.json(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
const schema: any = await response.json();
// STEP 1: Convert all definitions to TypeScript types and interfaces // STEP 1: Convert all definitions to TypeScript types and interfaces
for (const definition in schema.definitions) { for (const definition in schema.definitions) {

View File

@@ -1,66 +1,180 @@
{ {
"name": "deployment-status", "name": "deployment-status",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 1, "lockfileVersion": 3,
"requires": true, "requires": true,
"dependencies": { "packages": {
"@types/color-name": { "": {
"name": "deployment-status",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"chalk": "^4.1.0",
"moment": "^2.27.0",
"node-fetch": "^3.3.2"
}
},
"node_modules/@types/color-name": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
}, },
"ansi-styles": { "node_modules/ansi-styles": {
"version": "4.2.1", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"requires": { "dependencies": {
"@types/color-name": "^1.1.1", "@types/color-name": "^1.1.1",
"color-convert": "^2.0.1" "color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"chalk": { "node_modules/chalk": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"requires": { "dependencies": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
"supports-color": "^7.1.0" "supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
} }
}, },
"color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": { "dependencies": {
"color-name": "~1.1.4" "color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
} }
}, },
"color-name": { "node_modules/color-name": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"has-flag": { "node_modules/data-uri-to-buffer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
"engines": {
"node": ">= 12"
}
},
"node_modules/fetch-blob": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "paypal",
"url": "https://paypal.me/jimmywarting"
}
],
"dependencies": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
},
"engines": {
"node": "^12.20 || >= 14.13"
}
},
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"dependencies": {
"fetch-blob": "^3.1.2"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"engines": {
"node": ">=8"
}
}, },
"moment": { "node_modules/moment": {
"version": "2.27.0", "version": "2.27.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz",
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==",
"engines": {
"node": "*"
}
}, },
"node-fetch": { "node_modules/node-domexception": {
"version": "2.6.1", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"deprecated": "Use your platform's native DOMException instead",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "github",
"url": "https://paypal.me/jimmywarting"
}
],
"engines": {
"node": ">=10.5.0"
}
}, },
"supports-color": { "node_modules/node-fetch": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/supports-color": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"requires": { "dependencies": {
"has-flag": "^4.0.0" "has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/web-streams-polyfill": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
"engines": {
"node": ">= 8"
} }
} }
} }

View File

@@ -12,6 +12,6 @@
"dependencies": { "dependencies": {
"chalk": "^4.1.0", "chalk": "^4.1.0",
"moment": "^2.27.0", "moment": "^2.27.0",
"node-fetch": "^2.6.1" "node-fetch": "^3.3.2"
} }
} }