mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-04 08:41:41 +00:00
Compare commits
29 Commits
users/saks
...
user/bchou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f819d9043 | ||
|
|
0683bfc3af | ||
|
|
1039d835f4 | ||
|
|
227c93a30b | ||
|
|
1f1ccc7e0e | ||
|
|
7aa62437f0 | ||
|
|
7ddedf3314 | ||
|
|
644226d800 | ||
|
|
e2e9cece5f | ||
|
|
d235be6a3b | ||
|
|
87d5f84f2e | ||
|
|
2758e6ac72 | ||
|
|
1232596c5a | ||
|
|
eff736596f | ||
|
|
44de3ade5c | ||
|
|
459b2c7050 | ||
|
|
1736e24429 | ||
|
|
ff5ebda58e | ||
|
|
79e9f3a843 | ||
|
|
9bdb995e14 | ||
|
|
de293d330c | ||
|
|
e9f12298cd | ||
|
|
d6a84af0a2 | ||
|
|
5a24db2230 | ||
|
|
45049425c9 | ||
|
|
74363ddfe9 | ||
|
|
ef1e26fc0c | ||
|
|
e75af41844 | ||
|
|
7ac6a264bb |
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
@@ -164,8 +164,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
shardTotal: [16]
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
||||
shardTotal: [20]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js 18.x
|
||||
@@ -198,18 +198,20 @@ jobs:
|
||||
GREMLIN_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-gremlin.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
echo "::add-mask::$GREMLIN_TESTACCOUNT_TOKEN"
|
||||
echo GREMLIN_TESTACCOUNT_TOKEN=$GREMLIN_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
CASSANDRA_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-cassandra.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
echo "::add-mask::$CASSANDRA_TESTACCOUNT_TOKEN"
|
||||
echo CASSANDRA_TESTACCOUNT_TOKEN=$CASSANDRA_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
MONGO_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
echo "::add-mask::$MONGO_TESTACCOUNT_TOKEN"
|
||||
echo MONGO_TESTACCOUNT_TOKEN=$MONGO_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
MONGO32_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo32.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
echo "::add-mask::$MONGO32_TESTACCOUNT_TOKEN"
|
||||
echo MONGO32_TESTACCOUNT_TOKEN=$MONGO32_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
MONGO_READONLY_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo-readonly.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
echo "::add-mask::$MONGO_READONLY_TESTACCOUNT_TOKEN"
|
||||
echo MONGO_READONLY_TESTACCOUNT_TOKEN=$MONGO_READONLY_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
# CASSANDRA_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-cassandra.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
# echo "::add-mask::$CASSANDRA_TESTACCOUNT_TOKEN"
|
||||
# echo CASSANDRA_TESTACCOUNT_TOKEN=$CASSANDRA_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
# MONGO_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
# echo "::add-mask::$MONGO_TESTACCOUNT_TOKEN"
|
||||
# echo MONGO_TESTACCOUNT_TOKEN=$MONGO_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
# MONGO32_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo32.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
# echo "::add-mask::$MONGO32_TESTACCOUNT_TOKEN"
|
||||
# echo MONGO32_TESTACCOUNT_TOKEN=$MONGO32_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
# MONGO_READONLY_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-mongo-readonly.documents.azure.com/.default" -o tsv --query accessToken)
|
||||
# echo "::add-mask::$MONGO_READONLY_TESTACCOUNT_TOKEN"
|
||||
# echo MONGO_READONLY_TESTACCOUNT_TOKEN=$MONGO_READONLY_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||
- name: List tests in this shard
|
||||
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
|
||||
- name: Run test shard ${{ matrix['shardIndex'] }} of ${{ matrix['shardTotal']}}
|
||||
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers=3
|
||||
- name: Upload blob report to GitHub Actions Artifacts
|
||||
|
||||
@@ -17,38 +17,6 @@
|
||||
position: fixed;
|
||||
top: -200px;
|
||||
}
|
||||
body.isDarkMode .ms-Layer {
|
||||
.ms-Callout-main {
|
||||
background-color: @BaseHigh !important;
|
||||
}
|
||||
|
||||
.ms-Callout-beak {
|
||||
background-color: @BaseHigh !important;
|
||||
}
|
||||
|
||||
.ms-ContextualMenu {
|
||||
background-color: @BaseHigh !important;
|
||||
}
|
||||
|
||||
.ms-Dropdown-items {
|
||||
background-color: @BaseHigh !important;
|
||||
}
|
||||
|
||||
.ms-Dropdown-item {
|
||||
background-color: @BaseHigh !important;
|
||||
color: @BaseLight !important;
|
||||
|
||||
&:hover {
|
||||
background-color: @BaseMediumHigh !important;
|
||||
color: @BaseLight !important;
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
background-color: @BaseMediumHigh !important;
|
||||
color: @BaseLight !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
|
||||
@@ -161,65 +129,6 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
&.isDarkMode .accountSwitchContextualMenu {
|
||||
background-color: @BaseHigh;
|
||||
|
||||
.ms-Callout-main {
|
||||
background-color: @BaseHigh;
|
||||
}
|
||||
|
||||
.ms-ContextualMenu-item {
|
||||
background-color: @BaseHigh;
|
||||
}
|
||||
|
||||
.ms-Dropdown {
|
||||
.ms-Dropdown-title {
|
||||
background-color: @BaseDark;
|
||||
color: @BaseLight;
|
||||
border-color: @BaseMediumHigh;
|
||||
}
|
||||
|
||||
.ms-Dropdown-caretDownWrapper {
|
||||
color: @BaseLight;
|
||||
}
|
||||
|
||||
&:hover .ms-Dropdown-title {
|
||||
background-color: @BaseHigh;
|
||||
color: @BaseLight;
|
||||
border-color: @BaseMedium;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-Label {
|
||||
color: @BaseLight;
|
||||
}
|
||||
}
|
||||
|
||||
&.isDarkMode .ms-Dropdown-callout {
|
||||
.ms-Callout-main {
|
||||
background-color: @BaseHigh;
|
||||
}
|
||||
|
||||
.ms-Dropdown-items {
|
||||
background-color: @BaseHigh;
|
||||
}
|
||||
|
||||
.ms-Dropdown-item {
|
||||
background-color: @BaseHigh;
|
||||
color: @BaseLight;
|
||||
|
||||
&:hover {
|
||||
background-color: @BaseMediumHigh;
|
||||
color: @BaseLight;
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
background-color: @BaseMediumHigh;
|
||||
color: @BaseLight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fixedleftpane {
|
||||
background: @BaseLow;
|
||||
height: 100vh;
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -116,8 +116,8 @@
|
||||
"tinykeys": "2.1.0",
|
||||
"underscore": "1.12.1",
|
||||
"utility-types": "3.10.0",
|
||||
"web-vitals": "4.2.4",
|
||||
"uuid": "9.0.0",
|
||||
"web-vitals": "4.2.4",
|
||||
"zustand": "3.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -4,6 +4,12 @@ import { defineConfig, devices } from "@playwright/test";
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: "test",
|
||||
testIgnore: [
|
||||
"**/mongo/**",
|
||||
"**/cassandra/**",
|
||||
"**/gremlin/**",
|
||||
"**/tables/**",
|
||||
],
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 3 : 0,
|
||||
@@ -11,8 +17,8 @@ export default defineConfig({
|
||||
reporter: process.env.CI ? "blob" : "html",
|
||||
timeout: 10 * 60 * 1000,
|
||||
use: {
|
||||
trace: "off",
|
||||
video: "off",
|
||||
trace: "on-all-retries",
|
||||
video: "on-first-retry",
|
||||
screenshot: "on",
|
||||
testIdAttribute: "data-test",
|
||||
contextOptions: {
|
||||
|
||||
@@ -42,16 +42,22 @@ export const getDataTransferJobs = async (
|
||||
);
|
||||
dataTransferJobs = [...dataTransferJobs, ...(dataTransferFeeds?.value || [])];
|
||||
while (dataTransferFeeds?.nextLink) {
|
||||
const nextResponse = await window.fetch(dataTransferFeeds.nextLink, {
|
||||
headers: {
|
||||
Authorization: userContext.authorizationToken,
|
||||
},
|
||||
});
|
||||
if (nextResponse.ok) {
|
||||
dataTransferFeeds = await nextResponse.json();
|
||||
dataTransferJobs = [...dataTransferJobs, ...(dataTransferFeeds?.value || [])];
|
||||
} else {
|
||||
break;
|
||||
try {
|
||||
const nextResponse = await window.fetch(dataTransferFeeds.nextLink, {
|
||||
headers: {
|
||||
Authorization: userContext.authorizationToken,
|
||||
},
|
||||
});
|
||||
if (nextResponse.ok) {
|
||||
dataTransferFeeds = await nextResponse.json();
|
||||
dataTransferJobs = [...dataTransferJobs, ...(dataTransferFeeds?.value || [])];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
// Handle network errors gracefully (e.g., in test environment)
|
||||
console.warn("Failed to fetch next page of data transfer jobs:", error);
|
||||
throw new Error(error.message || JSON.stringify(error));
|
||||
}
|
||||
}
|
||||
return dataTransferJobs;
|
||||
|
||||
@@ -437,13 +437,14 @@ export default class Explorer {
|
||||
public onRefreshResourcesClick = async (): Promise<void> => {
|
||||
if (isFabricMirroredKey()) {
|
||||
scheduleRefreshFabricToken(true).then(() => this.refreshAllDatabases());
|
||||
return;
|
||||
} else {
|
||||
await (userContext.authType === AuthType.ResourceToken
|
||||
? this.refreshDatabaseForResourceToken()
|
||||
: this.refreshAllDatabases());
|
||||
await this.refreshNotebookList();
|
||||
}
|
||||
|
||||
await (userContext.authType === AuthType.ResourceToken
|
||||
? this.refreshDatabaseForResourceToken()
|
||||
: this.refreshAllDatabases());
|
||||
await this.refreshNotebookList();
|
||||
logConsoleInfo("Successfully refreshed databases");
|
||||
};
|
||||
|
||||
// Facade
|
||||
|
||||
@@ -598,6 +598,9 @@ export default class Collection implements ViewModels.Collection {
|
||||
public onSettingsClick = async (): Promise<void> => {
|
||||
useSelectedNode.getState().setSelectedNode(this);
|
||||
const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit;
|
||||
// // Refresh all databases in case they were deleted outside of user session
|
||||
await this.container.onRefreshResourcesClick();
|
||||
|
||||
throughputCap && throughputCap !== -1 ? await useDatabases.getState().loadAllOffers() : await this.loadOffer();
|
||||
this.selectedSubnodeKind(ViewModels.CollectionTabKind.Settings);
|
||||
TelemetryProcessor.trace(Action.SelectItem, ActionModifiers.Mark, {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { initializeIcons } from "@fluentui/react";
|
||||
import { useBoolean } from "@fluentui/react-hooks";
|
||||
import { MessageTypes } from "Contracts/MessageTypes";
|
||||
import { AadAuthorizationFailure } from "Platform/Hosted/Components/AadAuthorizationFailure";
|
||||
import * as React from "react";
|
||||
import { render } from "react-dom";
|
||||
@@ -22,33 +21,9 @@ import "./Shared/appInsights";
|
||||
import { useAADAuth } from "./hooks/useAADAuth";
|
||||
import { useConfig } from "./hooks/useConfig";
|
||||
import { useTokenMetadata } from "./hooks/usePortalAccessToken";
|
||||
import { THEME_MODE_DARK, useThemeStore } from "./hooks/useTheme";
|
||||
|
||||
initializeIcons();
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("message", (event) => {
|
||||
const messageData = event.data?.data || event.data;
|
||||
const messageType = messageData?.type;
|
||||
|
||||
if (messageType === MessageTypes.UpdateTheme) {
|
||||
const themeData = messageData?.params?.theme || messageData?.theme;
|
||||
if (themeData && themeData.mode !== undefined) {
|
||||
const isDark = themeData.mode === THEME_MODE_DARK;
|
||||
useThemeStore.setState({
|
||||
isDarkMode: isDark,
|
||||
themeMode: themeData.mode,
|
||||
});
|
||||
if (isDark) {
|
||||
document.body.classList.add("isDarkMode");
|
||||
} else {
|
||||
document.body.classList.remove("isDarkMode");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const App: React.FunctionComponent = () => {
|
||||
// For handling encrypted portal tokens sent via query paramter
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
@@ -125,10 +125,7 @@ const App = (): JSX.Element => {
|
||||
<KeyboardShortcutRoot>
|
||||
<div className="flexContainer" aria-hidden="false">
|
||||
{userContext.features.enableContainerCopy && userContext.apiType === "SQL" ? (
|
||||
<>
|
||||
<ContainerCopyPanel explorer={explorer} />
|
||||
<SidePanel />
|
||||
</>
|
||||
<ContainerCopyPanel explorer={explorer} />
|
||||
) : (
|
||||
<DivExplorer explorer={explorer} />
|
||||
)}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// TODO: Renable this rule for the file or turn it off everywhere
|
||||
/* eslint-disable react/display-name */
|
||||
|
||||
import { DefaultButton, IButtonStyles, IContextualMenuItem, IContextualMenuProps } from "@fluentui/react";
|
||||
import { DefaultButton, IButtonStyles, IContextualMenuItem } from "@fluentui/react";
|
||||
import * as React from "react";
|
||||
import { FunctionComponent, useEffect, useState } from "react";
|
||||
import { StyleConstants } from "../../../Common/StyleConstants";
|
||||
@@ -92,16 +92,14 @@ export const AccountSwitcher: FunctionComponent<Props> = ({ armToken, setDatabas
|
||||
},
|
||||
];
|
||||
|
||||
const menuProps: IContextualMenuProps = {
|
||||
directionalHintFixed: true,
|
||||
className: "accountSwitchContextualMenu",
|
||||
items,
|
||||
};
|
||||
|
||||
return (
|
||||
<DefaultButton
|
||||
text={buttonText}
|
||||
menuProps={menuProps}
|
||||
menuProps={{
|
||||
directionalHintFixed: true,
|
||||
className: "accountSwitchContextualMenu",
|
||||
items,
|
||||
}}
|
||||
styles={buttonStyles}
|
||||
className="accountSwitchButton"
|
||||
id="accountSwitchButton"
|
||||
|
||||
@@ -31,6 +31,9 @@ export const SwitchAccount: FunctionComponent<Props> = ({
|
||||
}}
|
||||
defaultSelectedKey={selectedAccount?.name}
|
||||
placeholder={accounts && accounts.length === 0 ? "No Accounts Found" : "Select an Account"}
|
||||
styles={{
|
||||
callout: "accountSwitchAccountDropdownMenu",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -30,6 +30,9 @@ export const SwitchSubscription: FunctionComponent<Props> = ({
|
||||
}}
|
||||
defaultSelectedKey={selectedSubscription?.subscriptionId}
|
||||
placeholder={subscriptions && subscriptions.length === 0 ? "No Subscriptions Found" : "Select a Subscription"}
|
||||
styles={{
|
||||
callout: "accountSwitchSubscriptionDropdownMenu",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,8 @@ test("Cassandra keyspace and table CRUD", async ({ page }) => {
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
const newTableButton = await explorer.globalCommandButton("New Table");
|
||||
await newTableButton.click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
|
||||
41
test/fx.ts
41
test/fx.ts
@@ -352,8 +352,9 @@ export class DataExplorer {
|
||||
*
|
||||
* There's only a single "primary" button, but we still require you to pass the label to confirm you're selecting the right button.
|
||||
*/
|
||||
globalCommandButton(label: string): Locator {
|
||||
return this.frame.getByTestId("GlobalCommands").getByText(label);
|
||||
async globalCommandButton(label: string): Promise<Locator> {
|
||||
await this.frame.getByTestId("GlobalCommands").click();
|
||||
return this.frame.getByRole("menuitem", { name: label });
|
||||
}
|
||||
|
||||
/** Select the command bar button with the specified label */
|
||||
@@ -459,6 +460,15 @@ export class DataExplorer {
|
||||
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
||||
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(
|
||||
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
||||
);
|
||||
@@ -466,10 +476,35 @@ export class DataExplorer {
|
||||
}
|
||||
|
||||
/** Gets the console message element */
|
||||
getConsoleMessage(): Locator {
|
||||
getConsoleHeaderStatus(): Locator {
|
||||
return this.frame.getByTestId("notification-console/header-status");
|
||||
}
|
||||
|
||||
async expandNotificationConsole(): Promise<void> {
|
||||
await this.setNotificationConsoleExpanded(true);
|
||||
}
|
||||
|
||||
async collapseNotificationConsole(): Promise<void> {
|
||||
await this.setNotificationConsoleExpanded(false);
|
||||
}
|
||||
|
||||
async setNotificationConsoleExpanded(expanded: boolean): Promise<void> {
|
||||
const notificationConsoleToggleButton = this.frame.getByTestId("NotificationConsole/ExpandCollapseButton");
|
||||
const alt = await notificationConsoleToggleButton.locator("img").getAttribute("alt");
|
||||
|
||||
// When expanded, the icon says "Collapse icon"
|
||||
if (expanded && alt === "Expand icon") {
|
||||
await notificationConsoleToggleButton.click();
|
||||
} else if (!expanded && alt === "Collapse icon") {
|
||||
await notificationConsoleToggleButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
async getNotificationConsoleMessages(): Promise<Locator> {
|
||||
await this.setNotificationConsoleExpanded(true);
|
||||
return this.frame.getByTestId("NotificationConsole/Contents");
|
||||
}
|
||||
|
||||
async getDropdownItemByName(name: string, ariaLabel?: string): Promise<Locator> {
|
||||
const dropdownItemsWrapper = this.frame.locator("div.ms-Dropdown-items");
|
||||
if (ariaLabel) {
|
||||
|
||||
@@ -9,7 +9,8 @@ test("Gremlin graph CRUD", async ({ page }) => {
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
// Create new database and graph
|
||||
await explorer.globalCommandButton("New Graph").click();
|
||||
const newGraphButton = await explorer.globalCommandButton("New Graph");
|
||||
await newGraphButton.click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Graph",
|
||||
async (panel, okButton) => {
|
||||
|
||||
@@ -14,7 +14,8 @@ import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUnique
|
||||
|
||||
const explorer = await DataExplorer.open(page, accountType);
|
||||
|
||||
await explorer.globalCommandButton("New Collection").click();
|
||||
const newCollectionButton = await explorer.globalCommandButton("New Collection");
|
||||
await newCollectionButton.click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Collection",
|
||||
async (panel, okButton) => {
|
||||
|
||||
@@ -8,7 +8,8 @@ test("SQL database and container CRUD", async ({ page }) => {
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await explorer.globalCommandButton("New Container").click();
|
||||
const newContainerButton = await explorer.globalCommandButton("New Container");
|
||||
await newContainerButton.click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Container",
|
||||
async (panel, okButton) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ test.describe("Change Partition Key", () => {
|
||||
let pageInstance: Page;
|
||||
let context: TestContainerContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
const newPartitionKeyPath = "/newPartitionKey";
|
||||
const newPartitionKeyPath = "newPartitionKey";
|
||||
const newContainerId = "testcontainer_1";
|
||||
|
||||
test.beforeAll("Create Test Database", async () => {
|
||||
@@ -20,12 +20,16 @@ test.describe("Change Partition Key", () => {
|
||||
// Click Scale & Settings and open Partition Key tab
|
||||
await explorer.openScaleAndSettings(context);
|
||||
const PartitionKeyTab = explorer.frame.getByTestId("settings-tab-header/PartitionKeyTab");
|
||||
|
||||
await expect(PartitionKeyTab).toBeVisible();
|
||||
await PartitionKeyTab.click();
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
if (!process.env.CI) {
|
||||
test.afterEach("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Change partition key path", async () => {
|
||||
await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();
|
||||
@@ -53,16 +57,16 @@ test.describe("Change Partition Key", () => {
|
||||
changePkPanel.getByTestId("new-container-partition-key-input").fill(newPartitionKeyPath);
|
||||
|
||||
await expect(changePkPanel.getByTestId("add-sub-partition-key-button")).toBeVisible();
|
||||
changePkPanel.getByTestId("add-sub-partition-key-button").click();
|
||||
await expect(changePkPanel.getByTestId("new-container-sub-partition-key-input-0")).toBeVisible();
|
||||
await expect(changePkPanel.getByTestId("remove-sub-partition-key-button-0")).toBeVisible();
|
||||
await expect(changePkPanel.getByTestId("hierarchical-partitioning-info-text")).toBeVisible();
|
||||
changePkPanel.getByTestId("new-container-sub-partition-key-input-0").fill("/customerId");
|
||||
// changePkPanel.getByTestId("add-sub-partition-key-button").click();
|
||||
// await expect(changePkPanel.getByTestId("new-container-sub-partition-key-input-0")).toBeVisible();
|
||||
// await expect(changePkPanel.getByTestId("remove-sub-partition-key-button-0")).toBeVisible();
|
||||
// await expect(changePkPanel.getByTestId("hierarchical-partitioning-info-text")).toBeVisible();
|
||||
// changePkPanel.getByTestId("new-container-sub-partition-key-input-0").fill("customerId");
|
||||
|
||||
await changePkPanel.getByTestId("Panel/OkButton").click();
|
||||
|
||||
await pageInstance.waitForLoadState("networkidle");
|
||||
await expect(changePkPanel).not.toBeVisible({ timeout: 60 * 1000 });
|
||||
// await pageInstance.waitForLoadState("networkidle");
|
||||
await expect(changePkPanel).not.toBeVisible({ timeout: 5 * 60 * 1000 });
|
||||
|
||||
// Verify partition key change job
|
||||
const jobText = explorer.frame.getByText(/Partition key change job/);
|
||||
|
||||
@@ -9,39 +9,38 @@ import {
|
||||
} from "../../fx";
|
||||
import { createTestSQLContainer, TestContainerContext } from "../../testData";
|
||||
|
||||
test.describe("Autoscale and Manual throughput", () => {
|
||||
test.describe("Autoscale throughput", () => {
|
||||
let context: TestContainerContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
|
||||
test.beforeAll("Create Test Database", async () => {
|
||||
context = await createTestSQLContainer({ includeTestData: true });
|
||||
});
|
||||
|
||||
test.beforeEach("Open container settings", async ({ page }) => {
|
||||
test.beforeAll("Create Test Database", async ({ browser }) => {
|
||||
context = await createTestSQLContainer();
|
||||
const page = await browser.newPage();
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
// Click Scale & Settings and open Scale tab
|
||||
await explorer.openScaleAndSettings(context);
|
||||
const scaleTab = explorer.frame.getByTestId("settings-tab-header/ScaleTab");
|
||||
await scaleTab.click();
|
||||
|
||||
await switchManualToAutoscaleThroughput();
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
if (!process.env.CI) {
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Update autoscale max throughput", async () => {
|
||||
// By default the created container has manual throughput (Containers created via JS SDK v4.7.0 cannot be created with autoscale throughput)
|
||||
await switchManualToAutoscaleThroughput();
|
||||
|
||||
// Update autoscale max throughput
|
||||
await getThroughputInput("autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K.toString());
|
||||
await getThroughputInput(explorer, "autopilot").fill(TEST_AUTOSCALE_MAX_THROUGHPUT_RU_2K.toString());
|
||||
|
||||
// Save
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
|
||||
// Read console message
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated offer for collection ${context.container.id}`,
|
||||
{
|
||||
timeout: 2 * ONE_MINUTE_MS,
|
||||
@@ -50,9 +49,6 @@ test.describe("Autoscale and Manual throughput", () => {
|
||||
});
|
||||
|
||||
test("Update autoscale max throughput passed allowed limit", async () => {
|
||||
// By default the created container has manual throughput (Containers created via JS SDK v4.7.0 cannot be created with autoscale throughput)
|
||||
await switchManualToAutoscaleThroughput();
|
||||
|
||||
// Get soft allowed max throughput and remove commas
|
||||
const softAllowedMaxThroughputString = await explorer.frame
|
||||
.getByTestId("soft-allowed-maximum-throughput")
|
||||
@@ -60,29 +56,65 @@ test.describe("Autoscale and Manual throughput", () => {
|
||||
const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
|
||||
|
||||
// Try to set autoscale max throughput above allowed limit
|
||||
await getThroughputInput("autopilot").fill((softAllowedMaxThroughput * 10).toString());
|
||||
await getThroughputInput(explorer, "autopilot").fill((softAllowedMaxThroughput * 10).toString());
|
||||
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
|
||||
await expect(getThroughputInputErrorMessage("autopilot")).toContainText(
|
||||
await expect(getThroughputInputErrorMessage(explorer, "autopilot")).toContainText(
|
||||
"This update isn't possible because it would increase the total throughput",
|
||||
);
|
||||
});
|
||||
|
||||
test("Update autoscale max throughput with invalid increment", async () => {
|
||||
// By default the created container has manual throughput (Containers created via JS SDK v4.7.0 cannot be created with autoscale throughput)
|
||||
await switchManualToAutoscaleThroughput();
|
||||
|
||||
// Try to set autoscale max throughput with invalid increment
|
||||
await getThroughputInput("autopilot").fill("1100");
|
||||
await getThroughputInput(explorer, "autopilot").fill("1100");
|
||||
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
|
||||
await expect(getThroughputInputErrorMessage("autopilot")).toContainText(
|
||||
await expect(getThroughputInputErrorMessage(explorer, "autopilot")).toContainText(
|
||||
"Throughput value must be in increments of 1000",
|
||||
);
|
||||
});
|
||||
|
||||
test("Update manual throughput", async () => {
|
||||
await getThroughputInput("manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString());
|
||||
const switchManualToAutoscaleThroughput = async (): Promise<void> => {
|
||||
const autoscaleRadioButton = explorer.frame.getByText("Autoscale", { exact: true });
|
||||
await autoscaleRadioButton.click();
|
||||
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled();
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated offer for collection ${context.container.id}`,
|
||||
{
|
||||
timeout: ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
test.describe("Manual throughput", () => {
|
||||
let context: TestContainerContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
|
||||
test.beforeAll("Create Test Database & Open container settings", async ({ browser }) => {
|
||||
context = await createTestSQLContainer();
|
||||
const page = await browser.newPage();
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
// Click Scale & Settings and open Scale tab
|
||||
await explorer.openScaleAndSettings(context);
|
||||
const scaleTab = explorer.frame.getByTestId("settings-tab-header/ScaleTab");
|
||||
await scaleTab.click();
|
||||
});
|
||||
|
||||
// test.beforeEach("Open container settings", async ({ page }) => {
|
||||
|
||||
// });
|
||||
|
||||
if (!process.env.CI) {
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Update manual throughput", async () => {
|
||||
await getThroughputInput(explorer, "manual").fill(TEST_MANUAL_THROUGHPUT_RU_2K.toString());
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated offer for collection ${context.container.id}`,
|
||||
{
|
||||
timeout: 2 * ONE_MINUTE_MS,
|
||||
@@ -98,32 +130,19 @@ test.describe("Autoscale and Manual throughput", () => {
|
||||
const softAllowedMaxThroughput = Number(softAllowedMaxThroughputString.replace(/,/g, ""));
|
||||
|
||||
// Try to set manual throughput above allowed limit
|
||||
await getThroughputInput("manual").fill((softAllowedMaxThroughput * 10).toString());
|
||||
await getThroughputInput(explorer, "manual").fill((softAllowedMaxThroughput * 10).toString());
|
||||
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeDisabled();
|
||||
await expect(getThroughputInputErrorMessage("manual")).toContainText(
|
||||
await expect(getThroughputInputErrorMessage(explorer, "manual")).toContainText(
|
||||
"This update isn't possible because it would increase the total throughput",
|
||||
);
|
||||
});
|
||||
|
||||
// Helper methods
|
||||
const getThroughputInput = (type: "manual" | "autopilot"): Locator => {
|
||||
return explorer.frame.getByTestId(`${type}-throughput-input`);
|
||||
};
|
||||
|
||||
const getThroughputInputErrorMessage = (type: "manual" | "autopilot"): Locator => {
|
||||
return explorer.frame.getByTestId(`${type}-throughput-input-error`);
|
||||
};
|
||||
|
||||
const switchManualToAutoscaleThroughput = async (): Promise<void> => {
|
||||
const autoscaleRadioButton = explorer.frame.getByText("Autoscale", { exact: true });
|
||||
await autoscaleRadioButton.click();
|
||||
await expect(explorer.commandBarButton(CommandBarButton.Save)).toBeEnabled();
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(
|
||||
`Successfully updated offer for collection ${context.container.id}`,
|
||||
{
|
||||
timeout: ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
// Helper methods
|
||||
const getThroughputInput = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator => {
|
||||
return explorer.frame.getByTestId(`${type}-throughput-input`);
|
||||
};
|
||||
|
||||
const getThroughputInputErrorMessage = (explorer: DataExplorer, type: "manual" | "autopilot"): Locator => {
|
||||
return explorer.frame.getByTestId(`${type}-throughput-input-error`);
|
||||
};
|
||||
|
||||
@@ -2,18 +2,14 @@ import { expect, test } from "@playwright/test";
|
||||
import { CommandBarButton, DataExplorer, ONE_MINUTE_MS, TestAccount } from "../../fx";
|
||||
import { createTestSQLContainer, TestContainerContext } from "../../testData";
|
||||
|
||||
test.describe("Settings under Scale & Settings", () => {
|
||||
test.describe.serial("Settings under Scale & Settings", () => {
|
||||
let context: TestContainerContext = null!;
|
||||
let explorer: DataExplorer = null!;
|
||||
|
||||
test.beforeAll("Create Test Database", async () => {
|
||||
context = await createTestSQLContainer({ includeTestData: true });
|
||||
});
|
||||
|
||||
test.beforeEach("Open Settings tab under Scale & Settings", async ({ page }) => {
|
||||
test.beforeAll("Create Test Database", async ({ browser }) => {
|
||||
context = await createTestSQLContainer();
|
||||
const page = await browser.newPage();
|
||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
||||
await containerNode.expand();
|
||||
|
||||
// Click Scale & Settings and open Scale tab
|
||||
await explorer.openScaleAndSettings(context);
|
||||
@@ -21,18 +17,35 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
await settingsTab.click();
|
||||
});
|
||||
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
// test.beforeEach("Open container settings", async ({ page }) => {
|
||||
// explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
// // Click Scale & Settings and open Scale tab
|
||||
// await explorer.openScaleAndSettings(context);
|
||||
// const settingsTab = explorer.frame.getByTestId("settings-tab-header/SubSettingsTab");
|
||||
// await settingsTab.click();
|
||||
// });
|
||||
|
||||
// test.afterEach("Delete Test Database", async () => {
|
||||
// await context?.dispose();
|
||||
// });
|
||||
if (!process.env.CI) {
|
||||
test.afterAll("Delete Test Database", async () => {
|
||||
await context?.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
test("Update TTL to On (no default)", async () => {
|
||||
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
|
||||
await ttlOnNoDefaultRadioButton.click();
|
||||
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, {
|
||||
timeout: ONE_MINUTE_MS,
|
||||
});
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated container ${context.container.id}`,
|
||||
{
|
||||
timeout: ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("Update TTL to On (with user entry)", async () => {
|
||||
@@ -44,27 +57,11 @@ test.describe("Settings under Scale & Settings", () => {
|
||||
await ttlInput.fill("30000");
|
||||
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, {
|
||||
timeout: ONE_MINUTE_MS,
|
||||
});
|
||||
});
|
||||
|
||||
test("Update TTL to Off", async () => {
|
||||
// By default TTL is set to off so we need to first set it to On
|
||||
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
|
||||
await ttlOnNoDefaultRadioButton.click();
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, {
|
||||
timeout: ONE_MINUTE_MS,
|
||||
});
|
||||
|
||||
// Set it to Off
|
||||
const ttlOffRadioButton = explorer.frame.getByRole("radio", { name: "ttl-off-option" });
|
||||
await ttlOffRadioButton.click();
|
||||
|
||||
await explorer.commandBarButton(CommandBarButton.Save).click();
|
||||
await expect(explorer.getConsoleMessage()).toContainText(`Successfully updated container ${context.container.id}`, {
|
||||
timeout: ONE_MINUTE_MS,
|
||||
});
|
||||
await expect(explorer.getConsoleHeaderStatus()).toContainText(
|
||||
`Successfully updated container ${context.container.id}`,
|
||||
{
|
||||
timeout: ONE_MINUTE_MS,
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,8 @@ test("Tables CRUD", async ({ page }) => {
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
const newTableButton = explorer.frame.getByTestId("GlobalCommands").getByRole("button", { name: "New Table" });
|
||||
await newTableButton.click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Table",
|
||||
async (panel, okButton) => {
|
||||
|
||||
Reference in New Issue
Block a user