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:
@@ -46,7 +46,6 @@
|
|||||||
"preferred_domain": "meet.element.io"
|
"preferred_domain": "meet.element.io"
|
||||||
},
|
},
|
||||||
"element_call": {
|
"element_call": {
|
||||||
"url": "https://localhost:3000",
|
|
||||||
"participant_limit": 8,
|
"participant_limit": 8,
|
||||||
"brand": "Element Call"
|
"brand": "Element Call"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ services:
|
|||||||
|
|
||||||
element-web:
|
element-web:
|
||||||
image: ghcr.io/element-hq/element-web:develop
|
image: ghcr.io/element-hq/element-web:develop
|
||||||
|
pull_policy: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend/ew.test.config.json:/app/config.json
|
- ./backend/ew.test.config.json:/app/config.json
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -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 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 = {
|
export type UserBaseFixture = {
|
||||||
mxId: string;
|
mxId: string;
|
||||||
@@ -36,7 +36,6 @@ const CONFIG_JSON = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
element_call: {
|
element_call: {
|
||||||
url: "https://localhost:3000",
|
|
||||||
participant_limit: 8,
|
participant_limit: 8,
|
||||||
brand: "Element Call",
|
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>({
|
export const widgetTest = test.extend<MyFixtures>({
|
||||||
asWidget: async ({ browser, context }, pUse) => {
|
asWidget: async ({ browser, context }, pUse) => {
|
||||||
await context.route(`http://localhost:8081/config.json*`, async (route) => {
|
await context.route(`http://localhost:8081/config.json*`, async (route) => {
|
||||||
@@ -88,6 +102,7 @@ export const widgetTest = test.extend<MyFixtures>({
|
|||||||
await expect(
|
await expect(
|
||||||
ewPage1.getByRole("heading", { name: `Welcome ${userA}` }),
|
ewPage1.getByRole("heading", { name: `Welcome ${userA}` }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
await setDevToolElementCallDevUrl(ewPage1);
|
||||||
|
|
||||||
const brooksClientHandle = await ewPage1.evaluateHandle(() =>
|
const brooksClientHandle = await ewPage1.evaluateHandle(() =>
|
||||||
window.mxMatrixClientPeg.get(),
|
window.mxMatrixClientPeg.get(),
|
||||||
@@ -115,6 +130,7 @@ export const widgetTest = test.extend<MyFixtures>({
|
|||||||
await expect(
|
await expect(
|
||||||
ewPage2.getByRole("heading", { name: `Welcome ${userB}` }),
|
ewPage2.getByRole("heading", { name: `Welcome ${userB}` }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
await setDevToolElementCallDevUrl(ewPage2);
|
||||||
|
|
||||||
const whistlerClientHandle = await ewPage2.evaluateHandle(() =>
|
const whistlerClientHandle = await ewPage2.evaluateHandle(() =>
|
||||||
window.mxMatrixClientPeg.get(),
|
window.mxMatrixClientPeg.get(),
|
||||||
|
|||||||
10
playwright/global.d.ts
vendored
10
playwright/global.d.ts
vendored
@@ -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.
|
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 {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
mxMatrixClientPeg: {
|
mxMatrixClientPeg: {
|
||||||
get(): Matrix.MatrixClient;
|
get(): Matrix.MatrixClient;
|
||||||
};
|
};
|
||||||
|
mxSettingsStore: {
|
||||||
|
setValue: (
|
||||||
|
settingKey: string,
|
||||||
|
room: string | null,
|
||||||
|
level: string,
|
||||||
|
setting: string,
|
||||||
|
) => void;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user