mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-29 17:06:58 +00:00
7ffa18a190
This reverts commit 30353c26f3
.
22 lines
794 B
TypeScript
22 lines
794 B
TypeScript
import crypto from "crypto";
|
|
import { Frame } from "puppeteer";
|
|
|
|
export async function login(connectionString: string): Promise<Frame> {
|
|
const prodUrl = "https://localhost:1234/hostedExplorer.html";
|
|
page.goto(prodUrl);
|
|
|
|
// log in with connection string
|
|
const handle = await page.waitForSelector("iframe");
|
|
const frame = await handle.contentFrame();
|
|
await frame.waitFor("div > p.switchConnectTypeText", { visible: true });
|
|
await frame.click("div > p.switchConnectTypeText");
|
|
const connStr = connectionString;
|
|
await frame.type("input[class='inputToken']", connStr);
|
|
await frame.click("input[value='Connect']");
|
|
return frame;
|
|
}
|
|
|
|
export function generateUniqueName(baseName: string, length = 8): string {
|
|
return `${baseName}${crypto.randomBytes(length).toString("hex")}`;
|
|
}
|