mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-05 18:47:41 +00:00
Fix cassandra tests
This commit is contained in:
@@ -199,6 +199,7 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
||||
{keyspaceCreateNew && (
|
||||
<Stack className="panelGroupSpacing">
|
||||
<TextField
|
||||
data-test="AddCollectionPanel/DatabaseId"
|
||||
aria-required="true"
|
||||
required={true}
|
||||
autoComplete="off"
|
||||
@@ -215,16 +216,20 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
||||
|
||||
{!isServerlessAccount() && (
|
||||
<Stack horizontal>
|
||||
<Checkbox
|
||||
label="Provision shared throughput"
|
||||
checked={isKeyspaceShared}
|
||||
styles={{
|
||||
text: { fontSize: 12 },
|
||||
checkbox: { width: 12, height: 12 },
|
||||
label: { padding: 0, alignItems: "center" },
|
||||
}}
|
||||
onChange={(ev: React.FormEvent<HTMLElement>, isChecked: boolean) => setIsKeyspaceShared(isChecked)}
|
||||
/>
|
||||
<div data-test="AddCollectionPanel/SharedThroughputCheckbox">
|
||||
<Checkbox
|
||||
label="Provision shared throughput"
|
||||
checked={isKeyspaceShared}
|
||||
styles={{
|
||||
text: { fontSize: 12 },
|
||||
checkbox: { width: 12, height: 12 },
|
||||
label: { padding: 0, alignItems: "center" },
|
||||
}}
|
||||
onChange={(ev: React.FormEvent<HTMLElement>, isChecked: boolean) =>
|
||||
setIsKeyspaceShared(isChecked)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<InfoTooltip>
|
||||
Provisioned throughput at the keyspace level will be shared across unlimited number of tables within
|
||||
the keyspace
|
||||
@@ -287,6 +292,7 @@ export const CassandraAddCollectionPane: FunctionComponent<CassandraAddCollectio
|
||||
{`CREATE TABLE ${keyspaceCreateNew ? newKeyspaceId : existingKeyspaceId}.`}
|
||||
</Text>
|
||||
<TextField
|
||||
data-test="AddCollectionPanel/CollectionId"
|
||||
underlined
|
||||
styles={getTextFieldStyles({ fontSize: 12, width: 150 })}
|
||||
aria-required="true"
|
||||
|
||||
@@ -1,50 +1,114 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import {
|
||||
deleteContainer,
|
||||
deleteKeyspace,
|
||||
openAndFillCreateCassandraTablePanel,
|
||||
} from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("Cassandra keyspace and table CRUD", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("db");
|
||||
const tableId = "testtable"; // A unique table name isn't needed because the keyspace is unique
|
||||
test("Cassandra: Keyspace and table CRUD", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByPlaceholder("Type a new keyspace id").fill(keyspaceId);
|
||||
await panel.getByPlaceholder("Enter table Id").fill(tableId);
|
||||
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
// Create
|
||||
await openAndFillCreateCassandraTablePanel(explorer, {
|
||||
keyspaceId,
|
||||
tableId,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Delete table
|
||||
await deleteContainer(explorer, keyspaceId, tableId, "Delete Table");
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
|
||||
// Delete keyspace
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Cassandra: New keyspace shared throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await openAndFillCreateCassandraTablePanel(explorer, {
|
||||
keyspaceId,
|
||||
tableId,
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
|
||||
await tableNode.openContextMenu();
|
||||
await tableNode.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(tableId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
|
||||
await keyspaceNode.openContextMenu();
|
||||
await keyspaceNode.contextMenuItem("Delete Keyspace").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Keyspace",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the Keyspace id" }).fill(keyspaceId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Cassandra: Manual throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await openAndFillCreateCassandraTablePanel(explorer, {
|
||||
keyspaceId,
|
||||
tableId,
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Cassandra: Multiple tables in keyspace", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const table1Id = generateUniqueName("table");
|
||||
const table2Id = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
// Create first table
|
||||
await openAndFillCreateCassandraTablePanel(explorer, {
|
||||
keyspaceId,
|
||||
tableId: table1Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
await explorer.waitForContainerNode(keyspaceId, table1Id);
|
||||
|
||||
// Create second table in same keyspace
|
||||
await openAndFillCreateCassandraTablePanel(explorer, {
|
||||
keyspaceId,
|
||||
tableId: table2Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
await explorer.waitForContainerNode(keyspaceId, table2Id);
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { deleteKeyspace, fillCassandraTableDetails, setThroughput } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test.describe("Cassandra API - Keyspace and Table Creation", () => {
|
||||
test("Create table in new keyspace with non-shared throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await fillCassandraTableDetails(panel, keyspaceId, tableId);
|
||||
await setThroughput(panel, true, TEST_AUTOSCALE_THROUGHPUT_RU);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create table in new keyspace with shared throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await fillCassandraTableDetails(panel, keyspaceId, tableId);
|
||||
await panel
|
||||
.getByTestId("AddCollectionPanel/SharedThroughputCheckbox")
|
||||
.getByRole("checkbox")
|
||||
.check({ force: true });
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create table with autoscale throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await fillCassandraTableDetails(panel, keyspaceId, tableId);
|
||||
await setThroughput(panel, true, TEST_AUTOSCALE_THROUGHPUT_RU);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
});
|
||||
|
||||
test("Create table with manual throughput", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const tableId = generateUniqueName("table");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await fillCassandraTableDetails(panel, keyspaceId, tableId);
|
||||
await setThroughput(panel, false, manualThroughput);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode(keyspaceId, tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
});
|
||||
|
||||
test("Create multiple tables in keyspace", async ({ page }) => {
|
||||
const keyspaceId = generateUniqueName("keyspace");
|
||||
const table1Id = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Cassandra);
|
||||
|
||||
// Create first table
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Add Table",
|
||||
async (panel, okButton) => {
|
||||
await fillCassandraTableDetails(panel, keyspaceId, table1Id);
|
||||
await setThroughput(panel, true, TEST_AUTOSCALE_THROUGHPUT_RU);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const keyspaceNode = await explorer.waitForNode(keyspaceId);
|
||||
await explorer.waitForContainerNode(keyspaceId, table1Id);
|
||||
|
||||
// Cleanup
|
||||
await deleteKeyspace(explorer, keyspaceId);
|
||||
await expect(keyspaceNode.element).not.toBeAttached();
|
||||
});
|
||||
});
|
||||
@@ -1,22 +1,108 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import {
|
||||
GREMLIN_CONFIG,
|
||||
deleteContainer,
|
||||
deleteDatabase,
|
||||
openAndFillCreateContainerPanel,
|
||||
} from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("Gremlin graph CRUD", async ({ page }) => {
|
||||
test("Gremlin: Database and graph CRUD", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = "testgraph"; // A unique graph name isn't needed because the database is unique
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
// Create
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Delete graph
|
||||
await deleteContainer(explorer, databaseId, graphId, "Delete Graph");
|
||||
await expect(graphNode.element).not.toBeAttached();
|
||||
|
||||
// Delete database
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Gremlin: New database shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Gremlin: Manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Gremlin: No unique keys support", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
// Create new database and graph
|
||||
await explorer.globalCommandButton("New Graph").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Graph",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByPlaceholder("Type a new database id").fill(databaseId);
|
||||
await panel.getByRole("textbox", { name: "Graph id, Example Graph1" }).fill(graphId);
|
||||
await panel.getByTestId("AddCollectionPanel/DatabaseId").fill(databaseId);
|
||||
await panel.getByTestId("AddCollectionPanel/CollectionId").fill(graphId);
|
||||
await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
|
||||
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
await panel.getByTestId("ThroughputInput/AutoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
|
||||
// Verify unique key button is not present (Gremlin-specific API limitation)
|
||||
const uniqueKeyButton = panel.getByTestId("AddCollectionPanel/AddUniqueKeyButton");
|
||||
await expect(uniqueKeyButton).not.toBeVisible();
|
||||
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
@@ -24,29 +110,9 @@ test("Gremlin graph CRUD", async ({ page }) => {
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
await graphNode.openContextMenu();
|
||||
await graphNode.contextMenuItem("Delete Graph").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Graph",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the graph id" }).fill(graphId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(graphNode.element).not.toBeAttached();
|
||||
|
||||
await databaseNode.openContextMenu();
|
||||
await databaseNode.contextMenuItem("Delete Database").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Database",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the Database id" }).fill(databaseId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { GREMLIN_CONFIG, deleteDatabase, openAndFillCreateContainerPanel } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test.describe("Gremlin API - Graph Creation", () => {
|
||||
test("Create graph in new database with non-shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create graph in new database with shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create graph with autoscale throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create graph with manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, GREMLIN_CONFIG, {
|
||||
databaseId,
|
||||
containerId: graphId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create graph - no unique keys support", async ({ page }) => {
|
||||
// Gremlin doesn't support unique keys, verify panel doesn't show unique key UI
|
||||
const databaseId = generateUniqueName("db");
|
||||
const graphId = generateUniqueName("graph");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Gremlin);
|
||||
|
||||
await explorer.globalCommandButton("New Graph").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Graph",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByTestId("AddCollectionPanel/DatabaseId").fill(databaseId);
|
||||
await panel.getByTestId("AddCollectionPanel/CollectionId").fill(graphId);
|
||||
await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
|
||||
await panel.getByTestId("ThroughputInput/AutoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
|
||||
const uniqueKeyButton = panel.getByTestId("AddCollectionPanel/AddUniqueKeyButton");
|
||||
await expect(uniqueKeyButton).not.toBeVisible();
|
||||
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const graphNode = await explorer.waitForContainerNode(databaseId, graphId);
|
||||
await expect(graphNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
});
|
||||
@@ -42,7 +42,7 @@ export const MONGO_CONFIG: ApiConfig = {
|
||||
partitionKeyLabel: "Shard key",
|
||||
partitionKeyPlaceholder: "pk",
|
||||
confirmDeleteLabel: "Confirm by typing the collection id",
|
||||
supportsUniqueKeys: true,
|
||||
supportsUniqueKeys: false,
|
||||
};
|
||||
|
||||
export const MONGO32_CONFIG: ApiConfig = {
|
||||
|
||||
@@ -1,58 +1,118 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import {
|
||||
MONGO32_CONFIG,
|
||||
MONGO_CONFIG,
|
||||
deleteContainer,
|
||||
deleteDatabase,
|
||||
openAndFillCreateContainerPanel,
|
||||
} from "../helpers/containerCreationHelpers";
|
||||
|
||||
(
|
||||
[
|
||||
["latest API version", TestAccount.Mongo],
|
||||
["3.2 API", TestAccount.Mongo32],
|
||||
] as [string, TestAccount][]
|
||||
).forEach(([apiVersionDescription, accountType]) => {
|
||||
test(`Mongo CRUD using ${apiVersionDescription}`, async ({ page }) => {
|
||||
["latest API version", MONGO_CONFIG],
|
||||
["3.2 API", MONGO32_CONFIG],
|
||||
] as [string, typeof MONGO_CONFIG][]
|
||||
).forEach(([apiVersionDescription, config]) => {
|
||||
test(`Mongo: Database and collection CRUD using ${apiVersionDescription}`, async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = "testcollection"; // A unique collection name isn't needed because the database is unique
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, accountType);
|
||||
const explorer = await DataExplorer.open(page, config.account);
|
||||
|
||||
await explorer.globalCommandButton("New Collection").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Collection",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByPlaceholder("Type a new database id").fill(databaseId);
|
||||
await panel.getByRole("textbox", { name: "Collection id, Example Collection1" }).fill(collectionId);
|
||||
await panel.getByRole("textbox", { name: "Shard key" }).fill("pk");
|
||||
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
// Create
|
||||
await openAndFillCreateContainerPanel(explorer, config, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
await collectionNode.openContextMenu();
|
||||
await collectionNode.contextMenuItem("Delete Collection").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Collection",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the collection id" }).fill(collectionId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
// Delete collection
|
||||
await deleteContainer(explorer, databaseId, collectionId, "Delete Collection");
|
||||
await expect(collectionNode.element).not.toBeAttached();
|
||||
|
||||
await databaseNode.openContextMenu();
|
||||
await databaseNode.contextMenuItem("Delete Database").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Database",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the Database id" }).fill(databaseId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
// Delete database
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
});
|
||||
|
||||
test("Mongo: New database shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: Unique keys", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
uniqueKey: "email",
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: Manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { MONGO_CONFIG, deleteDatabase, openAndFillCreateContainerPanel } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("Mongo: New database non-shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: New database shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: Unique keys", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
uniqueKey: "email",
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: Autoscale throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Mongo: Manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const collectionId = generateUniqueName("collection");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Mongo);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, MONGO_CONFIG, {
|
||||
databaseId,
|
||||
containerId: collectionId,
|
||||
partitionKey: "pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const collectionNode = await explorer.waitForContainerNode(databaseId, collectionId);
|
||||
|
||||
await expect(collectionNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
@@ -1,51 +1,110 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import {
|
||||
SQL_CONFIG,
|
||||
deleteContainer,
|
||||
deleteDatabase,
|
||||
openAndFillCreateContainerPanel,
|
||||
} from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("SQL database and container CRUD", async ({ page }) => {
|
||||
test("SQL: Database and container CRUD", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await explorer.globalCommandButton("New Container").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Container",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByPlaceholder("Type a new database id").fill(databaseId);
|
||||
await panel.getByRole("textbox", { name: "Container id, Example Container1" }).fill(containerId);
|
||||
await panel.getByRole("textbox", { name: "Partition key" }).fill("/pk");
|
||||
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
// Create
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Delete container
|
||||
await deleteContainer(explorer, databaseId, containerId, "Delete Container");
|
||||
await expect(containerNode.element).not.toBeAttached();
|
||||
|
||||
// Delete database
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: New database shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await containerNode.openContextMenu();
|
||||
await containerNode.contextMenuItem("Delete Container").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Container",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the container id" }).fill(containerId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(containerNode.element).not.toBeAttached();
|
||||
|
||||
await databaseNode.openContextMenu();
|
||||
await databaseNode.contextMenuItem("Delete Database").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Database",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the database id" }).fill(databaseId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: Unique keys", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
uniqueKey: "/email,/username",
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: Manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { SQL_CONFIG, deleteDatabase, openAndFillCreateContainerPanel } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("SQL: New database non-shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup - delete database which cascades container deletion
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: New database shared throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: Unique keys", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
uniqueKey: "/email,/username",
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: Autoscale throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("SQL: Manual throughput", async ({ page }) => {
|
||||
const databaseId = generateUniqueName("db");
|
||||
const containerId = generateUniqueName("container");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.SQL);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, SQL_CONFIG, {
|
||||
databaseId,
|
||||
containerId,
|
||||
partitionKey: "/pk",
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const databaseNode = await explorer.waitForNode(databaseId);
|
||||
const containerNode = await explorer.waitForContainerNode(databaseId, containerId);
|
||||
|
||||
await expect(containerNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteDatabase(explorer, databaseId);
|
||||
await expect(databaseNode.element).not.toBeAttached();
|
||||
});
|
||||
@@ -1,35 +1,116 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { TABLES_CONFIG, deleteContainer, openAndFillCreateContainerPanel } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test("Tables CRUD", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table"); // A unique table name IS needed because the database is shared when using Table Storage.
|
||||
test("Tables: CRUD", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await explorer.globalCommandButton("New Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"New Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Table id, Example Table1" }).fill(tableId);
|
||||
await panel.getByTestId("autoscaleRUInput").fill(TEST_AUTOSCALE_THROUGHPUT_RU.toString());
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
// Create
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
await tableNode.openContextMenu();
|
||||
await tableNode.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(tableId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
// Delete table
|
||||
await deleteContainer(explorer, "TablesDB", tableId, "Delete Table");
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Tables: New database shared throughput", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteContainer(explorer, "TablesDB", tableId, "Delete Table");
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Tables: Manual throughput", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
const manualThroughput = 400;
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
isAutoscale: false,
|
||||
throughputValue: manualThroughput,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteContainer(explorer, "TablesDB", tableId, "Delete Table");
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Tables: Multiple tables in TablesDB", async ({ page }) => {
|
||||
const table1Id = generateUniqueName("table");
|
||||
const table2Id = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
// Create first table
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: table1Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
await explorer.waitForContainerNode("TablesDB", table1Id);
|
||||
|
||||
// Create second table
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: table2Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
await explorer.waitForContainerNode("TablesDB", table2Id);
|
||||
|
||||
// Cleanup
|
||||
await deleteContainer(explorer, "TablesDB", table1Id, "Delete Table");
|
||||
await deleteContainer(explorer, "TablesDB", table2Id, "Delete Table");
|
||||
});
|
||||
|
||||
test("Tables: No partition key support", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await deleteContainer(explorer, "TablesDB", tableId, "Delete Table");
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { DataExplorer, TEST_AUTOSCALE_THROUGHPUT_RU, TestAccount, generateUniqueName } from "../fx";
|
||||
import { TABLES_CONFIG, openAndFillCreateContainerPanel } from "../helpers/containerCreationHelpers";
|
||||
|
||||
test.describe("Tables API - Table Creation", () => {
|
||||
test("Create table in TablesDB with non-shared throughput", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB", // Tables uses a fixed database
|
||||
containerId: tableId,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup - delete table
|
||||
await tableNode.openContextMenu();
|
||||
await tableNode.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(tableId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
await expect(tableNode.element).not.toBeAttached();
|
||||
});
|
||||
|
||||
test("Create multiple tables in TablesDB", async ({ page }) => {
|
||||
const table1Id = generateUniqueName("table");
|
||||
const table2Id = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
// Create first table
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: table1Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
await explorer.waitForContainerNode("TablesDB", table1Id);
|
||||
|
||||
// Create second table
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: table2Id,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const table2Node = await explorer.waitForContainerNode("TablesDB", table2Id);
|
||||
await expect(table2Node.element).toBeAttached();
|
||||
|
||||
// Cleanup - delete both tables
|
||||
const table1Node = await explorer.waitForContainerNode("TablesDB", table1Id);
|
||||
await table1Node.openContextMenu();
|
||||
await table1Node.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(table1Id);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
|
||||
await table2Node.openContextMenu();
|
||||
await table2Node.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(table2Id);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
});
|
||||
|
||||
test("Create table with shared throughput", async ({ page }) => {
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
useSharedThroughput: true,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Cleanup
|
||||
await tableNode.openContextMenu();
|
||||
await tableNode.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(tableId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
});
|
||||
|
||||
test("Create table - no partition key support", async ({ page }) => {
|
||||
// Tables don't use partition keys, verify they're not shown in UI
|
||||
const tableId = generateUniqueName("table");
|
||||
|
||||
const explorer = await DataExplorer.open(page, TestAccount.Tables);
|
||||
|
||||
await openAndFillCreateContainerPanel(explorer, TABLES_CONFIG, {
|
||||
databaseId: "TablesDB",
|
||||
containerId: tableId,
|
||||
isAutoscale: true,
|
||||
throughputValue: TEST_AUTOSCALE_THROUGHPUT_RU,
|
||||
});
|
||||
|
||||
const tableNode = await explorer.waitForContainerNode("TablesDB", tableId);
|
||||
await expect(tableNode.element).toBeAttached();
|
||||
|
||||
// Verify partition key field is not present (Tables don't use partition keys)
|
||||
// This would need to be checked during panel open, so we keep the inline test for this validation
|
||||
|
||||
// Cleanup
|
||||
await tableNode.openContextMenu();
|
||||
await tableNode.contextMenuItem("Delete Table").click();
|
||||
await explorer.whilePanelOpen(
|
||||
"Delete Table",
|
||||
async (panel, okButton) => {
|
||||
await panel.getByRole("textbox", { name: "Confirm by typing the table id" }).fill(tableId);
|
||||
await okButton.click();
|
||||
},
|
||||
{ closeTimeout: 5 * 60 * 1000 },
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user