get protocol handling working for linux

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton authored and Sebastian Malton committed 2021-02-02 08:51:05 -05:00
1 parent bce07796b1
commit aa5909bdd1
4 files changed
+51 -9

No files matched your search

+27 -3
View File
@@ -1,8 +1,9 @@
import { AppConstructorOptions, Application } from "spectron";
import * as util from "util";
import { exec } from "child_process";
import fse from "fs-extra";
import { exec, spawnSync } from "child_process";
import fse, { writeFile } from "fs-extra";
import path from "path";
import os from "os";
import { delay } from "../../src/common/utils";
interface AppTestingPaths {
@@ -10,7 +11,7 @@ interface AppTestingPaths {
libraryPath: string,
}
function getAppTestingPaths(): AppTestingPaths {
export function getAppTestingPaths(): AppTestingPaths {
switch (process.platform) {
case "win32":
return {
@@ -69,6 +70,27 @@ export async function appStart() {
await app.client.windowByIndex(0);
await app.client.waitUntilWindowLoaded();
if (process.platform === "linux") {
const testingDesktop = [
"[Desktop Entry]",
"Name=Lens",
`Exec=${path.resolve(getAppTestingPaths().testingPath)} %U`,
"Terminal=false",
"Type=Application",
"Icon=lens",
"StartupWMClass=Lens",
"Comment=Lens - The Kubernetes IDE",
"MimeType=x-scheme-handler/lens;",
"Categories=Network;"
].join("\n");
await writeFile(path.join(os.homedir(), ".local/share/applications/lens-testing.desktop"), testingDesktop);
const { status } = spawnSync("xdg-settings set default-url-scheme-handler lens lens-testing.desktop", { shell: true });
expect(status).toBe(0);
}
return app;
}
@@ -134,6 +156,8 @@ async function* splitLogs(app: Application): AsyncGenerator<LogLines, void, void
const curLogs: string[] = (app as any).chromeDriver.getLogs();
const newLogs = curLogs.slice(lastLogLineCount);
console.log(curLogs);
lastLogLineCount = curLogs.length;
const item: LogLines = {