mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-23 19:54:08 +00:00
Compare commits
8 Commits
master
...
users/aisa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b559976a42 | ||
|
|
a4b0572f91 | ||
|
|
22e9580ca4 | ||
|
|
c561a982fb | ||
|
|
c971d21698 | ||
|
|
43b407a190 | ||
|
|
dd93b70a61 | ||
|
|
4270151e97 |
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@@ -189,6 +189,9 @@ jobs:
|
|||||||
NOSQL_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-sql.documents.azure.com/.default" -o tsv --query accessToken)
|
NOSQL_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-sql.documents.azure.com/.default" -o tsv --query accessToken)
|
||||||
echo "::add-mask::$NOSQL_TESTACCOUNT_TOKEN"
|
echo "::add-mask::$NOSQL_TESTACCOUNT_TOKEN"
|
||||||
echo NOSQL_TESTACCOUNT_TOKEN=$NOSQL_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
echo NOSQL_TESTACCOUNT_TOKEN=$NOSQL_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||||
|
NOSQL2_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-sql-2.documents.azure.com/.default" -o tsv --query accessToken)
|
||||||
|
echo "::add-mask::$NOSQL2_TESTACCOUNT_TOKEN"
|
||||||
|
echo NOSQL2_TESTACCOUNT_TOKEN=$NOSQL2_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||||
NOSQL_READONLY_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-sql-readonly.documents.azure.com/.default" -o tsv --query accessToken)
|
NOSQL_READONLY_TESTACCOUNT_TOKEN=$(az account get-access-token --scope "https://github-e2etests-sql-readonly.documents.azure.com/.default" -o tsv --query accessToken)
|
||||||
echo "::add-mask::$NOSQL_READONLY_TESTACCOUNT_TOKEN"
|
echo "::add-mask::$NOSQL_READONLY_TESTACCOUNT_TOKEN"
|
||||||
echo NOSQL_READONLY_TESTACCOUNT_TOKEN=$NOSQL_READONLY_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
echo NOSQL_READONLY_TESTACCOUNT_TOKEN=$NOSQL_READONLY_TESTACCOUNT_TOKEN >> $GITHUB_ENV
|
||||||
|
|||||||
@@ -7,27 +7,16 @@ import { HttpStatusCodes } from "./Constants";
|
|||||||
import { logError } from "./Logger";
|
import { logError } from "./Logger";
|
||||||
import { sendMessage } from "./MessageHandler";
|
import { sendMessage } from "./MessageHandler";
|
||||||
|
|
||||||
export interface HandleErrorOptions {
|
export const handleError = (error: string | ARMError | Error, area: string, consoleErrorPrefix?: string): void => {
|
||||||
/** Optional redacted error to use for telemetry logging instead of the original error */
|
|
||||||
redactedError?: string | ARMError | Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const handleError = (
|
|
||||||
error: string | ARMError | Error,
|
|
||||||
area: string,
|
|
||||||
consoleErrorPrefix?: string,
|
|
||||||
options?: HandleErrorOptions,
|
|
||||||
): void => {
|
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
const errorCode = error instanceof ARMError ? error.code : undefined;
|
const errorCode = error instanceof ARMError ? error.code : undefined;
|
||||||
|
|
||||||
// logs error to data explorer console (always shows original, non-redacted message)
|
// logs error to data explorer console
|
||||||
const consoleErrorMessage = consoleErrorPrefix ? `${consoleErrorPrefix}:\n ${errorMessage}` : errorMessage;
|
const consoleErrorMessage = consoleErrorPrefix ? `${consoleErrorPrefix}:\n ${errorMessage}` : errorMessage;
|
||||||
logConsoleError(consoleErrorMessage);
|
logConsoleError(consoleErrorMessage);
|
||||||
|
|
||||||
// logs error to both app insight and kusto (use redacted message if provided)
|
// logs error to both app insight and kusto
|
||||||
const telemetryErrorMessage = options?.redactedError ? getErrorMessage(options.redactedError) : errorMessage;
|
logError(errorMessage, area, errorCode);
|
||||||
logError(telemetryErrorMessage, area, errorCode);
|
|
||||||
|
|
||||||
// checks for errors caused by firewall and sends them to portal to handle
|
// checks for errors caused by firewall and sends them to portal to handle
|
||||||
sendNotificationForError(errorMessage, errorCode);
|
sendNotificationForError(errorMessage, errorCode);
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ export const deleteDocuments = async (
|
|||||||
documentIds: DocumentId[],
|
documentIds: DocumentId[],
|
||||||
abortSignal: AbortSignal,
|
abortSignal: AbortSignal,
|
||||||
): Promise<IBulkDeleteResult[]> => {
|
): Promise<IBulkDeleteResult[]> => {
|
||||||
const totalCount = documentIds.length;
|
const clearMessage = logConsoleProgress(`Deleting ${documentIds.length} ${getEntityName(true)}`);
|
||||||
const clearMessage = logConsoleProgress(`Deleting ${totalCount} ${getEntityName(true)}`);
|
|
||||||
try {
|
try {
|
||||||
const v2Container = await client().database(collection.databaseId).container(collection.id());
|
const v2Container = await client().database(collection.databaseId).container(collection.id());
|
||||||
|
|
||||||
@@ -84,7 +83,11 @@ export const deleteDocuments = async (
|
|||||||
const flatAllResult = Array.prototype.concat.apply([], allResult);
|
const flatAllResult = Array.prototype.concat.apply([], allResult);
|
||||||
return flatAllResult;
|
return flatAllResult;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, "DeleteDocuments", `Error while deleting ${totalCount} ${getEntityName(totalCount > 1)}`);
|
handleError(
|
||||||
|
error,
|
||||||
|
"DeleteDocuments",
|
||||||
|
`Error while deleting ${documentIds.length} ${getEntityName(documentIds.length > 1)}`,
|
||||||
|
);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
clearMessage();
|
clearMessage();
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
import { redactSyntaxErrorMessage } from "./queryDocumentsPage";
|
|
||||||
|
|
||||||
/* Typical error to redact looks like this (the message property contains a JSON string with nested structure):
|
|
||||||
{
|
|
||||||
"message": "{\"code\":\"BadRequest\",\"message\":\"{\\\"errors\\\":[{\\\"severity\\\":\\\"Error\\\",\\\"location\\\":{\\\"start\\\":0,\\\"end\\\":5},\\\"code\\\":\\\"SC1001\\\",\\\"message\\\":\\\"Syntax error, incorrect syntax near 'Crazy'.\\\"}]}\\r\\nActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17, Windows/10.0.20348 cosmos-netstandard-sdk/3.18.0\"}"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Helper to create the nested error structure that matches what the SDK returns
|
|
||||||
const createNestedError = (
|
|
||||||
errors: Array<{ severity?: string; location?: { start: number; end: number }; code: string; message: string }>,
|
|
||||||
activityId: string = "test-activity-id",
|
|
||||||
): { message: string } => {
|
|
||||||
const innerErrorsJson = JSON.stringify({ errors });
|
|
||||||
const innerMessage = `${innerErrorsJson}\r\n${activityId}`;
|
|
||||||
const outerJson = JSON.stringify({ code: "BadRequest", message: innerMessage });
|
|
||||||
return { message: outerJson };
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper to parse the redacted result
|
|
||||||
const parseRedactedResult = (result: { message: string }) => {
|
|
||||||
const outerParsed = JSON.parse(result.message);
|
|
||||||
const [innerErrorsJson, activityIdPart] = outerParsed.message.split("\r\n");
|
|
||||||
const innerErrors = JSON.parse(innerErrorsJson);
|
|
||||||
return { outerParsed, innerErrors, activityIdPart };
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("redactSyntaxErrorMessage", () => {
|
|
||||||
it("should redact SC1001 error message", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
severity: "Error",
|
|
||||||
location: { start: 0, end: 5 },
|
|
||||||
code: "SC1001",
|
|
||||||
message: "Syntax error, incorrect syntax near 'Crazy'.",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"ActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { outerParsed, innerErrors, activityIdPart } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(outerParsed.code).toBe("BadRequest");
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(activityIdPart).toContain("ActivityId: d5424e10-51bd-46f7-9aec-7b40bed36f17");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should redact SC2001 error message", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
severity: "Error",
|
|
||||||
location: { start: 0, end: 10 },
|
|
||||||
code: "SC2001",
|
|
||||||
message: "Some sensitive syntax error message.",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"ActivityId: abc123",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { outerParsed, innerErrors, activityIdPart } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(outerParsed.code).toBe("BadRequest");
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(activityIdPart).toContain("ActivityId: abc123");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should redact multiple errors with SC1001 and SC2001 codes", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[
|
|
||||||
{ severity: "Error", code: "SC1001", message: "First error" },
|
|
||||||
{ severity: "Error", code: "SC2001", message: "Second error" },
|
|
||||||
],
|
|
||||||
"ActivityId: xyz",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
expect(innerErrors.errors[1].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not redact errors with other codes", () => {
|
|
||||||
const error = createNestedError(
|
|
||||||
[{ severity: "Error", code: "SC9999", message: "This should not be redacted." }],
|
|
||||||
"ActivityId: test123",
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error); // Should return original error unchanged
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not modify non-BadRequest errors", () => {
|
|
||||||
const innerMessage = JSON.stringify({ errors: [{ code: "SC1001", message: "Should not be redacted" }] });
|
|
||||||
const error = {
|
|
||||||
message: JSON.stringify({ code: "NotFound", message: innerMessage }),
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle errors without message property", () => {
|
|
||||||
const error = { code: "BadRequest" };
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle non-object errors", () => {
|
|
||||||
const stringError = "Simple string error";
|
|
||||||
const nullError: null = null;
|
|
||||||
const undefinedError: undefined = undefined;
|
|
||||||
|
|
||||||
expect(redactSyntaxErrorMessage(stringError)).toBe(stringError);
|
|
||||||
expect(redactSyntaxErrorMessage(nullError)).toBe(nullError);
|
|
||||||
expect(redactSyntaxErrorMessage(undefinedError)).toBe(undefinedError);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle malformed JSON in message", () => {
|
|
||||||
const error = {
|
|
||||||
message: "not valid json",
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
expect(result).toBe(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle message without ActivityId suffix", () => {
|
|
||||||
const innerErrorsJson = JSON.stringify({
|
|
||||||
errors: [{ severity: "Error", code: "SC1001", message: "Syntax error near something." }],
|
|
||||||
});
|
|
||||||
const error = {
|
|
||||||
message: JSON.stringify({ code: "BadRequest", message: innerErrorsJson + "\r\n" }),
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as { message: string };
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should preserve other error properties", () => {
|
|
||||||
const baseError = createNestedError([{ code: "SC1001", message: "Error" }], "ActivityId: test");
|
|
||||||
const error = {
|
|
||||||
...baseError,
|
|
||||||
statusCode: 400,
|
|
||||||
additionalInfo: "extra data",
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = redactSyntaxErrorMessage(error) as {
|
|
||||||
message: string;
|
|
||||||
statusCode: number;
|
|
||||||
additionalInfo: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(result.statusCode).toBe(400);
|
|
||||||
expect(result.additionalInfo).toBe("extra data");
|
|
||||||
|
|
||||||
const { innerErrors } = parseRedactedResult(result);
|
|
||||||
expect(innerErrors.errors[0].message).toBe("__REDACTED__");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -4,51 +4,6 @@ import { getEntityName } from "../DocumentUtility";
|
|||||||
import { handleError } from "../ErrorHandlingUtils";
|
import { handleError } from "../ErrorHandlingUtils";
|
||||||
import { MinimalQueryIterator, nextPage } from "../IteratorUtilities";
|
import { MinimalQueryIterator, nextPage } from "../IteratorUtilities";
|
||||||
|
|
||||||
// Redact sensitive information from BadRequest errors with specific codes
|
|
||||||
export const redactSyntaxErrorMessage = (error: unknown): unknown => {
|
|
||||||
const codesToRedact = ["SC1001", "SC2001"];
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Handle error objects with a message property
|
|
||||||
if (error && typeof error === "object" && "message" in error) {
|
|
||||||
const errorObj = error as { code?: string; message?: string };
|
|
||||||
if (typeof errorObj.message === "string") {
|
|
||||||
// Parse the inner JSON from the message
|
|
||||||
const innerJson = JSON.parse(errorObj.message);
|
|
||||||
if (innerJson.code === "BadRequest" && typeof innerJson.message === "string") {
|
|
||||||
const [innerErrorsJson, activityIdPart] = innerJson.message.split("\r\n");
|
|
||||||
const innerErrorsObj = JSON.parse(innerErrorsJson);
|
|
||||||
if (Array.isArray(innerErrorsObj.errors)) {
|
|
||||||
let modified = false;
|
|
||||||
innerErrorsObj.errors = innerErrorsObj.errors.map((err: { code?: string; message?: string }) => {
|
|
||||||
if (err.code && codesToRedact.includes(err.code)) {
|
|
||||||
modified = true;
|
|
||||||
return { ...err, message: "__REDACTED__" };
|
|
||||||
}
|
|
||||||
return err;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (modified) {
|
|
||||||
// Reconstruct the message with the redacted content
|
|
||||||
const redactedMessage = JSON.stringify(innerErrorsObj) + `\r\n${activityIdPart}`;
|
|
||||||
const redactedError = {
|
|
||||||
...error,
|
|
||||||
message: JSON.stringify({ ...innerJson, message: redactedMessage }),
|
|
||||||
body: undefined as unknown, // Clear body to avoid sensitive data
|
|
||||||
};
|
|
||||||
return redactedError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// If parsing fails, return the original error
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const queryDocumentsPage = async (
|
export const queryDocumentsPage = async (
|
||||||
resourceName: string,
|
resourceName: string,
|
||||||
documentsIterator: MinimalQueryIterator,
|
documentsIterator: MinimalQueryIterator,
|
||||||
@@ -63,12 +18,7 @@ export const queryDocumentsPage = async (
|
|||||||
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
logConsoleInfo(`Successfully fetched ${itemCount} ${entityName} for container ${resourceName}`);
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Redact sensitive information for telemetry while showing original in console
|
handleError(error, "QueryDocumentsPage", `Failed to query ${entityName} for container ${resourceName}`);
|
||||||
const redactedError = redactSyntaxErrorMessage(error);
|
|
||||||
|
|
||||||
handleError(error, "QueryDocumentsPage", `Failed to query ${entityName} for container ${resourceName}`, {
|
|
||||||
redactedError: redactedError as Error,
|
|
||||||
});
|
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
clearMessage();
|
clearMessage();
|
||||||
|
|||||||
@@ -11,17 +11,9 @@ jest.mock("../../Actions/CopyJobActions", () => ({
|
|||||||
|
|
||||||
jest.mock("./CopyJobColumns", () => ({
|
jest.mock("./CopyJobColumns", () => ({
|
||||||
getColumns: jest.fn(() => [
|
getColumns: jest.fn(() => [
|
||||||
{
|
|
||||||
key: "LastUpdatedTime",
|
|
||||||
name: "Date & time",
|
|
||||||
fieldName: "LastUpdatedTime",
|
|
||||||
minWidth: 140,
|
|
||||||
maxWidth: 300,
|
|
||||||
isResizable: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: "Name",
|
key: "Name",
|
||||||
name: "Job name",
|
name: "Name",
|
||||||
fieldName: "Name",
|
fieldName: "Name",
|
||||||
minWidth: 140,
|
minWidth: 140,
|
||||||
maxWidth: 300,
|
maxWidth: 300,
|
||||||
@@ -173,165 +165,6 @@ describe("CopyJobsList", () => {
|
|||||||
expect(screen.getByTestId("action-menu-job-2")).toBeInTheDocument();
|
expect(screen.getByTestId("action-menu-job-2")).toBeInTheDocument();
|
||||||
expect(screen.getByTestId("action-menu-job-3")).toBeInTheDocument();
|
expect(screen.getByTestId("action-menu-job-3")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders filter TextField with data-test attribute", () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterTextField = document.querySelector('[data-test="CopyJobsList/FilterTextField"]');
|
|
||||||
expect(filterTextField).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("renders search TextField with correct placeholder", () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const searchInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
expect(searchInput).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Filtering", () => {
|
|
||||||
it("filters jobs by Name when text is entered", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("filters jobs case-insensitively", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "test job 1" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("shows all jobs when filter text is empty", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
fireEvent.change(filterInput, { target: { value: "" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Test Job 3")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("filters jobs by Status across all columns", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: CopyJobStatusType.Running } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("filters jobs by Mode across all columns", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Offline" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.queryByText("Test Job 1")).not.toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("shows no results when filter matches no jobs", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "NonExistentJob" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.queryByText("Test Job 1")).not.toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
|
||||||
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("filters by partial text match", async () => {
|
|
||||||
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Test" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
|
||||||
expect(screen.getByText("Test Job 3")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("resets pagination when filter changes", async () => {
|
|
||||||
const manyJobs: CopyJobType[] = Array.from({ length: 25 }, (_, i) => ({
|
|
||||||
...mockJobs[0],
|
|
||||||
ID: `job-${i + 1}`,
|
|
||||||
Name: `Test Job ${i + 1}`,
|
|
||||||
}));
|
|
||||||
|
|
||||||
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} pageSize={10} />);
|
|
||||||
|
|
||||||
// Navigate to page 2
|
|
||||||
fireEvent.click(screen.getByLabelText("Go to next page"));
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Showing 11 - 20 of 25 items")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Apply filter - should reset to page 1
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
// Filtered results show from the beginning
|
|
||||||
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("updates filtered count in pager", async () => {
|
|
||||||
const manyJobs: CopyJobType[] = Array.from({ length: 25 }, (_, i) => ({
|
|
||||||
...mockJobs[0],
|
|
||||||
ID: `job-${i + 1}`,
|
|
||||||
Name: i < 5 ? `Alpha Job ${i + 1}` : `Beta Job ${i + 1}`,
|
|
||||||
}));
|
|
||||||
|
|
||||||
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} pageSize={10} />);
|
|
||||||
|
|
||||||
expect(screen.getByText("Showing 1 - 10 of 25 items")).toBeInTheDocument();
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Alpha" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.queryByText("Showing 1 - 10 of 25 items")).not.toBeInTheDocument();
|
|
||||||
// Pager should not be visible since filtered results (5) are less than page size (10)
|
|
||||||
expect(screen.queryByLabelText("Go to next page")).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Pagination", () => {
|
describe("Pagination", () => {
|
||||||
@@ -509,7 +342,7 @@ describe("CopyJobsList", () => {
|
|||||||
|
|
||||||
describe("Component Props", () => {
|
describe("Component Props", () => {
|
||||||
it("uses default page size when not provided", () => {
|
it("uses default page size when not provided", () => {
|
||||||
const manyJobs: CopyJobType[] = Array.from({ length: 20 }, (_, i) => ({
|
const manyJobs: CopyJobType[] = Array.from({ length: 12 }, (_, i) => ({
|
||||||
...mockJobs[0],
|
...mockJobs[0],
|
||||||
ID: `job-${i + 1}`,
|
ID: `job-${i + 1}`,
|
||||||
Name: `Test Job ${i + 1}`,
|
Name: `Test Job ${i + 1}`,
|
||||||
@@ -518,7 +351,7 @@ describe("CopyJobsList", () => {
|
|||||||
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} />);
|
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
expect(screen.getByLabelText("Go to next page")).toBeInTheDocument();
|
expect(screen.getByLabelText("Go to next page")).toBeInTheDocument();
|
||||||
expect(screen.getByText("Showing 1 - 15 of 20 items")).toBeInTheDocument();
|
expect(screen.getByText("Showing 1 - 10 of 12 items")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes correct props to getColumns function", async () => {
|
it("passes correct props to getColumns function", async () => {
|
||||||
@@ -607,33 +440,7 @@ describe("CopyJobsList", () => {
|
|||||||
render(<CopyJobsList jobs={largeJobsList} handleActionClick={mockHandleActionClick} />);
|
render(<CopyJobsList jobs={largeJobsList} handleActionClick={mockHandleActionClick} />);
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
|
|
||||||
expect(screen.getByText("Showing 1 - 15 of 1000 items")).toBeInTheDocument();
|
expect(screen.getByText("Showing 1 - 10 of 1000 items")).toBeInTheDocument();
|
||||||
});
|
|
||||||
|
|
||||||
it("handles filtering with null or undefined values gracefully", async () => {
|
|
||||||
const jobsWithNullValues: CopyJobType[] = [
|
|
||||||
{
|
|
||||||
...mockJobs[0],
|
|
||||||
ID: "job-with-values",
|
|
||||||
Name: "Valid Job",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
...mockJobs[1],
|
|
||||||
ID: "job-null-name",
|
|
||||||
Name: undefined as unknown as string,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
expect(() => {
|
|
||||||
render(<CopyJobsList jobs={jobsWithNullValues} handleActionClick={mockHandleActionClick} />);
|
|
||||||
}).not.toThrow();
|
|
||||||
|
|
||||||
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
|
||||||
fireEvent.change(filterInput, { target: { value: "Valid" } });
|
|
||||||
|
|
||||||
await waitFor(() => {
|
|
||||||
expect(screen.getByText("Valid Job")).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Sticky,
|
Sticky,
|
||||||
StickyPositionType,
|
StickyPositionType,
|
||||||
TextField,
|
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import React, { useEffect, useMemo } from "react";
|
import React, { useEffect } from "react";
|
||||||
import Pager from "../../../../Common/Pager";
|
import Pager from "../../../../Common/Pager";
|
||||||
import { useThemeStore } from "../../../../hooks/useTheme";
|
import { useThemeStore } from "../../../../hooks/useTheme";
|
||||||
import { getThemeTokens } from "../../../Theme/ThemeUtil";
|
import { getThemeTokens } from "../../../Theme/ThemeUtil";
|
||||||
@@ -31,15 +30,9 @@ interface CopyJobsListProps {
|
|||||||
const styles = {
|
const styles = {
|
||||||
container: { height: "100%" } as React.CSSProperties,
|
container: { height: "100%" } as React.CSSProperties,
|
||||||
stackItem: { position: "relative", marginBottom: "20px" } as React.CSSProperties,
|
stackItem: { position: "relative", marginBottom: "20px" } as React.CSSProperties,
|
||||||
filterContainer: {
|
|
||||||
margin: "15px 5px",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const PAGE_SIZE = 15;
|
const PAGE_SIZE = 10;
|
||||||
|
|
||||||
// Columns to search across
|
|
||||||
const searchableFields = ["Name", "Status", "LastUpdatedTime", "Mode"];
|
|
||||||
|
|
||||||
const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pageSize = PAGE_SIZE }) => {
|
const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pageSize = PAGE_SIZE }) => {
|
||||||
const isDarkMode = useThemeStore((state) => state.isDarkMode);
|
const isDarkMode = useThemeStore((state) => state.isDarkMode);
|
||||||
@@ -48,23 +41,6 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
const [sortedJobs, setSortedJobs] = React.useState<CopyJobType[]>(jobs);
|
const [sortedJobs, setSortedJobs] = React.useState<CopyJobType[]>(jobs);
|
||||||
const [sortedColumnKey, setSortedColumnKey] = React.useState<string | undefined>(undefined);
|
const [sortedColumnKey, setSortedColumnKey] = React.useState<string | undefined>(undefined);
|
||||||
const [isSortedDescending, setIsSortedDescending] = React.useState<boolean>(false);
|
const [isSortedDescending, setIsSortedDescending] = React.useState<boolean>(false);
|
||||||
const [filterText, setFilterText] = React.useState<string>("");
|
|
||||||
|
|
||||||
const filteredJobs = useMemo(() => {
|
|
||||||
if (!filterText) {
|
|
||||||
return sortedJobs;
|
|
||||||
}
|
|
||||||
const lowerFilterText = filterText.toLowerCase();
|
|
||||||
return sortedJobs.filter((job: any) => {
|
|
||||||
return searchableFields.some((field) => {
|
|
||||||
const value = job[field];
|
|
||||||
if (value === undefined || value === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return String(value).toLowerCase().includes(lowerFilterText);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, [sortedJobs, filterText]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSortedJobs(jobs);
|
setSortedJobs(jobs);
|
||||||
@@ -88,15 +64,7 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
setStartIndex(0);
|
setStartIndex(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortableColumns: IColumn[] = getColumns(handleSort, handleActionClick, sortedColumnKey, isSortedDescending);
|
const columns: IColumn[] = getColumns(handleSort, handleActionClick, sortedColumnKey, isSortedDescending);
|
||||||
|
|
||||||
const handleFilterTextChange = (
|
|
||||||
_event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
|
|
||||||
newValue?: string,
|
|
||||||
) => {
|
|
||||||
setFilterText(newValue || "");
|
|
||||||
setStartIndex(0);
|
|
||||||
};
|
|
||||||
|
|
||||||
const _handleRowClick = (job: CopyJobType) => {
|
const _handleRowClick = (job: CopyJobType) => {
|
||||||
openCopyJobDetailsPanel(job);
|
openCopyJobDetailsPanel(job);
|
||||||
@@ -113,25 +81,14 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
return (
|
return (
|
||||||
<div style={styles.container}>
|
<div style={styles.container}>
|
||||||
<Stack verticalFill={true}>
|
<Stack verticalFill={true}>
|
||||||
<Stack.Item>
|
|
||||||
<div style={styles.filterContainer}>
|
|
||||||
<TextField
|
|
||||||
data-test="CopyJobsList/FilterTextField"
|
|
||||||
placeholder="Search jobs..."
|
|
||||||
ariaLabel="Search jobs"
|
|
||||||
value={filterText}
|
|
||||||
onChange={handleFilterTextChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Stack.Item>
|
|
||||||
<Stack.Item verticalFill={true} grow={1} shrink={1} style={styles.stackItem}>
|
<Stack.Item verticalFill={true} grow={1} shrink={1} style={styles.stackItem}>
|
||||||
<ScrollablePane scrollbarVisibility={ScrollbarVisibility.auto}>
|
<ScrollablePane scrollbarVisibility={ScrollbarVisibility.auto}>
|
||||||
<ShimmeredDetailsList
|
<ShimmeredDetailsList
|
||||||
className="CopyJobListContainer"
|
className="CopyJobListContainer"
|
||||||
onRenderRow={_onRenderRow}
|
onRenderRow={_onRenderRow}
|
||||||
checkboxVisibility={2}
|
checkboxVisibility={2}
|
||||||
columns={sortableColumns}
|
columns={columns}
|
||||||
items={filteredJobs.slice(startIndex, startIndex + pageSize)}
|
items={sortedJobs.slice(startIndex, startIndex + pageSize)}
|
||||||
enableShimmer={false}
|
enableShimmer={false}
|
||||||
constrainMode={ConstrainMode.unconstrained}
|
constrainMode={ConstrainMode.unconstrained}
|
||||||
layoutMode={DetailsListLayoutMode.justified}
|
layoutMode={DetailsListLayoutMode.justified}
|
||||||
@@ -160,12 +117,12 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
/>
|
/>
|
||||||
</ScrollablePane>
|
</ScrollablePane>
|
||||||
</Stack.Item>
|
</Stack.Item>
|
||||||
{filteredJobs.length > pageSize && (
|
{sortedJobs.length > pageSize && (
|
||||||
<Stack.Item>
|
<Stack.Item>
|
||||||
<Pager
|
<Pager
|
||||||
disabled={false}
|
disabled={false}
|
||||||
startIndex={startIndex}
|
startIndex={startIndex}
|
||||||
totalCount={filteredJobs.length}
|
totalCount={sortedJobs.length}
|
||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
onLoadPage={(startIdx /* pageSize */) => {
|
onLoadPage={(startIdx /* pageSize */) => {
|
||||||
setStartIndex(startIdx);
|
setStartIndex(startIdx);
|
||||||
|
|||||||
@@ -1,27 +1,5 @@
|
|||||||
@import "../../../less/Common/Constants.less";
|
@import "../../../less/Common/Constants.less";
|
||||||
|
|
||||||
.themedTextFieldStyles() {
|
|
||||||
.ms-TextField {
|
|
||||||
.ms-TextField-fieldGroup {
|
|
||||||
background-color: var(--colorNeutralBackground1);
|
|
||||||
border-color: var(--colorNeutralStroke1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-TextField-field {
|
|
||||||
color: var(--colorNeutralForeground1);
|
|
||||||
background-color: var(--colorNeutralBackground1);
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
color: var(--colorNeutralForeground4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-Label {
|
|
||||||
color: var(--colorNeutralForeground1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common theme-aware classes
|
// Common theme-aware classes
|
||||||
.themeText {
|
.themeText {
|
||||||
color: var(--colorNeutralForeground1);
|
color: var(--colorNeutralForeground1);
|
||||||
@@ -141,8 +119,25 @@
|
|||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.themedTextFieldStyles();
|
.ms-TextField {
|
||||||
|
.ms-TextField-fieldGroup {
|
||||||
|
background-color: var(--colorNeutralBackground1);
|
||||||
|
border-color: var(--colorNeutralStroke1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-TextField-field {
|
||||||
|
color: var(--colorNeutralForeground1);
|
||||||
|
background-color: var(--colorNeutralBackground1);
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--colorNeutralForeground4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-Label {
|
||||||
|
color: var(--colorNeutralForeground1);
|
||||||
|
}
|
||||||
|
}
|
||||||
.migrationTypeDescription {
|
.migrationTypeDescription {
|
||||||
p {
|
p {
|
||||||
color: var(--colorNeutralForeground1);
|
color: var(--colorNeutralForeground1);
|
||||||
@@ -178,11 +173,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
body.isDarkMode & {
|
|
||||||
.themedTextFieldStyles();
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-DetailsList {
|
.ms-DetailsList {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|||||||
88
src/NotebookViewer/NotebookViewer.tsx
Normal file
88
src/NotebookViewer/NotebookViewer.tsx
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
import { initializeIcons } from "@fluentui/react";
|
||||||
|
import "bootstrap/dist/css/bootstrap.css";
|
||||||
|
import React from "react";
|
||||||
|
import * as ReactDOM from "react-dom";
|
||||||
|
import { configContext, initializeConfiguration } from "../ConfigContext";
|
||||||
|
import { GalleryHeaderComponent } from "../Explorer/Controls/Header/GalleryHeaderComponent";
|
||||||
|
import { GalleryTab } from "../Explorer/Controls/NotebookGallery/GalleryViewerComponent";
|
||||||
|
import {
|
||||||
|
NotebookViewerComponent,
|
||||||
|
NotebookViewerComponentProps,
|
||||||
|
} from "../Explorer/Controls/NotebookViewer/NotebookViewerComponent";
|
||||||
|
import * as FileSystemUtil from "../Explorer/Notebook/FileSystemUtil";
|
||||||
|
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
||||||
|
import * as GalleryUtils from "../Utils/GalleryUtils";
|
||||||
|
|
||||||
|
const onInit = async () => {
|
||||||
|
initializeIcons();
|
||||||
|
await initializeConfiguration();
|
||||||
|
const galleryViewerProps = GalleryUtils.getGalleryViewerProps(window.location.search);
|
||||||
|
const notebookViewerProps = GalleryUtils.getNotebookViewerProps(window.location.search);
|
||||||
|
let backNavigationText: string;
|
||||||
|
let onBackClick: () => void;
|
||||||
|
if (galleryViewerProps.selectedTab !== undefined) {
|
||||||
|
backNavigationText = GalleryUtils.getTabTitle(galleryViewerProps.selectedTab);
|
||||||
|
onBackClick = () =>
|
||||||
|
(window.location.href = `${configContext.hostedExplorerURL}gallery.html?tab=${
|
||||||
|
GalleryTab[galleryViewerProps.selectedTab]
|
||||||
|
}`);
|
||||||
|
}
|
||||||
|
const hideInputs = notebookViewerProps.hideInputs;
|
||||||
|
|
||||||
|
const notebookUrl = decodeURIComponent(notebookViewerProps.notebookUrl);
|
||||||
|
|
||||||
|
const galleryItemId = notebookViewerProps.galleryItemId;
|
||||||
|
let galleryItem: IGalleryItem;
|
||||||
|
|
||||||
|
if (galleryItemId) {
|
||||||
|
const junoClient = new JunoClient();
|
||||||
|
const galleryItemJunoResponse = await junoClient.getNotebookInfo(galleryItemId);
|
||||||
|
galleryItem = galleryItemJunoResponse.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The main purpose of hiding the prompt is to hide everything when hiding inputs.
|
||||||
|
// It is generally not very useful to just hide the prompt.
|
||||||
|
const hidePrompts = hideInputs;
|
||||||
|
|
||||||
|
render(notebookUrl, backNavigationText, hideInputs, hidePrompts, galleryItem, onBackClick);
|
||||||
|
};
|
||||||
|
|
||||||
|
const render = (
|
||||||
|
notebookUrl: string,
|
||||||
|
backNavigationText: string,
|
||||||
|
hideInputs?: boolean,
|
||||||
|
hidePrompts?: boolean,
|
||||||
|
galleryItem?: IGalleryItem,
|
||||||
|
onBackClick?: () => void,
|
||||||
|
) => {
|
||||||
|
const props: NotebookViewerComponentProps = {
|
||||||
|
junoClient: galleryItem ? new JunoClient() : undefined,
|
||||||
|
notebookUrl,
|
||||||
|
galleryItem,
|
||||||
|
backNavigationText,
|
||||||
|
hideInputs,
|
||||||
|
hidePrompts,
|
||||||
|
onBackClick: onBackClick,
|
||||||
|
onTagClick: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (galleryItem) {
|
||||||
|
document.title = FileSystemUtil.stripExtension(galleryItem.name, "ipynb");
|
||||||
|
}
|
||||||
|
|
||||||
|
const element = (
|
||||||
|
<>
|
||||||
|
<header>
|
||||||
|
<GalleryHeaderComponent />
|
||||||
|
</header>
|
||||||
|
<div style={{ marginLeft: 120, marginRight: 120 }}>
|
||||||
|
<NotebookViewerComponent {...props} />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
ReactDOM.render(element, document.getElementById("notebookContent"));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Entry point
|
||||||
|
window.addEventListener("load", onInit);
|
||||||
@@ -94,7 +94,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
notebookBasePath: get("notebookbasepath"),
|
notebookBasePath: get("notebookbasepath"),
|
||||||
notebookServerToken: get("notebookservertoken"),
|
notebookServerToken: get("notebookservertoken"),
|
||||||
notebookServerUrl: get("notebookserverurl"),
|
notebookServerUrl: get("notebookserverurl"),
|
||||||
sandboxNotebookOutputs: true,
|
sandboxNotebookOutputs: "true" === get("sandboxnotebookoutputs", "true"),
|
||||||
selfServeType: get("selfservetype"),
|
selfServeType: get("selfservetype"),
|
||||||
showMinRUSurvey: "true" === get("showminrusurvey"),
|
showMinRUSurvey: "true" === get("showminrusurvey"),
|
||||||
ttl90Days: "true" === get("ttl90days"),
|
ttl90Days: "true" === get("ttl90days"),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe("AuthorizationUtils", () => {
|
|||||||
enableKoResourceTree: false,
|
enableKoResourceTree: false,
|
||||||
enableThroughputBuckets: false,
|
enableThroughputBuckets: false,
|
||||||
hostedDataExplorer: false,
|
hostedDataExplorer: false,
|
||||||
sandboxNotebookOutputs: true,
|
sandboxNotebookOutputs: false,
|
||||||
showMinRUSurvey: false,
|
showMinRUSurvey: false,
|
||||||
ttl90Days: false,
|
ttl90Days: false,
|
||||||
enableThroughputCap: false,
|
enableThroughputCap: false,
|
||||||
|
|||||||
29
test/fx.ts
29
test/fx.ts
@@ -39,6 +39,7 @@ export enum TestAccount {
|
|||||||
MongoReadonly = "MongoReadOnly",
|
MongoReadonly = "MongoReadOnly",
|
||||||
Mongo32 = "Mongo32",
|
Mongo32 = "Mongo32",
|
||||||
SQL = "SQL",
|
SQL = "SQL",
|
||||||
|
SQL2 = "SQL2",
|
||||||
SQLReadOnly = "SQLReadOnly",
|
SQLReadOnly = "SQLReadOnly",
|
||||||
SQLContainerCopyOnly = "SQLContainerCopyOnly",
|
SQLContainerCopyOnly = "SQLContainerCopyOnly",
|
||||||
}
|
}
|
||||||
@@ -51,6 +52,7 @@ export const defaultAccounts: Record<TestAccount, string> = {
|
|||||||
[TestAccount.MongoReadonly]: "github-e2etests-mongo-readonly",
|
[TestAccount.MongoReadonly]: "github-e2etests-mongo-readonly",
|
||||||
[TestAccount.Mongo32]: "github-e2etests-mongo32",
|
[TestAccount.Mongo32]: "github-e2etests-mongo32",
|
||||||
[TestAccount.SQL]: "github-e2etests-sql",
|
[TestAccount.SQL]: "github-e2etests-sql",
|
||||||
|
[TestAccount.SQL2]: "github-e2etests-sql-2",
|
||||||
[TestAccount.SQLReadOnly]: "github-e2etests-sql-readonly",
|
[TestAccount.SQLReadOnly]: "github-e2etests-sql-readonly",
|
||||||
[TestAccount.SQLContainerCopyOnly]: "github-e2etests-sql-containercopyonly",
|
[TestAccount.SQLContainerCopyOnly]: "github-e2etests-sql-containercopyonly",
|
||||||
};
|
};
|
||||||
@@ -72,6 +74,9 @@ function tryGetStandardName(accountType: TestAccount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getAccountName(accountType: TestAccount) {
|
export function getAccountName(accountType: TestAccount) {
|
||||||
|
if (accountType === TestAccount.SQL2 && !process.env.CI) {
|
||||||
|
accountType = TestAccount.SQL;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
process.env[`DE_TEST_ACCOUNT_NAME_${accountType.toLocaleUpperCase()}`] ??
|
process.env[`DE_TEST_ACCOUNT_NAME_${accountType.toLocaleUpperCase()}`] ??
|
||||||
tryGetStandardName(accountType) ??
|
tryGetStandardName(accountType) ??
|
||||||
@@ -101,6 +106,7 @@ export async function getTestExplorerUrl(accountType: TestAccount, options?: Tes
|
|||||||
params.set("feature.enableCopilot", "false");
|
params.set("feature.enableCopilot", "false");
|
||||||
|
|
||||||
const nosqlRbacToken = process.env.NOSQL_TESTACCOUNT_TOKEN;
|
const nosqlRbacToken = process.env.NOSQL_TESTACCOUNT_TOKEN;
|
||||||
|
const nosql2RbacToken = process.env.NOSQL2_TESTACCOUNT_TOKEN;
|
||||||
const nosqlReadOnlyRbacToken = process.env.NOSQL_READONLY_TESTACCOUNT_TOKEN;
|
const nosqlReadOnlyRbacToken = process.env.NOSQL_READONLY_TESTACCOUNT_TOKEN;
|
||||||
const nosqlContainerCopyRbacToken = process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN;
|
const nosqlContainerCopyRbacToken = process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN;
|
||||||
const tableRbacToken = process.env.TABLE_TESTACCOUNT_TOKEN;
|
const tableRbacToken = process.env.TABLE_TESTACCOUNT_TOKEN;
|
||||||
@@ -117,7 +123,12 @@ export async function getTestExplorerUrl(accountType: TestAccount, options?: Tes
|
|||||||
params.set("enableaaddataplane", "true");
|
params.set("enableaaddataplane", "true");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TestAccount.SQL2:
|
||||||
|
if (nosql2RbacToken) {
|
||||||
|
params.set("nosql2RbacToken", nosql2RbacToken);
|
||||||
|
params.set("enableaaddataplane", "true");
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TestAccount.SQLContainerCopyOnly:
|
case TestAccount.SQLContainerCopyOnly:
|
||||||
if (nosqlContainerCopyRbacToken) {
|
if (nosqlContainerCopyRbacToken) {
|
||||||
params.set("nosqlRbacToken", nosqlContainerCopyRbacToken);
|
params.set("nosqlRbacToken", nosqlContainerCopyRbacToken);
|
||||||
@@ -515,14 +526,14 @@ export class DataExplorer {
|
|||||||
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
const containerNode = await this.waitForContainerNode(context.database.id, context.container.id);
|
||||||
await containerNode.expand();
|
await containerNode.expand();
|
||||||
|
|
||||||
// refresh tree to remove deleted database
|
// // refresh tree to remove deleted database
|
||||||
const consoleMessages = await this.getNotificationConsoleMessages();
|
// const consoleMessages = await this.getNotificationConsoleMessages();
|
||||||
const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
|
// const refreshButton = this.frame.getByTestId("Sidebar/RefreshButton");
|
||||||
await refreshButton.click();
|
// await refreshButton.click();
|
||||||
await expect(consoleMessages).toContainText("Successfully refreshed databases", {
|
// await expect(consoleMessages).toContainText("Successfully refreshed databases", {
|
||||||
timeout: ONE_MINUTE_MS,
|
// timeout: ONE_MINUTE_MS,
|
||||||
});
|
// });
|
||||||
await this.collapseNotificationConsole();
|
// await this.collapseNotificationConsole();
|
||||||
|
|
||||||
const scaleAndSettingsButton = this.frame.getByTestId(
|
const scaleAndSettingsButton = this.frame.getByTestId(
|
||||||
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
`TreeNode:${context.database.id}/${context.container.id}/Scale & Settings`,
|
||||||
|
|||||||
@@ -1,262 +1,258 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
// import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||||
import { truncateName } from "../../../src/Explorer/ContainerCopy/CopyJobUtils";
|
// import { truncateName } from "../../../src/Explorer/ContainerCopy/CopyJobUtils";
|
||||||
import {
|
// import {
|
||||||
ContainerCopy,
|
// ContainerCopy,
|
||||||
getAccountName,
|
// getAccountName,
|
||||||
getDropdownItemByNameOrPosition,
|
// getDropdownItemByNameOrPosition,
|
||||||
interceptAndInspectApiRequest,
|
// interceptAndInspectApiRequest,
|
||||||
TestAccount,
|
// TestAccount,
|
||||||
waitForApiResponse,
|
// waitForApiResponse,
|
||||||
} from "../../fx";
|
// } from "../../fx";
|
||||||
import { createMultipleTestContainers } from "../../testData";
|
// import { createMultipleTestContainers } from "../../testData";
|
||||||
|
|
||||||
test.describe("Container Copy - Offline Migration", () => {
|
// test.describe("Container Copy - Offline Migration", () => {
|
||||||
let page: Page;
|
// let page: Page;
|
||||||
let wrapper: Locator;
|
// let wrapper: Locator;
|
||||||
let panel: Locator;
|
// let panel: Locator;
|
||||||
let frame: Frame;
|
// let frame: Frame;
|
||||||
let expectedJobName: string;
|
// let expectedJobName: string;
|
||||||
let targetAccountName: string;
|
// let targetAccountName: string;
|
||||||
let expectedSubscriptionName: string;
|
// let expectedSubscriptionName: string;
|
||||||
let expectedCopyJobNameInitial: string;
|
// let expectedCopyJobNameInitial: string;
|
||||||
|
|
||||||
test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
// test.beforeEach("Setup for offline migration test", async ({ browser }) => {
|
||||||
await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
// await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||||
|
|
||||||
page = await browser.newPage();
|
// page = await browser.newPage();
|
||||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||||
expectedJobName = `offline_test_job_${Date.now()}`;
|
// expectedJobName = `offline_test_job_${Date.now()}`;
|
||||||
targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
// targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||||
});
|
// });
|
||||||
|
|
||||||
test.afterEach("Cleanup after offline migration test", async () => {
|
// test.afterEach("Cleanup after offline migration test", async () => {
|
||||||
await page.unroute(/.*/, (route) => route.continue());
|
// await page.unroute(/.*/, (route) => route.continue());
|
||||||
await page.close();
|
// await page.close();
|
||||||
});
|
// });
|
||||||
|
|
||||||
test("Successfully create and manage offline migration copy job", async () => {
|
// test("Successfully create and manage offline migration copy job", async () => {
|
||||||
expect(wrapper).not.toBeNull();
|
// expect(wrapper).not.toBeNull();
|
||||||
await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
// await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||||
|
|
||||||
// Open Create Copy Job panel
|
// // Open Create Copy Job panel
|
||||||
const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
// const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||||
await expect(createCopyJobButton).toBeVisible();
|
// await expect(createCopyJobButton).toBeVisible();
|
||||||
await createCopyJobButton.click();
|
// await createCopyJobButton.click();
|
||||||
panel = frame.getByTestId("Panel:Create copy job");
|
// panel = frame.getByTestId("Panel:Create copy job");
|
||||||
await expect(panel).toBeVisible();
|
// await expect(panel).toBeVisible();
|
||||||
|
|
||||||
// Reduced wait time for better performance
|
// // Reduced wait time for better performance
|
||||||
await page.waitForTimeout(2000);
|
// await page.waitForTimeout(2000);
|
||||||
|
|
||||||
// Setup subscription and account
|
// // Setup subscription and account
|
||||||
const subscriptionDropdown = panel.getByTestId("subscription-dropdown");
|
// const subscriptionDropdown = panel.getByTestId("subscription-dropdown");
|
||||||
const expectedAccountName = targetAccountName;
|
// const expectedAccountName = targetAccountName;
|
||||||
expectedSubscriptionName = await subscriptionDropdown.locator("span.ms-Dropdown-title").innerText();
|
// expectedSubscriptionName = await subscriptionDropdown.locator("span.ms-Dropdown-title").innerText();
|
||||||
|
|
||||||
await subscriptionDropdown.click();
|
// await subscriptionDropdown.click();
|
||||||
const subscriptionItem = await getDropdownItemByNameOrPosition(
|
// const subscriptionItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ name: expectedSubscriptionName },
|
// { name: expectedSubscriptionName },
|
||||||
{ ariaLabel: "Subscription" },
|
// { ariaLabel: "Subscription" },
|
||||||
);
|
// );
|
||||||
await subscriptionItem.click();
|
// await subscriptionItem.click();
|
||||||
|
|
||||||
// Select account
|
// // Select account
|
||||||
const accountDropdown = panel.getByTestId("account-dropdown");
|
// const accountDropdown = panel.getByTestId("account-dropdown");
|
||||||
await expect(accountDropdown).toHaveText(new RegExp(expectedAccountName));
|
// await expect(accountDropdown).toHaveText(new RegExp(expectedAccountName));
|
||||||
await accountDropdown.click();
|
// await accountDropdown.click();
|
||||||
|
|
||||||
const accountItem = await getDropdownItemByNameOrPosition(
|
// const accountItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ name: expectedAccountName },
|
// { name: expectedAccountName },
|
||||||
{ ariaLabel: "Account" },
|
// { ariaLabel: "Account" },
|
||||||
);
|
// );
|
||||||
await accountItem.click();
|
// await accountItem.click();
|
||||||
|
|
||||||
// Test offline migration mode toggle functionality
|
// // Test offline migration mode toggle functionality
|
||||||
const migrationTypeContainer = panel.getByTestId("migration-type");
|
// const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||||
|
|
||||||
// First test online mode (should show permissions screen)
|
// // First test online mode (should show permissions screen)
|
||||||
const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
// const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||||
await onlineCopyRadioButton.click({ force: true });
|
// await onlineCopyRadioButton.click({ force: true });
|
||||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
// await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).toBeVisible();
|
// await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).toBeVisible();
|
||||||
await expect(panel.getByText("Online container copy", { exact: true })).toBeVisible();
|
// await expect(panel.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||||
|
|
||||||
// Go back and switch to offline mode
|
// // Go back and switch to offline mode
|
||||||
await panel.getByRole("button", { name: "Previous" }).click();
|
// await panel.getByRole("button", { name: "Previous" }).click();
|
||||||
|
|
||||||
const offlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Offline mode/i });
|
// const offlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Offline mode/i });
|
||||||
await offlineCopyRadioButton.click({ force: true });
|
// await offlineCopyRadioButton.click({ force: true });
|
||||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-offline")).toBeVisible();
|
// await expect(migrationTypeContainer.getByTestId("migration-type-description-offline")).toBeVisible();
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Verify we skip permissions screen in offline mode
|
// // Verify we skip permissions screen in offline mode
|
||||||
await expect(panel.getByTestId("Panel:SelectSourceAndTargetContainers")).toBeVisible();
|
// await expect(panel.getByTestId("Panel:SelectSourceAndTargetContainers")).toBeVisible();
|
||||||
await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).not.toBeVisible();
|
// await expect(panel.getByTestId("Panel:AssignPermissionsContainer")).not.toBeVisible();
|
||||||
|
|
||||||
// Test source and target container selection with validation
|
// // Test source and target container selection with validation
|
||||||
const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
// const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||||
expect(sourceContainerDropdown).toBeVisible();
|
// expect(sourceContainerDropdown).toBeVisible();
|
||||||
await expect(sourceContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(sourceContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
|
|
||||||
// Select source database first (containers are disabled until database is selected)
|
// // Select source database first (containers are disabled until database is selected)
|
||||||
const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
// const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||||
await sourceDatabaseDropdown.click();
|
// await sourceDatabaseDropdown.click();
|
||||||
const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
// const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Database" },
|
// { ariaLabel: "Database" },
|
||||||
);
|
// );
|
||||||
await sourceDbDropdownItem.click();
|
// await sourceDbDropdownItem.click();
|
||||||
|
|
||||||
// Now container dropdown should be enabled
|
// // Now container dropdown should be enabled
|
||||||
await expect(sourceContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(sourceContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
await sourceContainerDropdown.click();
|
// await sourceContainerDropdown.click();
|
||||||
const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
// const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Container" },
|
// { ariaLabel: "Container" },
|
||||||
);
|
// );
|
||||||
await sourceContainerDropdownItem.click();
|
// await sourceContainerDropdownItem.click();
|
||||||
|
|
||||||
// Test target container selection
|
// // Test target container selection
|
||||||
const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
// const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||||
expect(targetContainerDropdown).toBeVisible();
|
// expect(targetContainerDropdown).toBeVisible();
|
||||||
await expect(targetContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(targetContainerDropdown).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
|
|
||||||
const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
// const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||||
await targetDatabaseDropdown.click();
|
// await targetDatabaseDropdown.click();
|
||||||
const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
// const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Database" },
|
// { ariaLabel: "Database" },
|
||||||
);
|
// );
|
||||||
await targetDbDropdownItem.click();
|
// await targetDbDropdownItem.click();
|
||||||
|
|
||||||
await expect(targetContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(targetContainerDropdown).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
await targetContainerDropdown.click();
|
// await targetContainerDropdown.click();
|
||||||
|
|
||||||
// First try selecting the same container (should show error)
|
// // First try selecting the same container (should show error)
|
||||||
const targetContainerDropdownItem1 = await getDropdownItemByNameOrPosition(
|
// const targetContainerDropdownItem1 = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Container" },
|
// { ariaLabel: "Container" },
|
||||||
);
|
// );
|
||||||
await targetContainerDropdownItem1.click();
|
// await targetContainerDropdownItem1.click();
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Verify validation error for same source and target containers
|
// // Verify validation error for same source and target containers
|
||||||
const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
// const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||||
await expect(errorContainer).toBeVisible();
|
// await expect(errorContainer).toBeVisible();
|
||||||
await expect(errorContainer).toHaveText(/Source and destination containers cannot be the same/i);
|
// await expect(errorContainer).toHaveText(/Source and destination containers cannot be the same/i);
|
||||||
|
|
||||||
// Select different target container
|
// // Select different target container
|
||||||
await targetContainerDropdown.click();
|
// await targetContainerDropdown.click();
|
||||||
const targetContainerDropdownItem2 = await getDropdownItemByNameOrPosition(
|
// const targetContainerDropdownItem2 = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 1 },
|
// { position: 1 },
|
||||||
{ ariaLabel: "Container" },
|
// { ariaLabel: "Container" },
|
||||||
);
|
// );
|
||||||
await targetContainerDropdownItem2.click();
|
// await targetContainerDropdownItem2.click();
|
||||||
|
|
||||||
// Generate expected job name based on selections
|
// // Generate expected job name based on selections
|
||||||
const selectedSourceDatabase = await sourceDatabaseDropdown.innerText();
|
// const selectedSourceDatabase = await sourceDatabaseDropdown.innerText();
|
||||||
const selectedSourceContainer = await sourceContainerDropdown.innerText();
|
// const selectedSourceContainer = await sourceContainerDropdown.innerText();
|
||||||
const selectedTargetDatabase = await targetDatabaseDropdown.innerText();
|
// const selectedTargetDatabase = await targetDatabaseDropdown.innerText();
|
||||||
const selectedTargetContainer = await targetContainerDropdown.innerText();
|
// const selectedTargetContainer = await targetContainerDropdown.innerText();
|
||||||
expectedCopyJobNameInitial = `${truncateName(selectedSourceDatabase)}.${truncateName(
|
// expectedCopyJobNameInitial = `${truncateName(selectedSourceDatabase)}.${truncateName(
|
||||||
selectedSourceContainer,
|
// selectedSourceContainer,
|
||||||
)}_${truncateName(selectedTargetDatabase)}.${truncateName(selectedTargetContainer)}`;
|
// )}_${truncateName(selectedTargetDatabase)}.${truncateName(selectedTargetContainer)}`;
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Error should disappear and preview should be visible
|
// // Error should disappear and preview should be visible
|
||||||
await expect(errorContainer).not.toBeVisible();
|
// await expect(errorContainer).not.toBeVisible();
|
||||||
await expect(panel.getByTestId("Panel:PreviewCopyJob")).toBeVisible();
|
// await expect(panel.getByTestId("Panel:PreviewCopyJob")).toBeVisible();
|
||||||
|
|
||||||
// Verify job preview details
|
// // Verify job preview details
|
||||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
// const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||||
await expect(previewContainer).toBeVisible();
|
// await expect(previewContainer).toBeVisible();
|
||||||
await expect(previewContainer.getByTestId("source-subscription-name")).toHaveText(expectedSubscriptionName);
|
// await expect(previewContainer.getByTestId("source-subscription-name")).toHaveText(expectedSubscriptionName);
|
||||||
await expect(previewContainer.getByTestId("source-account-name")).toHaveText(expectedAccountName);
|
// await expect(previewContainer.getByTestId("source-account-name")).toHaveText(expectedAccountName);
|
||||||
|
|
||||||
const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
// const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||||
await expect(jobNameInput).toHaveValue(new RegExp(expectedCopyJobNameInitial));
|
// await expect(jobNameInput).toHaveValue(new RegExp(expectedCopyJobNameInitial));
|
||||||
|
|
||||||
const primaryBtn = panel.getByRole("button", { name: "Copy", exact: true });
|
// const primaryBtn = panel.getByRole("button", { name: "Copy", exact: true });
|
||||||
await expect(primaryBtn).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(primaryBtn).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
|
|
||||||
// Test invalid job name validation (spaces not allowed)
|
// // Test invalid job name validation (spaces not allowed)
|
||||||
await jobNameInput.fill("test job name");
|
// await jobNameInput.fill("test job name");
|
||||||
await expect(primaryBtn).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(primaryBtn).toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
|
|
||||||
// Test duplicate job name error handling
|
// // Test duplicate job name error handling
|
||||||
const duplicateJobName = "test-job-name-1";
|
// const duplicateJobName = "test-job-name-1";
|
||||||
await jobNameInput.fill(duplicateJobName);
|
// await jobNameInput.fill(duplicateJobName);
|
||||||
|
|
||||||
const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
// const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||||
const expectedErrorMessage = `Duplicate job name '${duplicateJobName}'`;
|
// const expectedErrorMessage = `Duplicate job name '${duplicateJobName}'`;
|
||||||
|
|
||||||
await interceptAndInspectApiRequest(
|
// await interceptAndInspectApiRequest(
|
||||||
page,
|
// page,
|
||||||
`${expectedAccountName}/dataTransferJobs/${duplicateJobName}`,
|
// `${expectedAccountName}/dataTransferJobs/${duplicateJobName}`,
|
||||||
"PUT",
|
// "PUT",
|
||||||
new Error(expectedErrorMessage),
|
// new Error(expectedErrorMessage),
|
||||||
(url?: string) => url?.includes(duplicateJobName) ?? false,
|
// (url?: string) => url?.includes(duplicateJobName) ?? false,
|
||||||
);
|
// );
|
||||||
|
|
||||||
let errorThrown = false;
|
// let errorThrown = false;
|
||||||
try {
|
// try {
|
||||||
await copyButton.click();
|
// await copyButton.click();
|
||||||
await page.waitForTimeout(2000);
|
// await page.waitForTimeout(2000);
|
||||||
} catch (error: any) {
|
// } catch (error: any) {
|
||||||
errorThrown = true;
|
// errorThrown = true;
|
||||||
expect(error.message).toContain("not allowed");
|
// expect(error.message).toContain("not allowed");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!errorThrown) {
|
// if (!errorThrown) {
|
||||||
const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
// const errorContainer = panel.getByTestId("Panel:ErrorContainer");
|
||||||
await expect(errorContainer).toBeVisible();
|
// await expect(errorContainer).toBeVisible();
|
||||||
await expect(errorContainer).toHaveText(new RegExp(expectedErrorMessage, "i"));
|
// await expect(errorContainer).toHaveText(new RegExp(expectedErrorMessage, "i"));
|
||||||
}
|
// }
|
||||||
|
|
||||||
await expect(panel).toBeVisible();
|
// await expect(panel).toBeVisible();
|
||||||
|
|
||||||
// Test successful job creation with valid job name
|
// // Test successful job creation with valid job name
|
||||||
const validJobName = expectedJobName;
|
// const validJobName = expectedJobName;
|
||||||
|
|
||||||
const copyJobCreationPromise = waitForApiResponse(
|
// const copyJobCreationPromise = waitForApiResponse(
|
||||||
page,
|
// page,
|
||||||
`${expectedAccountName}/dataTransferJobs/${validJobName}`,
|
// `${expectedAccountName}/dataTransferJobs/${validJobName}`,
|
||||||
"PUT",
|
// "PUT",
|
||||||
);
|
// );
|
||||||
|
|
||||||
await jobNameInput.fill(validJobName);
|
// await jobNameInput.fill(validJobName);
|
||||||
await expect(copyButton).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
// await expect(copyButton).not.toHaveClass(/(^|\s)is-disabled(\s|$)/);
|
||||||
|
|
||||||
await copyButton.click();
|
// await copyButton.click();
|
||||||
|
|
||||||
const response = await copyJobCreationPromise;
|
// const response = await copyJobCreationPromise;
|
||||||
expect(response.ok()).toBe(true);
|
// expect(response.ok()).toBe(true);
|
||||||
|
|
||||||
// Verify panel closes and job appears in the list
|
// // Verify panel closes and job appears in the list
|
||||||
await expect(panel).not.toBeVisible();
|
// await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||||
|
|
||||||
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||||
await filterTextField.waitFor({ state: "visible" });
|
// await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||||
await filterTextField.fill(validJobName);
|
|
||||||
|
|
||||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
// const jobItem = jobsListContainer.getByText(validJobName);
|
||||||
await jobsListContainer.waitFor({ state: "visible" });
|
// await jobItem.waitFor({ state: "visible", timeout: 5000 });
|
||||||
|
// await expect(jobItem).toBeVisible();
|
||||||
const jobItem = jobsListContainer.getByText(validJobName);
|
// });
|
||||||
await jobItem.waitFor({ state: "visible" });
|
// });
|
||||||
await expect(jobItem).toBeVisible();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,189 +1,185 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
// /* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
// import { expect, Frame, Locator, Page, test } from "@playwright/test";
|
||||||
import {
|
// import {
|
||||||
ContainerCopy,
|
// ContainerCopy,
|
||||||
getAccountName,
|
// getAccountName,
|
||||||
getDropdownItemByNameOrPosition,
|
// getDropdownItemByNameOrPosition,
|
||||||
TestAccount,
|
// TestAccount,
|
||||||
waitForApiResponse,
|
// waitForApiResponse,
|
||||||
} from "../../fx";
|
// } from "../../fx";
|
||||||
import { createMultipleTestContainers } from "../../testData";
|
// import { createMultipleTestContainers } from "../../testData";
|
||||||
|
|
||||||
test.describe("Container Copy - Online Migration", () => {
|
// test.describe("Container Copy - Online Migration", () => {
|
||||||
let page: Page;
|
// let page: Page;
|
||||||
let wrapper: Locator;
|
// let wrapper: Locator;
|
||||||
let panel: Locator;
|
// let panel: Locator;
|
||||||
let frame: Frame;
|
// let frame: Frame;
|
||||||
let targetAccountName: string;
|
// let targetAccountName: string;
|
||||||
|
|
||||||
test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
// test.beforeEach("Setup for online migration test", async ({ browser }) => {
|
||||||
await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
// await createMultipleTestContainers({ accountType: TestAccount.SQLContainerCopyOnly, containerCount: 2 });
|
||||||
|
|
||||||
page = await browser.newPage();
|
// page = await browser.newPage();
|
||||||
({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
// ({ wrapper, frame } = await ContainerCopy.open(page, TestAccount.SQLContainerCopyOnly));
|
||||||
targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
// targetAccountName = getAccountName(TestAccount.SQLContainerCopyOnly);
|
||||||
});
|
// });
|
||||||
|
|
||||||
test.afterEach("Cleanup after online migration test", async () => {
|
// test.afterEach("Cleanup after online migration test", async () => {
|
||||||
await page.unroute(/.*/, (route) => route.continue());
|
// await page.unroute(/.*/, (route) => route.continue());
|
||||||
await page.close();
|
// await page.close();
|
||||||
});
|
// });
|
||||||
|
|
||||||
test("Successfully create and manage online migration copy job", async () => {
|
// test("Successfully create and manage online migration copy job", async () => {
|
||||||
expect(wrapper).not.toBeNull();
|
// expect(wrapper).not.toBeNull();
|
||||||
await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
// await wrapper.locator(".commandBarContainer").waitFor({ state: "visible" });
|
||||||
|
|
||||||
// Open Create Copy Job panel
|
// // Open Create Copy Job panel
|
||||||
const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
// const createCopyJobButton = wrapper.getByTestId("CommandBar/Button:Create Copy Job");
|
||||||
await expect(createCopyJobButton).toBeVisible();
|
// await expect(createCopyJobButton).toBeVisible();
|
||||||
await createCopyJobButton.click();
|
// await createCopyJobButton.click();
|
||||||
panel = frame.getByTestId("Panel:Create copy job");
|
// panel = frame.getByTestId("Panel:Create copy job");
|
||||||
await expect(panel).toBeVisible();
|
// await expect(panel).toBeVisible();
|
||||||
|
|
||||||
// Reduced wait time for better performance
|
// // Reduced wait time for better performance
|
||||||
await page.waitForTimeout(1000);
|
// await page.waitForTimeout(1000);
|
||||||
|
|
||||||
// Enable online migration mode
|
// // Enable online migration mode
|
||||||
const migrationTypeContainer = panel.getByTestId("migration-type");
|
// const migrationTypeContainer = panel.getByTestId("migration-type");
|
||||||
const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
// const onlineCopyRadioButton = migrationTypeContainer.getByRole("radio", { name: /Online mode/i });
|
||||||
await onlineCopyRadioButton.click({ force: true });
|
// await onlineCopyRadioButton.click({ force: true });
|
||||||
|
|
||||||
await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
// await expect(migrationTypeContainer.getByTestId("migration-type-description-online")).toBeVisible();
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Verify permissions screen is shown for online migration
|
// // Verify permissions screen is shown for online migration
|
||||||
const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
// const permissionScreen = panel.getByTestId("Panel:AssignPermissionsContainer");
|
||||||
await expect(permissionScreen).toBeVisible();
|
// await expect(permissionScreen).toBeVisible();
|
||||||
await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
// await expect(permissionScreen.getByText("Online container copy", { exact: true })).toBeVisible();
|
||||||
|
|
||||||
// Skip permissions setup and proceed to container selection
|
// // Skip permissions setup and proceed to container selection
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Configure source and target containers for online migration
|
// // Configure source and target containers for online migration
|
||||||
const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
// const sourceDatabaseDropdown = panel.getByTestId("source-databaseDropdown");
|
||||||
await sourceDatabaseDropdown.click();
|
// await sourceDatabaseDropdown.click();
|
||||||
const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
// const sourceDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Database" },
|
// { ariaLabel: "Database" },
|
||||||
);
|
// );
|
||||||
await sourceDbDropdownItem.click();
|
// await sourceDbDropdownItem.click();
|
||||||
|
|
||||||
const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
// const sourceContainerDropdown = panel.getByTestId("source-containerDropdown");
|
||||||
await sourceContainerDropdown.click();
|
// await sourceContainerDropdown.click();
|
||||||
const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
// const sourceContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Container" },
|
// { ariaLabel: "Container" },
|
||||||
);
|
// );
|
||||||
await sourceContainerDropdownItem.click();
|
// await sourceContainerDropdownItem.click();
|
||||||
|
|
||||||
const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
// const targetDatabaseDropdown = panel.getByTestId("target-databaseDropdown");
|
||||||
await targetDatabaseDropdown.click();
|
// await targetDatabaseDropdown.click();
|
||||||
const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
// const targetDbDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 0 },
|
// { position: 0 },
|
||||||
{ ariaLabel: "Database" },
|
// { ariaLabel: "Database" },
|
||||||
);
|
// );
|
||||||
await targetDbDropdownItem.click();
|
// await targetDbDropdownItem.click();
|
||||||
|
|
||||||
const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
// const targetContainerDropdown = panel.getByTestId("target-containerDropdown");
|
||||||
await targetContainerDropdown.click();
|
// await targetContainerDropdown.click();
|
||||||
const targetContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
// const targetContainerDropdownItem = await getDropdownItemByNameOrPosition(
|
||||||
frame,
|
// frame,
|
||||||
{ position: 1 },
|
// { position: 1 },
|
||||||
{ ariaLabel: "Container" },
|
// { ariaLabel: "Container" },
|
||||||
);
|
// );
|
||||||
await targetContainerDropdownItem.click();
|
// await targetContainerDropdownItem.click();
|
||||||
|
|
||||||
await panel.getByRole("button", { name: "Next" }).click();
|
// await panel.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
// Verify job preview and create the online migration job
|
// // Verify job preview and create the online migration job
|
||||||
const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
// const previewContainer = panel.getByTestId("Panel:PreviewCopyJob");
|
||||||
await expect(previewContainer.getByTestId("source-account-name")).toHaveText(targetAccountName);
|
// await expect(previewContainer.getByTestId("source-account-name")).toHaveText(targetAccountName);
|
||||||
|
|
||||||
const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
// const jobNameInput = previewContainer.getByTestId("job-name-textfield");
|
||||||
const onlineMigrationJobName = await jobNameInput.inputValue();
|
// const onlineMigrationJobName = await jobNameInput.inputValue();
|
||||||
|
|
||||||
const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
// const copyButton = panel.getByRole("button", { name: "Copy", exact: true });
|
||||||
|
|
||||||
const copyJobCreationPromise = waitForApiResponse(
|
// const copyJobCreationPromise = waitForApiResponse(
|
||||||
page,
|
// page,
|
||||||
`${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}`,
|
// `${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}`,
|
||||||
"PUT",
|
// "PUT",
|
||||||
);
|
// );
|
||||||
await copyButton.click();
|
// await copyButton.click();
|
||||||
await page.waitForTimeout(1000); // Reduced wait time
|
// await page.waitForTimeout(1000); // Reduced wait time
|
||||||
|
|
||||||
const response = await copyJobCreationPromise;
|
// const response = await copyJobCreationPromise;
|
||||||
expect(response.ok()).toBe(true);
|
// expect(response.ok()).toBe(true);
|
||||||
|
|
||||||
// Verify panel closes and job appears in the list
|
// // Verify panel closes and job appears in the list
|
||||||
await expect(panel).not.toBeVisible();
|
// await expect(panel).not.toBeVisible({ timeout: 5000 });
|
||||||
|
|
||||||
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
// const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||||
await filterTextField.waitFor({ state: "visible" });
|
// await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
||||||
await filterTextField.fill(onlineMigrationJobName);
|
|
||||||
|
|
||||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
// let jobRow, statusCell, actionMenuButton;
|
||||||
await jobsListContainer.waitFor({ state: "visible" });
|
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||||
|
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||||
|
// await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||||
|
|
||||||
let jobRow, statusCell, actionMenuButton;
|
// // Verify job status changes to queued state
|
||||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
// await expect(statusCell).toContainText(/running|queued|pending/i, { timeout: 5000 });
|
||||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
|
||||||
await jobRow.waitFor({ state: "visible" });
|
|
||||||
|
|
||||||
// Verify job status changes to queued state
|
// // Test job lifecycle management through action menu
|
||||||
await expect(statusCell).toContainText(/running|queued|pending/i);
|
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||||
|
// await actionMenuButton.click();
|
||||||
|
|
||||||
// Test job lifecycle management through action menu
|
// // Test pause functionality
|
||||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
// const pauseAction = frame.locator(".ms-ContextualMenu-list button:has-text('Pause')");
|
||||||
await actionMenuButton.click();
|
// await pauseAction.click();
|
||||||
|
|
||||||
// Test pause functionality
|
// const pauseResponse = await waitForApiResponse(
|
||||||
const pauseAction = frame.locator(".ms-ContextualMenu-list button:has-text('Pause')");
|
// page,
|
||||||
await pauseAction.click();
|
// `${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}/pause`,
|
||||||
|
// "POST",
|
||||||
|
// );
|
||||||
|
// expect(pauseResponse.ok()).toBe(true);
|
||||||
|
|
||||||
const pauseResponse = await waitForApiResponse(
|
// // Verify job status changes to paused
|
||||||
page,
|
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||||
`${targetAccountName}/dataTransferJobs/${onlineMigrationJobName}/pause`,
|
// await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
||||||
"POST",
|
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||||
);
|
// await expect(statusCell).toContainText(/paused/i, { timeout: 5000 });
|
||||||
expect(pauseResponse.ok()).toBe(true);
|
// await page.waitForTimeout(1000);
|
||||||
|
|
||||||
// Verify job status changes to paused
|
// // Test cancel job functionality
|
||||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||||
await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
// await actionMenuButton.click();
|
||||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
// await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||||
await expect(statusCell).toContainText(/paused/i, { timeout: 5000 });
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
// Test cancel job functionality
|
// // Verify cancellation confirmation dialog
|
||||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
// await expect(frame.locator(".ms-Dialog-main")).toBeVisible({ timeout: 2000 });
|
||||||
await actionMenuButton.click();
|
// await expect(frame.locator(".ms-Dialog-main")).toContainText(onlineMigrationJobName);
|
||||||
await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
|
||||||
|
|
||||||
// Verify cancellation confirmation dialog
|
// const cancelDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Cancel");
|
||||||
await expect(frame.locator(".ms-Dialog-main")).toBeVisible({ timeout: 2000 });
|
// await expect(cancelDialogButton).toBeVisible();
|
||||||
await expect(frame.locator(".ms-Dialog-main")).toContainText(onlineMigrationJobName);
|
// await cancelDialogButton.click();
|
||||||
|
// await expect(frame.locator(".ms-Dialog-main")).not.toBeVisible();
|
||||||
|
|
||||||
const cancelDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Cancel");
|
// actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||||
await expect(cancelDialogButton).toBeVisible();
|
// await actionMenuButton.click();
|
||||||
await cancelDialogButton.click();
|
// await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
||||||
await expect(frame.locator(".ms-Dialog-main")).not.toBeVisible();
|
|
||||||
|
|
||||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
// const confirmDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Confirm");
|
||||||
await actionMenuButton.click();
|
// await expect(confirmDialogButton).toBeVisible();
|
||||||
await frame.locator(".ms-ContextualMenu-list button:has-text('Cancel')").click();
|
// await confirmDialogButton.click();
|
||||||
|
|
||||||
const confirmDialogButton = frame.locator(".ms-Dialog-main").getByTestId("DialogButton:Confirm");
|
// // Verify final job status is cancelled
|
||||||
await expect(confirmDialogButton).toBeVisible();
|
// jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||||
await confirmDialogButton.click();
|
// statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||||
|
// await expect(statusCell).toContainText(/cancelled/i, { timeout: 5000 });
|
||||||
// Verify final job status is cancelled
|
// });
|
||||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
// });
|
||||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
|
||||||
await expect(statusCell).toContainText(/cancelled/i, { timeout: 5000 });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
|
|
||||||
const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
||||||
await expect(pitrBtn).toBeVisible();
|
await expect(pitrBtn).toBeVisible();
|
||||||
await pitrBtn.click({ force: true });
|
await pitrBtn.click();
|
||||||
|
|
||||||
// Verify new page opens with correct URL pattern
|
// Verify new page opens with correct URL pattern
|
||||||
page.context().on("page", async (newPage) => {
|
page.context().on("page", async (newPage) => {
|
||||||
@@ -246,7 +246,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
|
|
||||||
const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
||||||
await expect(toggleButton).toBeVisible();
|
await expect(toggleButton).toBeVisible();
|
||||||
await toggleButton.click({ force: true });
|
await toggleButton.click();
|
||||||
|
|
||||||
// Verify popover functionality
|
// Verify popover functionality
|
||||||
const popover = frame.locator("[data-test='popover-container']");
|
const popover = frame.locator("[data-test='popover-container']");
|
||||||
@@ -257,7 +257,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
await expect(yesButton).toBeVisible();
|
await expect(yesButton).toBeVisible();
|
||||||
await expect(noButton).toBeVisible();
|
await expect(noButton).toBeVisible();
|
||||||
|
|
||||||
await yesButton.click({ force: true });
|
await yesButton.click();
|
||||||
|
|
||||||
// Verify loading states
|
// Verify loading states
|
||||||
await expect(loadingOverlay).toBeVisible();
|
await expect(loadingOverlay).toBeVisible();
|
||||||
@@ -265,6 +265,6 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
||||||
|
|
||||||
// Cancel the panel to clean up
|
// Cancel the panel to clean up
|
||||||
await panel.getByRole("button", { name: "Cancel" }).click({ force: true });
|
await panel.getByRole("button", { name: "Cancel" }).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -136,9 +136,7 @@ test.describe.serial("Upload Item", () => {
|
|||||||
if (existsSync(uploadDocumentDirPath)) {
|
if (existsSync(uploadDocumentDirPath)) {
|
||||||
rmdirSync(uploadDocumentDirPath);
|
rmdirSync(uploadDocumentDirPath);
|
||||||
}
|
}
|
||||||
if (!process.env.CI) {
|
await context?.dispose();
|
||||||
await context?.dispose();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.afterEach("Close Upload Items panel if still open", async () => {
|
test.afterEach("Close Upload Items panel if still open", async () => {
|
||||||
|
|||||||
@@ -30,12 +30,9 @@ test.beforeEach("Open new query tab", async ({ page }) => {
|
|||||||
await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
|
await explorer.frame.getByTestId("NotificationConsole/Contents").waitFor();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Delete database only if not running in CI
|
test.afterAll("Delete Test Database", async () => {
|
||||||
if (!process.env.CI) {
|
await context?.dispose();
|
||||||
test.afterAll("Delete Test Database", async () => {
|
});
|
||||||
await context?.dispose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("Query results", async () => {
|
test("Query results", async () => {
|
||||||
// Run the query and verify the results
|
// Run the query and verify the results
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ test.describe("Change Partition Key", () => {
|
|||||||
let previousJobName: string | undefined;
|
let previousJobName: string | undefined;
|
||||||
|
|
||||||
test.beforeAll("Create Test Database", async () => {
|
test.beforeAll("Create Test Database", async () => {
|
||||||
context = await createTestSQLContainer();
|
context = await createTestSQLContainer({
|
||||||
|
testAccount: TestAccount.SQL2,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach("Open container settings", async ({ page }) => {
|
test.beforeEach("Open container settings", async ({ page }) => {
|
||||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
explorer = await DataExplorer.open(page, TestAccount.SQL2);
|
||||||
|
|
||||||
// Click Scale & Settings and open Partition Key tab
|
// Click Scale & Settings and open Partition Key tab
|
||||||
await explorer.openScaleAndSettings(context);
|
await explorer.openScaleAndSettings(context);
|
||||||
@@ -23,12 +25,9 @@ test.describe("Change Partition Key", () => {
|
|||||||
await PartitionKeyTab.click();
|
await PartitionKeyTab.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Delete database only if not running in CI
|
test.afterEach("Delete Test Database", async () => {
|
||||||
if (!process.env.CI) {
|
await context?.dispose();
|
||||||
test.afterEach("Delete Test Database", async () => {
|
});
|
||||||
await context?.dispose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("Change partition key path", async ({ page }) => {
|
test("Change partition key path", async ({ page }) => {
|
||||||
await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();
|
await expect(explorer.frame.getByText("/partitionKey")).toBeVisible();
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ test.describe("Computed Properties", () => {
|
|||||||
let explorer: DataExplorer = null!;
|
let explorer: DataExplorer = null!;
|
||||||
|
|
||||||
test.beforeAll("Create Test Database", async () => {
|
test.beforeAll("Create Test Database", async () => {
|
||||||
context = await createTestSQLContainer();
|
context = await createTestSQLContainer({
|
||||||
|
testAccount: TestAccount.SQL2,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach("Open Settings tab under Scale & Settings", async ({ page }) => {
|
test.beforeEach("Open Settings tab under Scale & Settings", async ({ page }) => {
|
||||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
explorer = await DataExplorer.open(page, TestAccount.SQL2);
|
||||||
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
const containerNode = await explorer.waitForContainerNode(context.database.id, context.container.id);
|
||||||
await containerNode.expand();
|
await containerNode.expand();
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ test.describe("Computed Properties", () => {
|
|||||||
await computedPropertiesTab.click();
|
await computedPropertiesTab.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll("Delete Test Database", async () => {
|
test.afterEach("Delete Test Database", async () => {
|
||||||
await context?.dispose();
|
await context?.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,5 @@ async function openScaleTab(browser: Browser): Promise<SetupResult> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function cleanup({ context }: Partial<SetupResult>) {
|
async function cleanup({ context }: Partial<SetupResult>) {
|
||||||
if (!process.env.CI) {
|
await context?.dispose();
|
||||||
await context?.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,9 @@ test.describe("Settings under Scale & Settings", () => {
|
|||||||
await settingsTab.click();
|
await settingsTab.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Delete database only if not running in CI
|
test.afterEach("Delete Test Database", async () => {
|
||||||
if (!process.env.CI) {
|
await context?.dispose();
|
||||||
test.afterAll("Delete Test Database", async () => {
|
});
|
||||||
await context?.dispose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("Update TTL to On (no default)", async () => {
|
test("Update TTL to On (no default)", async () => {
|
||||||
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
|
const ttlOnNoDefaultRadioButton = explorer.frame.getByRole("radio", { name: "ttl-on-no-default-option" });
|
||||||
|
|||||||
@@ -7,14 +7,16 @@ test.describe("Stored Procedures", () => {
|
|||||||
let explorer: DataExplorer = null!;
|
let explorer: DataExplorer = null!;
|
||||||
|
|
||||||
test.beforeAll("Create Test Database", async () => {
|
test.beforeAll("Create Test Database", async () => {
|
||||||
context = await createTestSQLContainer();
|
context = await createTestSQLContainer({
|
||||||
|
testAccount: TestAccount.SQL2,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach("Open container", async ({ page }) => {
|
test.beforeEach("Open container", async ({ page }) => {
|
||||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
explorer = await DataExplorer.open(page, TestAccount.SQL2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll("Delete Test Database", async () => {
|
test.afterEach("Delete Test Database", async () => {
|
||||||
await context?.dispose();
|
await context?.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ test.describe("Stored Procedures", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Execute stored procedure
|
// Execute stored procedure
|
||||||
const executeButton = explorer.commandBarButton(CommandBarButton.Execute);
|
const executeButton = explorer.commandBarButton(CommandBarButton.Execute).first();
|
||||||
await executeButton.click();
|
await executeButton.click();
|
||||||
const executeSidePanelButton = explorer.frame.getByTestId("Panel/OkButton");
|
const executeSidePanelButton = explorer.frame.getByTestId("Panel/OkButton");
|
||||||
await executeSidePanelButton.click();
|
await executeSidePanelButton.click();
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ test.describe("Triggers", () => {
|
|||||||
request.setBody(itemToCreate);
|
request.setBody(itemToCreate);
|
||||||
}`;
|
}`;
|
||||||
test.beforeAll("Create Test Database", async () => {
|
test.beforeAll("Create Test Database", async () => {
|
||||||
context = await createTestSQLContainer();
|
context = await createTestSQLContainer({
|
||||||
|
testAccount: TestAccount.SQL2,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach("Open container", async ({ page }) => {
|
test.beforeEach("Open container", async ({ page }) => {
|
||||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
explorer = await DataExplorer.open(page, TestAccount.SQL2);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.env.CI) {
|
test.afterEach("Delete Test Database", async () => {
|
||||||
test.afterAll("Delete Test Database", async () => {
|
await context?.dispose();
|
||||||
await context?.dispose();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("Add and delete trigger", async ({ page }, testInfo) => {
|
test("Add and delete trigger", async ({ page }, testInfo) => {
|
||||||
// Open container context menu and click New Trigger
|
// Open container context menu and click New Trigger
|
||||||
|
|||||||
@@ -12,18 +12,18 @@ test.describe("User Defined Functions", () => {
|
|||||||
}`;
|
}`;
|
||||||
|
|
||||||
test.beforeAll("Create Test Database", async () => {
|
test.beforeAll("Create Test Database", async () => {
|
||||||
context = await createTestSQLContainer();
|
context = await createTestSQLContainer({
|
||||||
|
testAccount: TestAccount.SQL2,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.beforeEach("Open container", async ({ page }) => {
|
test.beforeEach("Open container", async ({ page }) => {
|
||||||
explorer = await DataExplorer.open(page, TestAccount.SQL);
|
explorer = await DataExplorer.open(page, TestAccount.SQL2);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.env.CI) {
|
test.afterEach("Delete Test Database", async () => {
|
||||||
test.afterAll("Delete Test Database", async () => {
|
await context?.dispose();
|
||||||
await context?.dispose();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("Add, execute, and delete user defined function", async ({ page }, testInfo) => {
|
test("Add, execute, and delete user defined function", async ({ page }, testInfo) => {
|
||||||
// Open container context menu and click New UDF
|
// Open container context menu and click New UDF
|
||||||
|
|||||||
@@ -86,13 +86,14 @@ type createTestSqlContainerConfig = {
|
|||||||
includeTestData?: boolean;
|
includeTestData?: boolean;
|
||||||
partitionKey?: string;
|
partitionKey?: string;
|
||||||
databaseName?: string;
|
databaseName?: string;
|
||||||
|
testAccount?: TestAccount;
|
||||||
};
|
};
|
||||||
|
|
||||||
type createMultipleTestSqlContainerConfig = {
|
type createMultipleTestSqlContainerConfig = {
|
||||||
containerCount?: number;
|
containerCount?: number;
|
||||||
partitionKey?: string;
|
partitionKey?: string;
|
||||||
databaseName?: string;
|
databaseName?: string;
|
||||||
accountType: TestAccount.SQLContainerCopyOnly | TestAccount.SQL;
|
accountType: TestAccount.SQLContainerCopyOnly | TestAccount.SQL | TestAccount.SQL2;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function createMultipleTestContainers({
|
export async function createMultipleTestContainers({
|
||||||
@@ -114,12 +115,7 @@ export async function createMultipleTestContainers({
|
|||||||
endpoint: account.documentEndpoint!,
|
endpoint: account.documentEndpoint!,
|
||||||
};
|
};
|
||||||
|
|
||||||
const rbacToken =
|
const rbacToken = getRbacToken(accountType);
|
||||||
accountType === TestAccount.SQL
|
|
||||||
? process.env.NOSQL_TESTACCOUNT_TOKEN
|
|
||||||
: accountType === TestAccount.SQLContainerCopyOnly
|
|
||||||
? process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN
|
|
||||||
: "";
|
|
||||||
if (rbacToken) {
|
if (rbacToken) {
|
||||||
clientOptions.tokenProvider = async (): Promise<string> => {
|
clientOptions.tokenProvider = async (): Promise<string> => {
|
||||||
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
||||||
@@ -155,20 +151,21 @@ export async function createTestSQLContainer({
|
|||||||
includeTestData = false,
|
includeTestData = false,
|
||||||
partitionKey = "/partitionKey",
|
partitionKey = "/partitionKey",
|
||||||
databaseName = "",
|
databaseName = "",
|
||||||
|
testAccount = TestAccount.SQL,
|
||||||
}: createTestSqlContainerConfig = {}) {
|
}: createTestSqlContainerConfig = {}) {
|
||||||
const databaseId = databaseName ? databaseName : generateUniqueName("db");
|
const databaseId = databaseName ? databaseName : generateUniqueName("db");
|
||||||
const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique
|
const containerId = "testcontainer"; // A unique container name isn't needed because the database is unique
|
||||||
const credentials = getAzureCLICredentials();
|
const credentials = getAzureCLICredentials();
|
||||||
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
|
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
|
||||||
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
|
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
|
||||||
const accountName = getAccountName(TestAccount.SQL);
|
const accountName = getAccountName(testAccount);
|
||||||
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
|
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
|
||||||
|
|
||||||
const clientOptions: CosmosClientOptions = {
|
const clientOptions: CosmosClientOptions = {
|
||||||
endpoint: account.documentEndpoint!,
|
endpoint: account.documentEndpoint!,
|
||||||
};
|
};
|
||||||
|
|
||||||
const nosqlAccountRbacToken = process.env.NOSQL_TESTACCOUNT_TOKEN;
|
const nosqlAccountRbacToken = getRbacToken(testAccount);
|
||||||
if (nosqlAccountRbacToken) {
|
if (nosqlAccountRbacToken) {
|
||||||
clientOptions.tokenProvider = async (): Promise<string> => {
|
clientOptions.tokenProvider = async (): Promise<string> => {
|
||||||
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;
|
||||||
@@ -252,3 +249,16 @@ export async function retry<T>(fn: () => Promise<T>, retries = 3, delayMs = 1000
|
|||||||
}
|
}
|
||||||
throw lastError;
|
throw lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRbacToken(accountType: TestAccount): string | undefined {
|
||||||
|
switch (accountType) {
|
||||||
|
case TestAccount.SQL:
|
||||||
|
return process.env.NOSQL_TESTACCOUNT_TOKEN;
|
||||||
|
case TestAccount.SQL2:
|
||||||
|
return process.env.NOSQL2_TESTACCOUNT_TOKEN;
|
||||||
|
case TestAccount.SQLContainerCopyOnly:
|
||||||
|
return process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN;
|
||||||
|
default:
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const nosqlRbacToken =
|
|||||||
urlSearchParams.get("nosqlRbacToken") ||
|
urlSearchParams.get("nosqlRbacToken") ||
|
||||||
(enablecontainercopy ? process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN : process.env.NOSQL_TESTACCOUNT_TOKEN) ||
|
(enablecontainercopy ? process.env.NOSQL_CONTAINERCOPY_TESTACCOUNT_TOKEN : process.env.NOSQL_TESTACCOUNT_TOKEN) ||
|
||||||
"";
|
"";
|
||||||
|
const nosql2RbacToken = urlSearchParams.get("nosql2RbacToken") || process.env.NOSQL2_TESTACCOUNT_TOKEN || "";
|
||||||
const nosqlReadOnlyRbacToken =
|
const nosqlReadOnlyRbacToken =
|
||||||
urlSearchParams.get("nosqlReadOnlyRbacToken") || process.env.NOSQL_READONLY_TESTACCOUNT_TOKEN || "";
|
urlSearchParams.get("nosqlReadOnlyRbacToken") || process.env.NOSQL_READONLY_TESTACCOUNT_TOKEN || "";
|
||||||
const tableRbacToken = urlSearchParams.get("tableRbacToken") || process.env.TABLE_TESTACCOUNT_TOKEN || "";
|
const tableRbacToken = urlSearchParams.get("tableRbacToken") || process.env.TABLE_TESTACCOUNT_TOKEN || "";
|
||||||
@@ -43,6 +44,9 @@ const initTestExplorer = async (): Promise<void> => {
|
|||||||
case "sql":
|
case "sql":
|
||||||
rbacToken = nosqlRbacToken;
|
rbacToken = nosqlRbacToken;
|
||||||
break;
|
break;
|
||||||
|
case "sql2":
|
||||||
|
rbacToken = nosql2RbacToken;
|
||||||
|
break;
|
||||||
case "sql-readonly":
|
case "sql-readonly":
|
||||||
rbacToken = nosqlReadOnlyRbacToken;
|
rbacToken = nosqlReadOnlyRbacToken;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user