From 4fe03845236a9855cc7160fd6335f9d96c8fcd6d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 11 Apr 2025 17:10:11 +0100 Subject: [PATCH] Add tests for fix to getOidcCallbackUrl (#2248) --- playwright/e2e/launch/launch.spec.ts | 18 +++++++------- playwright/e2e/launch/oidc.spec.ts | 36 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 playwright/e2e/launch/oidc.spec.ts diff --git a/playwright/e2e/launch/launch.spec.ts b/playwright/e2e/launch/launch.spec.ts index 78fca814..fb1d3713 100644 --- a/playwright/e2e/launch/launch.spec.ts +++ b/playwright/e2e/launch/launch.spec.ts @@ -11,16 +11,18 @@ import { platform } from "node:os"; import { test, expect } from "../../element-desktop-test.js"; declare global { + interface ElectronPlatform { + getEventIndexingManager(): + | { + supportsEventIndexing(): Promise; + } + | undefined; + createPickleKey(userId: string, deviceId: string): Promise; + } + interface Window { mxPlatformPeg: { - get(): { - getEventIndexingManager(): - | { - supportsEventIndexing(): Promise; - } - | undefined; - 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/"); + }); +});