Add tests for fix to getOidcCallbackUrl (#2248)

This commit is contained in:
Michael Telatynski 2025-04-11 17:10:11 +01:00 committed by GitHub
parent aabbb8772d
commit 4fe0384523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 8 deletions

View File

@ -11,16 +11,18 @@ import { platform } from "node:os";
import { test, expect } from "../../element-desktop-test.js";
declare global {
interface ElectronPlatform {
getEventIndexingManager():
| {
supportsEventIndexing(): Promise<boolean>;
}
| undefined;
createPickleKey(userId: string, deviceId: string): Promise<string | null>;
}
interface Window {
mxPlatformPeg: {
get(): {
getEventIndexingManager():
| {
supportsEventIndexing(): Promise<boolean>;
}
| undefined;
createPickleKey(userId: string, deviceId: string): Promise<string | null>;
};
get(): ElectronPlatform;
};
}
}

View File

@ -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<string>(() => {
return window.mxPlatformPeg.get().getOidcCallbackUrl().toString();
}),
).resolves.toBe("io.element.desktop:/vector/webapp/");
});
});