Adds mongo e2e spec (#207)

* Adds mongo e2e spec

* Adds mongo connection string

* Constantize sql spec

* Use shared login function

* Remove comment

* Remove login lines from cassandra

* Adds frame return tyoe

* test updates

* format

* adds unique name

* remove trivial type annotation
This commit is contained in:
Zachary Foster
2020-09-30 16:42:33 -04:00
committed by GitHub
parent fc722e87be
commit 4fe2098730
9 changed files with 194 additions and 59 deletions

21
test/utils/shared.ts Normal file
View File

@@ -0,0 +1,21 @@
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")}`;
}