Merge pull request #3164 from element-hq/toger5/fix-src-js-sdk-imports

Fix lint and playwright errors caused by matrix-js-sdk/src import
This commit is contained in:
Valere Fedronic
2025-04-04 09:31:24 +02:00
committed by GitHub
4 changed files with 28 additions and 4 deletions

View File

@@ -46,7 +46,6 @@
"preferred_domain": "meet.element.io"
},
"element_call": {
"url": "https://localhost:3000",
"participant_limit": 8,
"brand": "Element Call"
},

View File

@@ -70,6 +70,7 @@ services:
element-web:
image: ghcr.io/element-hq/element-web:develop
pull_policy: always
volumes:
- ./backend/ew.test.config.json:/app/config.json
environment:

View File

@@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.
import { type Page, test, expect, type JSHandle } from "@playwright/test";
import type { MatrixClient } from "matrix-js-sdk/src";
import type { MatrixClient } from "matrix-js-sdk";
export type UserBaseFixture = {
mxId: string;
@@ -36,7 +36,6 @@ const CONFIG_JSON = {
},
element_call: {
url: "https://localhost:3000",
participant_limit: 8,
brand: "Element Call",
},
@@ -60,6 +59,21 @@ const CONFIG_JSON = {
},
};
/**
* Set the Element Call URL in the dev tool settings using `window.mxSettingsStore` via `page.evaluate`.
* @param page
*/
async function setDevToolElementCallDevUrl(page: Page): Promise<void> {
await page.evaluate(() => {
window.mxSettingsStore.setValue(
"Developer.elementCallUrl",
null,
"device",
"https://localhost:3000/room",
);
});
}
export const widgetTest = test.extend<MyFixtures>({
asWidget: async ({ browser, context }, pUse) => {
await context.route(`http://localhost:8081/config.json*`, async (route) => {
@@ -88,6 +102,7 @@ export const widgetTest = test.extend<MyFixtures>({
await expect(
ewPage1.getByRole("heading", { name: `Welcome ${userA}` }),
).toBeVisible();
await setDevToolElementCallDevUrl(ewPage1);
const brooksClientHandle = await ewPage1.evaluateHandle(() =>
window.mxMatrixClientPeg.get(),
@@ -115,6 +130,7 @@ export const widgetTest = test.extend<MyFixtures>({
await expect(
ewPage2.getByRole("heading", { name: `Welcome ${userB}` }),
).toBeVisible();
await setDevToolElementCallDevUrl(ewPage2);
const whistlerClientHandle = await ewPage2.evaluateHandle(() =>
window.mxMatrixClientPeg.get(),

View File

@@ -5,12 +5,20 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import type * as Matrix from "matrix-js-sdk/src";
import type * as Matrix from "matrix-js-sdk";
declare global {
interface Window {
mxMatrixClientPeg: {
get(): Matrix.MatrixClient;
};
mxSettingsStore: {
setValue: (
settingKey: string,
room: string | null,
level: string,
setting: string,
) => void;
};
}
}