diff --git a/playwright/e2e/launch/launch.spec.ts b/playwright/e2e/launch/launch.spec.ts index 2d3f21e2..25c7a367 100644 --- a/playwright/e2e/launch/launch.spec.ts +++ b/playwright/e2e/launch/launch.spec.ts @@ -12,17 +12,19 @@ import keytar from "keytar-forked"; import { test, expect } from "../../element-desktop-test.js"; declare global { + interface ElectronPlatform { + getEventIndexingManager(): + | { + supportsEventIndexing(): Promise; + } + | undefined; + getPickleKey(userId: string, deviceId: string): Promise; + createPickleKey(userId: string, deviceId: string): Promise; + } + interface Window { mxPlatformPeg: { - get(): { - getEventIndexingManager(): - | { - supportsEventIndexing(): Promise; - } - | undefined; - getPickleKey(userId: string, deviceId: string): Promise; - createPickleKey(userId: string, deviceId: string): Promise; - }; + get(): ElectronPlatform; }; } } diff --git a/playwright/e2e/launch/oidc.spec.ts b/playwright/e2e/launch/oidc.spec.ts new file mode 100644 index 00000000..4b321271 --- /dev/null +++ b/playwright/e2e/launch/oidc.spec.ts @@ -0,0 +1,36 @@ +/* +Copyright 2025 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE files in the repository root for full details. +*/ + +import { test, expect } from "../../element-desktop-test.js"; + +declare global { + interface ElectronPlatform { + getOidcCallbackUrl(): URL; + } + + interface Window { + mxPlatformPeg: { + get(): ElectronPlatform; + }; + } +} + +test.describe("OIDC Native", () => { + test.slow(); + + test.beforeEach(async ({ page }) => { + await page.locator(".mx_Welcome").waitFor(); + }); + + test("should use OIDC callback URL without authority component", async ({ page }) => { + await expect( + page.evaluate(() => { + return window.mxPlatformPeg.get().getOidcCallbackUrl().toString(); + }), + ).resolves.toBe("io.element.desktop:/vector/webapp/"); + }); +}); diff --git a/src/electron-main.ts b/src/electron-main.ts index a47ed6cf..262e19c2 100644 --- a/src/electron-main.ts +++ b/src/electron-main.ts @@ -44,7 +44,12 @@ const argv = minimist(process.argv, { if (argv["help"]) { console.log("Options:"); console.log(" --profile-dir {path}: Path to where to store the profile."); - console.log(" --profile {name}: Name of alternate profile to use, allows for running multiple accounts."); + console.log( + ` --profile {name}: Name of alternate profile to use, allows for running multiple accounts.\n` + + ` Ignored if --profile-dir is specified.\n` + + ` The ELEMENT_PROFILE_DIR environment variable may be used to change the default profile path.\n` + + ` It is overridden by --profile-dir, but can be combined with --profile.`, + ); console.log(" --devtools: Install and use react-devtools and react-perf."); console.log( ` --config: Path to the config.json file. May also be specified via the ELEMENT_DESKTOP_CONFIG_JSON environment variable.\n` + @@ -75,7 +80,7 @@ if (userDataPathInProtocol) { } else if (argv["profile-dir"]) { userDataPath = argv["profile-dir"]; } else { - let newUserDataPath = app.getPath("userData"); + let newUserDataPath = process.env.ELEMENT_PROFILE_DIR ?? app.getPath("userData"); if (argv["profile"]) { newUserDataPath += "-" + argv["profile"]; }