mirror of
https://github.com/vector-im/element-call.git
synced 2026-11-19 09:32:29 +08:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
323892a7ce | ||
|
|
0b0dd09225 | ||
|
|
b0941685ce | ||
|
|
164e620603 | ||
|
|
3d12c082f1 | ||
|
|
4eccc19b46 | ||
|
|
94583130b5 | ||
|
|
fc3941f3a8 | ||
|
|
c6f829e861 | ||
|
|
2dbd902c3c |
@@ -1,16 +1,7 @@
|
|||||||
name: Prevent blocked
|
name: Prevent blocked
|
||||||
on:
|
on:
|
||||||
# zizmor: ignore[dangerous-triggers]
|
|
||||||
# Reason: This workflow does not checkout code or use secrets.
|
|
||||||
# It only reads labels to set a failure status on the PR.
|
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, labeled, unlabeled, synchronize]
|
types: [opened, labeled, unlabeled, synchronize]
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: read
|
|
||||||
# Required to fail the check on the PR
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prevent-blocked:
|
prevent-blocked:
|
||||||
name: Prevent blocked
|
name: Prevent blocked
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Connect to Tailscale
|
- name: Connect to Tailscale
|
||||||
uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4
|
uses: tailscale/github-action@53acf823325fe9ca47f4cdaa951f90b4b0de5bb9 # v4
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
with:
|
with:
|
||||||
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
|
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: "yarn install --immutable"
|
run: "yarn install --immutable"
|
||||||
- name: Build Element Call
|
- name: Build Element Call
|
||||||
run: yarn run build:"$PACKAGE":"$BUILD_MODE"
|
run: ${{ format('yarn run build:{0}:{1}', inputs.package, inputs.build_mode) }}
|
||||||
env:
|
env:
|
||||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||||
@@ -54,8 +54,6 @@ jobs:
|
|||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
VITE_APP_VERSION: ${{ inputs.vite_app_version }}
|
VITE_APP_VERSION: ${{ inputs.vite_app_version }}
|
||||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||||
PACKAGE: ${{ inputs.package }}
|
|
||||||
BUILD_MODE: ${{ inputs.build_mode }}
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
name: PR changelog label
|
name: PR changelog label
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# zizmor: ignore[dangerous-triggers]
|
|
||||||
# This is safe because we do not use actions/checkout or execute untrusted code.
|
|
||||||
# Using pull_request_target is necessary to allow status writes for PRs from forks.
|
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [labeled, unlabeled, opened]
|
types: [labeled, unlabeled, opened]
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pr-changelog-label:
|
pr-changelog-label:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
name: Deploy previews for PRs
|
name: Deploy previews for PRs
|
||||||
on:
|
on:
|
||||||
# zizmor: ignore[dangerous-triggers]
|
|
||||||
# Reason: This is now restricted to internal PRs only using the 'if' condition below.
|
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: ["Build"]
|
workflows: ["Build"]
|
||||||
types:
|
types:
|
||||||
@@ -9,14 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prdetails:
|
prdetails:
|
||||||
# Logic:
|
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
|
||||||
# 1. Build must be successful
|
|
||||||
# 2. Event must be a pull_request
|
|
||||||
# 3. Head repository must be the SAME as the base repository (No Forks!)
|
|
||||||
if: >
|
|
||||||
github.event.workflow_run.conclusion == 'success' &&
|
|
||||||
github.event.workflow_run.event == 'pull_request' &&
|
|
||||||
github.event.workflow_run.head_repository.full_name == github.repository
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
pr_number: ${{ steps.prdetails.outputs.pr_id }}
|
pr_number: ${{ steps.prdetails.outputs.pr_id }}
|
||||||
|
|||||||
@@ -22,18 +22,8 @@ jobs:
|
|||||||
TAG: ${{ steps.tag.outputs.TAG }}
|
TAG: ${{ steps.tag.outputs.TAG }}
|
||||||
steps:
|
steps:
|
||||||
- name: Calculate VERSION
|
- name: Calculate VERSION
|
||||||
# Safely store dynamic values in environment variables
|
# We should only use the hard coded test value for a dry run
|
||||||
# to prevent shell injection (template-injection)
|
run: echo "VERSION=${{ github.event_name == 'release' && github.event.release.tag_name || 'v0.0.0-pre.0' }}" >> "$GITHUB_ENV"
|
||||||
run: |
|
|
||||||
# The logic is executed within the shell using the env variables
|
|
||||||
if [ "$EVENT_NAME" = "release" ]; then
|
|
||||||
echo "VERSION=$RELEASE_TAG" >> "$GITHUB_ENV"
|
|
||||||
else
|
|
||||||
echo "VERSION=v0.0.0-pre.0" >> "$GITHUB_ENV"
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
|
||||||
- id: dry_run
|
- id: dry_run
|
||||||
name: Set DRY_RUN
|
name: Set DRY_RUN
|
||||||
# We perform a dry run for all events except releases.
|
# We perform a dry run for all events except releases.
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Run zizmor 🌈
|
- name: Run zizmor 🌈
|
||||||
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
|
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0
|
||||||
|
|||||||
+4
-9
@@ -79,7 +79,7 @@
|
|||||||
"@vector-im/compound-design-tokens": "^6.0.0",
|
"@vector-im/compound-design-tokens": "^6.0.0",
|
||||||
"@vector-im/compound-web": "^8.0.0",
|
"@vector-im/compound-web": "^8.0.0",
|
||||||
"@vitejs/plugin-react": "^4.0.1",
|
"@vitejs/plugin-react": "^4.0.1",
|
||||||
"@vitest/coverage-v8": "^4.0.18",
|
"@vitest/coverage-v8": "^3.0.0",
|
||||||
"babel-plugin-transform-vite-meta-env": "^1.0.3",
|
"babel-plugin-transform-vite-meta-env": "^1.0.3",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
@@ -128,22 +128,17 @@
|
|||||||
"unique-names-generator": "^4.6.0",
|
"unique-names-generator": "^4.6.0",
|
||||||
"uuid": "^13.0.0",
|
"uuid": "^13.0.0",
|
||||||
"vaul": "^1.0.0",
|
"vaul": "^1.0.0",
|
||||||
"vite": "^7.3.0",
|
"vite": "^7.0.0",
|
||||||
"vite-plugin-generate-file": "^0.3.0",
|
"vite-plugin-generate-file": "^0.3.0",
|
||||||
"vite-plugin-html": "^3.2.2",
|
"vite-plugin-html": "^3.2.2",
|
||||||
"vite-plugin-node-stdlib-browser": "^0.2.1",
|
"vite-plugin-node-stdlib-browser": "^0.2.1",
|
||||||
"vite-plugin-svgr": "^4.0.0",
|
"vite-plugin-svgr": "^4.0.0",
|
||||||
"vitest": "^4.0.18",
|
"vitest": "^3.0.0",
|
||||||
"vitest-axe": "^1.0.0-pre.3"
|
"vitest-axe": "^1.0.0-pre.3"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@livekit/components-core/rxjs": "^7.8.1",
|
"@livekit/components-core/rxjs": "^7.8.1",
|
||||||
"@livekit/track-processors/@mediapipe/tasks-vision": "^0.10.18",
|
"@livekit/track-processors/@mediapipe/tasks-vision": "^0.10.18"
|
||||||
"minimatch": "^10.2.3",
|
|
||||||
"tar": "^7.5.11",
|
|
||||||
"glob": "^10.5.0",
|
|
||||||
"qs": "^6.14.1",
|
|
||||||
"js-yaml": "^4.1.1"
|
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.7.0"
|
"packageManager": "yarn@4.7.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ test("Start a new call then leave and show the feedback screen", async ({
|
|||||||
await expect(page.getByTestId("lobby_joinCall")).toBeVisible();
|
await expect(page.getByTestId("lobby_joinCall")).toBeVisible();
|
||||||
|
|
||||||
// Check the button toolbar
|
// Check the button toolbar
|
||||||
// await expect(page.getByRole('switch', { name: 'Mute microphone' })).toBeVisible();
|
// await expect(page.getByRole('button', { name: 'Mute microphone' })).toBeVisible();
|
||||||
// await expect(page.getByRole('switch', { name: 'Stop video' })).toBeVisible();
|
// await expect(page.getByRole('button', { name: 'Stop video' })).toBeVisible();
|
||||||
await expect(page.getByRole("button", { name: "Settings" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "Settings" })).toBeVisible();
|
||||||
await expect(page.getByRole("button", { name: "End call" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "End call" })).toBeVisible();
|
||||||
|
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ test("can only interact with header and footer while reconnecting", async ({
|
|||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// Tab order should jump directly from header to footer, skipping media tiles
|
// Tab order should jump directly from header to footer, skipping media tiles
|
||||||
await page.getByRole("switch", { name: "Mute microphone" }).focus();
|
await page.getByRole("button", { name: "Mute microphone" }).focus();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("switch", { name: "Mute microphone" }),
|
page.getByRole("button", { name: "Mute microphone" }),
|
||||||
).toBeFocused();
|
).toBeFocused();
|
||||||
await page.keyboard.press("Tab");
|
await page.keyboard.press("Tab");
|
||||||
await expect(page.getByRole("switch", { name: "Stop video" })).toBeFocused();
|
await expect(page.getByRole("button", { name: "Stop video" })).toBeFocused();
|
||||||
// Most critically, we should be able to press the hangup button
|
// Most critically, we should be able to press the hangup button
|
||||||
await page.getByRole("button", { name: "End call" }).click();
|
await page.getByRole("button", { name: "End call" }).click();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,10 +55,13 @@ widgetTest("Create and join a group call", async ({ addUser, browserName }) => {
|
|||||||
const frame = user.page
|
const frame = user.page
|
||||||
.locator('iframe[title="Element Call"]')
|
.locator('iframe[title="Element Call"]')
|
||||||
.contentFrame();
|
.contentFrame();
|
||||||
|
|
||||||
// No lobby, should start with video on
|
// No lobby, should start with video on
|
||||||
await expect(
|
// The only way to know if it is muted or not is to look at the data-kind attribute..
|
||||||
frame.getByRole("switch", { name: "Stop video", checked: true }),
|
const videoButton = frame.getByTestId("incall_videomute");
|
||||||
).toBeVisible();
|
await expect(videoButton).toBeVisible();
|
||||||
|
// video should be on
|
||||||
|
await expect(videoButton).toHaveAttribute("aria-label", /^Stop video$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should see 5 video tiles everywhere now
|
// We should see 5 video tiles everywhere now
|
||||||
@@ -98,15 +101,13 @@ widgetTest("Create and join a group call", async ({ addUser, browserName }) => {
|
|||||||
const florianFrame = florian.page
|
const florianFrame = florian.page
|
||||||
.locator('iframe[title="Element Call"]')
|
.locator('iframe[title="Element Call"]')
|
||||||
.contentFrame();
|
.contentFrame();
|
||||||
const florianVideoButton = florianFrame.getByRole("switch", {
|
const florianMuteButton = florianFrame.getByTestId("incall_videomute");
|
||||||
name: /video/,
|
await florianMuteButton.click();
|
||||||
});
|
|
||||||
await expect(florianVideoButton).toHaveAccessibleName("Stop video");
|
|
||||||
await expect(florianVideoButton).toBeChecked();
|
|
||||||
await florianVideoButton.click();
|
|
||||||
// Now the button should indicate we can start video
|
// Now the button should indicate we can start video
|
||||||
await expect(florianVideoButton).toHaveAccessibleName("Start video");
|
await expect(florianMuteButton).toHaveAttribute(
|
||||||
await expect(florianVideoButton).not.toBeChecked();
|
"aria-label",
|
||||||
|
/^Start video$/,
|
||||||
|
);
|
||||||
|
|
||||||
// wait a bit for the state to propagate
|
// wait a bit for the state to propagate
|
||||||
await valere.page.waitForTimeout(3000);
|
await valere.page.waitForTimeout(3000);
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2026 Element Creations Ltd.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
||||||
Please see LICENSE in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { expect, test } from "@playwright/test";
|
|
||||||
|
|
||||||
import { widgetTest } from "../fixtures/widget-user.ts";
|
|
||||||
import { HOST1, TestHelpers } from "./test-helpers.ts";
|
|
||||||
|
|
||||||
widgetTest("Footer interaction in PiP", async ({ addUser, browserName }) => {
|
|
||||||
test.skip(
|
|
||||||
browserName === "firefox",
|
|
||||||
"The is test is not working on firefox CI environment. No mic/audio device inputs so cam/mic are disabled",
|
|
||||||
);
|
|
||||||
|
|
||||||
test.slow();
|
|
||||||
|
|
||||||
const valere = await addUser("Valere", HOST1);
|
|
||||||
|
|
||||||
const callRoom = "CallRoom";
|
|
||||||
await TestHelpers.createRoom("CallRoom", valere.page);
|
|
||||||
|
|
||||||
await TestHelpers.createRoom("OtherRoom", valere.page);
|
|
||||||
|
|
||||||
await TestHelpers.switchToRoomNamed(valere.page, callRoom);
|
|
||||||
|
|
||||||
// Start the call as Valere
|
|
||||||
await TestHelpers.startCallInCurrentRoom(valere.page, false);
|
|
||||||
await expect(
|
|
||||||
valere.page.locator('iframe[title="Element Call"]'),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
await TestHelpers.joinCallFromLobby(valere.page);
|
|
||||||
// wait a bit so that the PIP has rendered
|
|
||||||
await valere.page.waitForTimeout(600);
|
|
||||||
|
|
||||||
// Switch to the other room, the call should go to PIP
|
|
||||||
await TestHelpers.switchToRoomNamed(valere.page, "OtherRoom");
|
|
||||||
|
|
||||||
// We should see the PIP overlay
|
|
||||||
const iFrame = valere.page
|
|
||||||
.locator('iframe[title="Element Call"]')
|
|
||||||
.contentFrame();
|
|
||||||
|
|
||||||
{
|
|
||||||
// Check for a bug where the video had the wrong fit in PIP
|
|
||||||
const audioBtn = iFrame.getByRole("switch", { name: /microphone/ });
|
|
||||||
const videoBtn = iFrame.getByRole("switch", { name: /video/ });
|
|
||||||
await expect(
|
|
||||||
iFrame.getByRole("button", { name: "End call" }),
|
|
||||||
).toBeVisible();
|
|
||||||
await expect(audioBtn).toBeVisible();
|
|
||||||
await expect(videoBtn).toBeVisible();
|
|
||||||
await expect(audioBtn).toHaveAccessibleName("Mute microphone");
|
|
||||||
await expect(audioBtn).toBeChecked();
|
|
||||||
await expect(videoBtn).toHaveAccessibleName("Stop video");
|
|
||||||
await expect(videoBtn).toBeChecked();
|
|
||||||
|
|
||||||
await videoBtn.click();
|
|
||||||
await audioBtn.click();
|
|
||||||
|
|
||||||
// stop hovering on any of the buttons
|
|
||||||
await iFrame.getByTestId("videoTile").hover();
|
|
||||||
|
|
||||||
await expect(audioBtn).toHaveAccessibleName("Unmute microphone");
|
|
||||||
await expect(audioBtn).toBeChecked();
|
|
||||||
await expect(videoBtn).toHaveAccessibleName("Start video");
|
|
||||||
await expect(videoBtn).not.toBeChecked();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -40,20 +40,22 @@ widgetTest("Put call in PIP", async ({ addUser, browserName }) => {
|
|||||||
|
|
||||||
await TestHelpers.joinCallInCurrentRoom(timo.page);
|
await TestHelpers.joinCallInCurrentRoom(timo.page);
|
||||||
|
|
||||||
const frame = timo.page
|
{
|
||||||
.locator('iframe[title="Element Call"]')
|
const frame = timo.page
|
||||||
.contentFrame();
|
.locator('iframe[title="Element Call"]')
|
||||||
|
.contentFrame();
|
||||||
|
|
||||||
// check that the video is on
|
const videoButton = frame.getByTestId("incall_videomute");
|
||||||
await expect(
|
await expect(videoButton).toBeVisible();
|
||||||
frame.getByRole("switch", { name: "Stop video", checked: true }),
|
// check that the video is on
|
||||||
).toBeVisible();
|
await expect(videoButton).toHaveAttribute("aria-label", /^Stop video$/);
|
||||||
|
}
|
||||||
|
|
||||||
// Switch to the other room, the call should go to PIP
|
// Switch to the other room, the call should go to PIP
|
||||||
await TestHelpers.switchToRoomNamed(valere.page, "DoubleTask");
|
await TestHelpers.switchToRoomNamed(valere.page, "DoubleTask");
|
||||||
|
|
||||||
// We should see the PIP overlay
|
// We should see the PIP overlay
|
||||||
await expect(valere.page.getByTestId("widget-pip-container")).toBeVisible();
|
await expect(valere.page.locator(".mx_WidgetPip_overlay")).toBeVisible();
|
||||||
|
|
||||||
{
|
{
|
||||||
// wait a bit so that the PIP has rendered the video
|
// wait a bit so that the PIP has rendered the video
|
||||||
|
|||||||
@@ -51,36 +51,34 @@ widgetTest(
|
|||||||
.contentFrame();
|
.contentFrame();
|
||||||
|
|
||||||
// ASSERT the button states for whistler (the callee)
|
// ASSERT the button states for whistler (the callee)
|
||||||
// video should be off by default in a voice call
|
{
|
||||||
await expect(
|
// The only way to know if it is muted or not is to look at the data-kind attribute..
|
||||||
whistlerFrame.getByRole("switch", {
|
const videoButton = whistlerFrame.getByTestId("incall_videomute");
|
||||||
name: "Start video",
|
// video should be off by default in a voice call
|
||||||
checked: false,
|
await expect(videoButton).toHaveAttribute("aria-label", /^Start video$/);
|
||||||
}),
|
|
||||||
).toBeVisible();
|
const audioButton = whistlerFrame.getByTestId("incall_mute");
|
||||||
// audio should be on for the voice call
|
// audio should be on for the voice call
|
||||||
await expect(
|
await expect(audioButton).toHaveAttribute(
|
||||||
whistlerFrame.getByRole("switch", {
|
"aria-label",
|
||||||
name: "Mute microphone",
|
/^Mute microphone$/,
|
||||||
checked: true,
|
);
|
||||||
}),
|
}
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// ASSERT the button states for brools (the caller)
|
// ASSERT the button states for brools (the caller)
|
||||||
// video should be off by default in a voice call
|
{
|
||||||
await expect(
|
// The only way to know if it is muted or not is to look at the data-kind attribute..
|
||||||
whistlerFrame.getByRole("switch", {
|
const videoButton = brooksFrame.getByTestId("incall_videomute");
|
||||||
name: "Start video",
|
// video should be off by default in a voice call
|
||||||
checked: false,
|
await expect(videoButton).toHaveAttribute("aria-label", /^Start video$/);
|
||||||
}),
|
|
||||||
).toBeVisible();
|
const audioButton = brooksFrame.getByTestId("incall_mute");
|
||||||
// audio should be on for the voice call
|
// audio should be on for the voice call
|
||||||
await expect(
|
await expect(audioButton).toHaveAttribute(
|
||||||
whistlerFrame.getByRole("switch", {
|
"aria-label",
|
||||||
name: "Mute microphone",
|
/^Mute microphone$/,
|
||||||
checked: true,
|
);
|
||||||
}),
|
}
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// In order to confirm that the call is disconnected we will check that the message composer is shown again.
|
// In order to confirm that the call is disconnected we will check that the message composer is shown again.
|
||||||
// So first we need to confirm that it is hidden when in the call.
|
// So first we need to confirm that it is hidden when in the call.
|
||||||
@@ -92,7 +90,10 @@ widgetTest(
|
|||||||
).not.toBeVisible();
|
).not.toBeVisible();
|
||||||
|
|
||||||
// ASSERT hanging up on one side ends the call for both
|
// ASSERT hanging up on one side ends the call for both
|
||||||
await brooksFrame.getByRole("button", { name: "End call" }).click();
|
{
|
||||||
|
const hangupButton = brooksFrame.getByTestId("incall_leave");
|
||||||
|
await hangupButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
// The widget should be closed on both sides and the timeline should be back on screen
|
// The widget should be closed on both sides and the timeline should be back on screen
|
||||||
await expect(
|
await expect(
|
||||||
@@ -141,30 +142,34 @@ widgetTest(
|
|||||||
.contentFrame();
|
.contentFrame();
|
||||||
|
|
||||||
// ASSERT the button states for whistler (the callee)
|
// ASSERT the button states for whistler (the callee)
|
||||||
// video should be off by default in a video call
|
{
|
||||||
await expect(
|
// The only way to know if it is muted or not is to look at the data-kind attribute..
|
||||||
whistlerFrame.getByRole("switch", { name: "Stop video", checked: true }),
|
const videoButton = whistlerFrame.getByTestId("incall_videomute");
|
||||||
).toBeVisible();
|
// video should be on by default in a voice call
|
||||||
// audio should be on too
|
await expect(videoButton).toHaveAttribute("aria-label", /^Stop video$/);
|
||||||
await expect(
|
|
||||||
whistlerFrame.getByRole("switch", {
|
const audioButton = whistlerFrame.getByTestId("incall_mute");
|
||||||
name: "Mute microphone",
|
// audio should be on for the voice call
|
||||||
checked: true,
|
await expect(audioButton).toHaveAttribute(
|
||||||
}),
|
"aria-label",
|
||||||
).toBeVisible();
|
/^Mute microphone$/,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ASSERT the button states for brools (the caller)
|
// ASSERT the button states for brools (the caller)
|
||||||
// video should be off by default in a video call
|
{
|
||||||
await expect(
|
// The only way to know if it is muted or not is to look at the data-kind attribute..
|
||||||
whistlerFrame.getByRole("switch", { name: "Stop video", checked: true }),
|
const videoButton = brooksFrame.getByTestId("incall_videomute");
|
||||||
).toBeVisible();
|
// video should be on by default in a voice call
|
||||||
// audio should be on too
|
await expect(videoButton).toHaveAttribute("aria-label", /^Stop video$/);
|
||||||
await expect(
|
|
||||||
whistlerFrame.getByRole("switch", {
|
const audioButton = brooksFrame.getByTestId("incall_mute");
|
||||||
name: "Mute microphone",
|
// audio should be on for the voice call
|
||||||
checked: true,
|
await expect(audioButton).toHaveAttribute(
|
||||||
}),
|
"aria-label",
|
||||||
).toBeVisible();
|
/^Mute microphone$/,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// In order to confirm that the call is disconnected we will check that the message composer is shown again.
|
// In order to confirm that the call is disconnected we will check that the message composer is shown again.
|
||||||
// So first we need to confirm that it is hidden when in the call.
|
// So first we need to confirm that it is hidden when in the call.
|
||||||
@@ -176,7 +181,10 @@ widgetTest(
|
|||||||
).not.toBeVisible();
|
).not.toBeVisible();
|
||||||
|
|
||||||
// ASSERT hanging up on one side ends the call for both
|
// ASSERT hanging up on one side ends the call for both
|
||||||
await brooksFrame.getByRole("button", { name: "End call" }).click();
|
{
|
||||||
|
const hangupButton = brooksFrame.getByTestId("incall_leave");
|
||||||
|
await hangupButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
// The widget should be closed on both sides and the timeline should be back on screen
|
// The widget should be closed on both sides and the timeline should be back on screen
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
+21
-32
@@ -22,25 +22,23 @@ import {
|
|||||||
import styles from "./Button.module.css";
|
import styles from "./Button.module.css";
|
||||||
|
|
||||||
interface MicButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface MicButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
enabled: boolean;
|
muted: boolean;
|
||||||
size?: "sm" | "lg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MicButton: FC<MicButtonProps> = ({ enabled, ...props }) => {
|
export const MicButton: FC<MicButtonProps> = ({ muted, ...props }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const Icon = enabled ? MicOnSolidIcon : MicOffSolidIcon;
|
const Icon = muted ? MicOffSolidIcon : MicOnSolidIcon;
|
||||||
const label = enabled
|
const label = muted
|
||||||
? t("mute_microphone_button_label")
|
? t("unmute_microphone_button_label")
|
||||||
: t("unmute_microphone_button_label");
|
: t("mute_microphone_button_label");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip label={label}>
|
<Tooltip label={label}>
|
||||||
<CpdButton
|
<CpdButton
|
||||||
iconOnly
|
iconOnly
|
||||||
|
aria-label={label}
|
||||||
Icon={Icon}
|
Icon={Icon}
|
||||||
kind={enabled ? "primary" : "secondary"}
|
kind={muted ? "primary" : "secondary"}
|
||||||
role="switch"
|
|
||||||
aria-checked={enabled}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -48,25 +46,23 @@ export const MicButton: FC<MicButtonProps> = ({ enabled, ...props }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface VideoButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface VideoButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
enabled: boolean;
|
muted: boolean;
|
||||||
size?: "sm" | "lg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VideoButton: FC<VideoButtonProps> = ({ enabled, ...props }) => {
|
export const VideoButton: FC<VideoButtonProps> = ({ muted, ...props }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const Icon = enabled ? VideoCallSolidIcon : VideoCallOffSolidIcon;
|
const Icon = muted ? VideoCallOffSolidIcon : VideoCallSolidIcon;
|
||||||
const label = enabled
|
const label = muted
|
||||||
? t("stop_video_button_label")
|
? t("start_video_button_label")
|
||||||
: t("start_video_button_label");
|
: t("stop_video_button_label");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip label={label}>
|
<Tooltip label={label}>
|
||||||
<CpdButton
|
<CpdButton
|
||||||
iconOnly
|
iconOnly
|
||||||
|
aria-label={label}
|
||||||
Icon={Icon}
|
Icon={Icon}
|
||||||
kind={enabled ? "primary" : "secondary"}
|
kind={muted ? "primary" : "secondary"}
|
||||||
role="switch"
|
|
||||||
aria-checked={enabled}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -75,7 +71,6 @@ export const VideoButton: FC<VideoButtonProps> = ({ enabled, ...props }) => {
|
|||||||
|
|
||||||
interface ShareScreenButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface ShareScreenButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
size: "sm" | "lg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ShareScreenButton: FC<ShareScreenButtonProps> = ({
|
export const ShareScreenButton: FC<ShareScreenButtonProps> = ({
|
||||||
@@ -93,19 +88,13 @@ export const ShareScreenButton: FC<ShareScreenButtonProps> = ({
|
|||||||
iconOnly
|
iconOnly
|
||||||
Icon={ShareScreenSolidIcon}
|
Icon={ShareScreenSolidIcon}
|
||||||
kind={enabled ? "primary" : "secondary"}
|
kind={enabled ? "primary" : "secondary"}
|
||||||
role="switch"
|
|
||||||
aria-checked={enabled}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface EndCallButtonProps extends ComponentPropsWithoutRef<"button"> {
|
export const EndCallButton: FC<ComponentPropsWithoutRef<"button">> = ({
|
||||||
size?: "sm" | "lg";
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EndCallButton: FC<EndCallButtonProps> = ({
|
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
@@ -116,6 +105,7 @@ export const EndCallButton: FC<EndCallButtonProps> = ({
|
|||||||
<CpdButton
|
<CpdButton
|
||||||
className={classNames(className, styles.endCall)}
|
className={classNames(className, styles.endCall)}
|
||||||
iconOnly
|
iconOnly
|
||||||
|
aria-label={t("hangup_button_label")}
|
||||||
Icon={EndCallIcon}
|
Icon={EndCallIcon}
|
||||||
destructive
|
destructive
|
||||||
{...props}
|
{...props}
|
||||||
@@ -124,10 +114,9 @@ export const EndCallButton: FC<EndCallButtonProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
export const SettingsButton: FC<ComponentPropsWithoutRef<"button">> = (
|
||||||
size?: "sm" | "lg";
|
props,
|
||||||
}
|
) => {
|
||||||
export const SettingsButton: FC<SettingsButtonProps> = (props) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ export function ReactionPopupMenu({
|
|||||||
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
identifier: string;
|
identifier: string;
|
||||||
vm: CallViewModel;
|
vm: CallViewModel;
|
||||||
size?: "sm" | "lg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ReactionToggleButton({
|
export function ReactionToggleButton({
|
||||||
|
|||||||
@@ -30,13 +30,7 @@ import {
|
|||||||
} from "../utils/test";
|
} from "../utils/test";
|
||||||
import { initializeWidget } from "../widget";
|
import { initializeWidget } from "../widget";
|
||||||
initializeWidget();
|
initializeWidget();
|
||||||
export const TestAudioContextConstructor = vi.fn(
|
export const TestAudioContextConstructor = vi.fn(() => testAudioContext);
|
||||||
class {
|
|
||||||
public constructor() {
|
|
||||||
return testAudioContext;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const MediaDevicesProvider = MediaDevicesContext.MediaDevicesContext.Provider;
|
const MediaDevicesProvider = MediaDevicesContext.MediaDevicesContext.Provider;
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,22 @@ Please see LICENSE in the repository root for full details.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-height: 800px) {
|
@media (max-width: 370px) {
|
||||||
.footer {
|
.shareScreen {
|
||||||
padding-block: var(--cpd-space-8x);
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-height: 400px) {
|
||||||
|
.footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 320px) {
|
||||||
|
.invite,
|
||||||
|
.raiseHand {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,27 +133,9 @@ Please see LICENSE in the repository root for full details.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 370px) {
|
@media (max-height: 800px) {
|
||||||
.shareScreen {
|
.footer {
|
||||||
display: none;
|
padding-block: var(--cpd-space-8x);
|
||||||
}
|
|
||||||
|
|
||||||
/* PIP custom css */
|
|
||||||
@media (max-height: 400px) {
|
|
||||||
.shareScreen {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
.footer {
|
|
||||||
padding-block-start: var(--cpd-space-3x);
|
|
||||||
padding-block-end: var(--cpd-space-2x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 320px) {
|
|
||||||
.invite,
|
|
||||||
.raiseHand {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-15
@@ -640,20 +640,17 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
|
|
||||||
const buttons: JSX.Element[] = [];
|
const buttons: JSX.Element[] = [];
|
||||||
|
|
||||||
const buttonSize = layout.type === "pip" ? "sm" : "lg";
|
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<MicButton
|
<MicButton
|
||||||
size={buttonSize}
|
|
||||||
key="audio"
|
key="audio"
|
||||||
enabled={audioEnabled}
|
muted={!audioEnabled}
|
||||||
onClick={toggleAudio ?? undefined}
|
onClick={toggleAudio ?? undefined}
|
||||||
disabled={toggleAudio === null}
|
disabled={toggleAudio === null}
|
||||||
data-testid="incall_mute"
|
data-testid="incall_mute"
|
||||||
/>,
|
/>,
|
||||||
<VideoButton
|
<VideoButton
|
||||||
size={buttonSize}
|
|
||||||
key="video"
|
key="video"
|
||||||
enabled={videoEnabled}
|
muted={!videoEnabled}
|
||||||
onClick={toggleVideo ?? undefined}
|
onClick={toggleVideo ?? undefined}
|
||||||
disabled={toggleVideo === null}
|
disabled={toggleVideo === null}
|
||||||
data-testid="incall_videomute"
|
data-testid="incall_videomute"
|
||||||
@@ -662,7 +659,6 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
if (vm.toggleScreenSharing !== null) {
|
if (vm.toggleScreenSharing !== null) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<ShareScreenButton
|
<ShareScreenButton
|
||||||
size={buttonSize}
|
|
||||||
key="share_screen"
|
key="share_screen"
|
||||||
className={styles.shareScreen}
|
className={styles.shareScreen}
|
||||||
enabled={sharingScreen}
|
enabled={sharingScreen}
|
||||||
@@ -674,7 +670,6 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
if (supportsReactions) {
|
if (supportsReactions) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<ReactionToggleButton
|
<ReactionToggleButton
|
||||||
size={buttonSize}
|
|
||||||
vm={vm}
|
vm={vm}
|
||||||
key="raise_hand"
|
key="raise_hand"
|
||||||
className={styles.raiseHand}
|
className={styles.raiseHand}
|
||||||
@@ -683,17 +678,10 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (layout.type !== "pip")
|
if (layout.type !== "pip")
|
||||||
buttons.push(
|
buttons.push(<SettingsButton key="settings" onClick={openSettings} />);
|
||||||
<SettingsButton
|
|
||||||
size={buttonSize}
|
|
||||||
key="settings"
|
|
||||||
onClick={openSettings}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
|
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<EndCallButton
|
<EndCallButton
|
||||||
size={buttonSize}
|
|
||||||
key="end_call"
|
key="end_call"
|
||||||
onClick={function (): void {
|
onClick={function (): void {
|
||||||
vm.hangup();
|
vm.hangup();
|
||||||
|
|||||||
@@ -230,12 +230,12 @@ export const LobbyView: FC<Props> = ({
|
|||||||
{recentsButtonInFooter && recentsButton}
|
{recentsButtonInFooter && recentsButton}
|
||||||
<div className={inCallStyles.buttons}>
|
<div className={inCallStyles.buttons}>
|
||||||
<MicButton
|
<MicButton
|
||||||
enabled={audioEnabled}
|
muted={!audioEnabled}
|
||||||
onClick={toggleAudio ?? undefined}
|
onClick={toggleAudio ?? undefined}
|
||||||
disabled={toggleAudio === null}
|
disabled={toggleAudio === null}
|
||||||
/>
|
/>
|
||||||
<VideoButton
|
<VideoButton
|
||||||
enabled={videoEnabled}
|
muted={!videoEnabled}
|
||||||
onClick={toggleVideo ?? undefined}
|
onClick={toggleVideo ?? undefined}
|
||||||
disabled={toggleVideo === null}
|
disabled={toggleVideo === null}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -285,14 +285,14 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
class="buttons"
|
class="buttons"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-checked="false"
|
|
||||||
aria-disabled="true"
|
aria-disabled="true"
|
||||||
|
aria-label="Unmute microphone"
|
||||||
aria-labelledby="_r_8_"
|
aria-labelledby="_r_8_"
|
||||||
class="_button_13vu4_8 _has-icon_13vu4_60 _icon-only_13vu4_53"
|
class="_button_13vu4_8 _has-icon_13vu4_60 _icon-only_13vu4_53"
|
||||||
data-kind="secondary"
|
data-kind="primary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
data-testid="incall_mute"
|
data-testid="incall_mute"
|
||||||
role="switch"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@@ -309,14 +309,14 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
aria-checked="false"
|
|
||||||
aria-disabled="true"
|
aria-disabled="true"
|
||||||
|
aria-label="Start video"
|
||||||
aria-labelledby="_r_d_"
|
aria-labelledby="_r_d_"
|
||||||
class="_button_13vu4_8 _has-icon_13vu4_60 _icon-only_13vu4_53"
|
class="_button_13vu4_8 _has-icon_13vu4_60 _icon-only_13vu4_53"
|
||||||
data-kind="secondary"
|
data-kind="primary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
data-testid="incall_videomute"
|
data-testid="incall_videomute"
|
||||||
role="switch"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@@ -354,6 +354,7 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
aria-label="End call"
|
||||||
aria-labelledby="_r_n_"
|
aria-labelledby="_r_n_"
|
||||||
class="_button_13vu4_8 endCall _has-icon_13vu4_60 _icon-only_13vu4_53 _destructive_13vu4_110"
|
class="_button_13vu4_8 endCall _has-icon_13vu4_60 _icon-only_13vu4_53 _destructive_13vu4_110"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
|
|||||||
@@ -5,16 +5,13 @@ 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 { afterEach, describe, expect, it, type Mock, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
import { render, waitFor, screen } from "@testing-library/react";
|
import { render, waitFor } from "@testing-library/react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import { type Room as LivekitRoom } from "livekit-client";
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
|
||||||
|
|
||||||
import type { MatrixClient } from "matrix-js-sdk";
|
import type { MatrixClient } from "matrix-js-sdk";
|
||||||
import type { Room as LivekitRoom } from "livekit-client";
|
|
||||||
import { DeveloperSettingsTab } from "./DeveloperSettingsTab";
|
import { DeveloperSettingsTab } from "./DeveloperSettingsTab";
|
||||||
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
|
||||||
import { customLivekitUrl as customLivekitUrlSetting } from "./settings";
|
|
||||||
// Mock url params hook to avoid environment-dependent snapshot churn.
|
// Mock url params hook to avoid environment-dependent snapshot churn.
|
||||||
vi.mock("../UrlParams", () => ({
|
vi.mock("../UrlParams", () => ({
|
||||||
useUrlParams: (): { mocked: boolean; answer: number } => ({
|
useUrlParams: (): { mocked: boolean; answer: number } => ({
|
||||||
@@ -23,14 +20,6 @@ vi.mock("../UrlParams", () => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// IMPORTANT: mock the same specifier used by DeveloperSettingsTab
|
|
||||||
vi.mock("../livekit/openIDSFU", () => ({
|
|
||||||
getSFUConfigWithOpenID: vi.fn().mockResolvedValue({
|
|
||||||
url: "mock-url",
|
|
||||||
jwt: "mock-jwt",
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Provide a minimal mock of a Livekit Room structure used by the component.
|
// Provide a minimal mock of a Livekit Room structure used by the component.
|
||||||
function createMockLivekitRoom(
|
function createMockLivekitRoom(
|
||||||
wsUrl: string,
|
wsUrl: string,
|
||||||
@@ -97,7 +86,6 @@ describe("DeveloperSettingsTab", () => {
|
|||||||
const { container } = render(
|
const { container } = render(
|
||||||
<DeveloperSettingsTab
|
<DeveloperSettingsTab
|
||||||
client={client}
|
client={client}
|
||||||
roomId={"#room:example.org"}
|
|
||||||
livekitRooms={livekitRooms}
|
livekitRooms={livekitRooms}
|
||||||
env={{ MY_MOCK_ENV: 10, ENV: "test" } as unknown as ImportMetaEnv}
|
env={{ MY_MOCK_ENV: 10, ENV: "test" } as unknown as ImportMetaEnv}
|
||||||
/>,
|
/>,
|
||||||
@@ -111,141 +99,4 @@ describe("DeveloperSettingsTab", () => {
|
|||||||
|
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
describe("custom livekit url", () => {
|
|
||||||
afterEach(() => {
|
|
||||||
customLivekitUrlSetting.setValue(null);
|
|
||||||
});
|
|
||||||
const client = {
|
|
||||||
doesServerSupportUnstableFeature: vi.fn().mockResolvedValue(true),
|
|
||||||
getCrypto: () => ({ getVersion: (): string => "x" }),
|
|
||||||
getUserId: () => "@u:hs",
|
|
||||||
getDeviceId: () => "DEVICE",
|
|
||||||
} as unknown as MatrixClient;
|
|
||||||
it("will not update custom livekit url without roomId", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
|
|
||||||
render(
|
|
||||||
<TooltipProvider>
|
|
||||||
<DeveloperSettingsTab
|
|
||||||
client={client}
|
|
||||||
env={{} as unknown as ImportMetaEnv}
|
|
||||||
/>
|
|
||||||
</TooltipProvider>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const input = screen.getByLabelText("Custom Livekit-url");
|
|
||||||
await user.clear(input);
|
|
||||||
await user.type(input, "wss://example.livekit.invalid");
|
|
||||||
|
|
||||||
const saveButton = screen.getByRole("button", { name: "Save" });
|
|
||||||
await user.click(saveButton);
|
|
||||||
expect(getSFUConfigWithOpenID).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
expect(customLivekitUrlSetting.getValue()).toBe(null);
|
|
||||||
});
|
|
||||||
it("will not update custom livekit url without text in input", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
|
|
||||||
render(
|
|
||||||
<TooltipProvider>
|
|
||||||
<DeveloperSettingsTab
|
|
||||||
client={client}
|
|
||||||
roomId="#testRoom"
|
|
||||||
env={{} as unknown as ImportMetaEnv}
|
|
||||||
/>
|
|
||||||
</TooltipProvider>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const input = screen.getByLabelText("Custom Livekit-url");
|
|
||||||
await user.clear(input);
|
|
||||||
|
|
||||||
const saveButton = screen.getByRole("button", { name: "Save" });
|
|
||||||
await user.click(saveButton);
|
|
||||||
expect(getSFUConfigWithOpenID).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
expect(customLivekitUrlSetting.getValue()).toBe(null);
|
|
||||||
});
|
|
||||||
it("will not update custom livekit url when pressing cancel", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
|
|
||||||
render(
|
|
||||||
<TooltipProvider>
|
|
||||||
<DeveloperSettingsTab
|
|
||||||
client={client}
|
|
||||||
roomId="#testRoom"
|
|
||||||
env={{} as unknown as ImportMetaEnv}
|
|
||||||
/>
|
|
||||||
</TooltipProvider>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const input = screen.getByLabelText("Custom Livekit-url");
|
|
||||||
await user.clear(input);
|
|
||||||
await user.type(input, "wss://example.livekit.invalid");
|
|
||||||
|
|
||||||
const cancelButton = screen.getByRole("button", {
|
|
||||||
name: "Reset overwrite",
|
|
||||||
});
|
|
||||||
await user.click(cancelButton);
|
|
||||||
expect(getSFUConfigWithOpenID).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
expect(customLivekitUrlSetting.getValue()).toBe(null);
|
|
||||||
});
|
|
||||||
it("will update custom livekit url", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
|
|
||||||
render(
|
|
||||||
<TooltipProvider>
|
|
||||||
<DeveloperSettingsTab
|
|
||||||
client={client}
|
|
||||||
roomId="#testRoom"
|
|
||||||
env={{} as unknown as ImportMetaEnv}
|
|
||||||
/>
|
|
||||||
</TooltipProvider>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const input = screen.getByLabelText("Custom Livekit-url");
|
|
||||||
await user.clear(input);
|
|
||||||
await user.type(input, "wss://example.livekit.valid");
|
|
||||||
|
|
||||||
const saveButton = screen.getByRole("button", { name: "Save" });
|
|
||||||
await user.click(saveButton);
|
|
||||||
expect(getSFUConfigWithOpenID).toHaveBeenCalledWith(
|
|
||||||
expect.anything(),
|
|
||||||
expect.anything(),
|
|
||||||
"wss://example.livekit.valid",
|
|
||||||
"#testRoom",
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(customLivekitUrlSetting.getValue()).toBe(
|
|
||||||
"wss://example.livekit.valid",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it("will show error on invalid url", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
|
|
||||||
render(
|
|
||||||
<TooltipProvider>
|
|
||||||
<DeveloperSettingsTab
|
|
||||||
client={client}
|
|
||||||
roomId="#testRoom"
|
|
||||||
env={{} as unknown as ImportMetaEnv}
|
|
||||||
/>
|
|
||||||
</TooltipProvider>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const input = screen.getByLabelText("Custom Livekit-url");
|
|
||||||
await user.clear(input);
|
|
||||||
await user.type(input, "wss://example.livekit.valid");
|
|
||||||
|
|
||||||
const saveButton = screen.getByRole("button", { name: "Save" });
|
|
||||||
(getSFUConfigWithOpenID as Mock).mockImplementation(() => {
|
|
||||||
throw new Error("Invalid URL");
|
|
||||||
});
|
|
||||||
await user.click(saveButton);
|
|
||||||
expect(
|
|
||||||
screen.getByText("invalid URL (did not update)"),
|
|
||||||
).toBeInTheDocument();
|
|
||||||
expect(customLivekitUrlSetting.getValue()).toBe(null);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import {
|
|||||||
import { logger } from "matrix-js-sdk/lib/logger";
|
import { logger } from "matrix-js-sdk/lib/logger";
|
||||||
import {
|
import {
|
||||||
EditInPlace,
|
EditInPlace,
|
||||||
ErrorMessage,
|
|
||||||
Root as Form,
|
Root as Form,
|
||||||
Heading,
|
Heading,
|
||||||
HelpMessage,
|
HelpMessage,
|
||||||
@@ -46,11 +45,9 @@ import {
|
|||||||
} from "./settings";
|
} from "./settings";
|
||||||
import styles from "./DeveloperSettingsTab.module.css";
|
import styles from "./DeveloperSettingsTab.module.css";
|
||||||
import { useUrlParams } from "../UrlParams";
|
import { useUrlParams } from "../UrlParams";
|
||||||
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
client: MatrixClient;
|
client: MatrixClient;
|
||||||
roomId?: string;
|
|
||||||
livekitRooms?: {
|
livekitRooms?: {
|
||||||
room: LivekitRoom;
|
room: LivekitRoom;
|
||||||
url: string;
|
url: string;
|
||||||
@@ -63,7 +60,6 @@ interface Props {
|
|||||||
export const DeveloperSettingsTab: FC<Props> = ({
|
export const DeveloperSettingsTab: FC<Props> = ({
|
||||||
client,
|
client,
|
||||||
livekitRooms,
|
livekitRooms,
|
||||||
roomId,
|
|
||||||
env,
|
env,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -101,8 +97,6 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
alwaysShowIphoneEarpieceSetting,
|
alwaysShowIphoneEarpieceSetting,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [customLivekitUrlUpdateError, setCustomLivekitUrlUpdateError] =
|
|
||||||
useState<string | null>(null);
|
|
||||||
const [customLivekitUrl, setCustomLivekitUrl] = useSetting(
|
const [customLivekitUrl, setCustomLivekitUrl] = useSetting(
|
||||||
customLivekitUrlSetting,
|
customLivekitUrlSetting,
|
||||||
);
|
);
|
||||||
@@ -240,36 +234,14 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
savingLabel={t("developer_mode.custom_livekit_url.saving")}
|
savingLabel={t("developer_mode.custom_livekit_url.saving")}
|
||||||
cancelButtonLabel={t("developer_mode.custom_livekit_url.reset")}
|
cancelButtonLabel={t("developer_mode.custom_livekit_url.reset")}
|
||||||
onSave={useCallback(
|
onSave={useCallback(
|
||||||
async (e: React.FormEvent<HTMLFormElement>): Promise<void> => {
|
(e: React.FormEvent<HTMLFormElement>) => {
|
||||||
if (
|
setCustomLivekitUrl(
|
||||||
roomId === undefined ||
|
customLivekitUrlTextBuffer === ""
|
||||||
customLivekitUrlTextBuffer === "" ||
|
? null
|
||||||
customLivekitUrlTextBuffer === null
|
: customLivekitUrlTextBuffer,
|
||||||
) {
|
);
|
||||||
setCustomLivekitUrl(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const userId = client.getUserId();
|
|
||||||
const deviceId = client.getDeviceId();
|
|
||||||
|
|
||||||
if (userId === null || deviceId === null) {
|
|
||||||
throw new Error("Invalid user or device ID");
|
|
||||||
}
|
|
||||||
await getSFUConfigWithOpenID(
|
|
||||||
client,
|
|
||||||
{ userId, deviceId, memberId: "" },
|
|
||||||
customLivekitUrlTextBuffer,
|
|
||||||
roomId,
|
|
||||||
);
|
|
||||||
setCustomLivekitUrlUpdateError(null);
|
|
||||||
setCustomLivekitUrl(customLivekitUrlTextBuffer);
|
|
||||||
} catch {
|
|
||||||
setCustomLivekitUrlUpdateError("invalid URL (did not update)");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[customLivekitUrlTextBuffer, setCustomLivekitUrl, client, roomId],
|
[setCustomLivekitUrl, customLivekitUrlTextBuffer],
|
||||||
)}
|
)}
|
||||||
value={customLivekitUrlTextBuffer ?? ""}
|
value={customLivekitUrlTextBuffer ?? ""}
|
||||||
onChange={useCallback(
|
onChange={useCallback(
|
||||||
@@ -284,12 +256,7 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
},
|
},
|
||||||
[setCustomLivekitUrl],
|
[setCustomLivekitUrl],
|
||||||
)}
|
)}
|
||||||
serverInvalid={customLivekitUrlUpdateError !== null}
|
/>
|
||||||
>
|
|
||||||
{customLivekitUrlUpdateError !== null && (
|
|
||||||
<ErrorMessage>{customLivekitUrlUpdateError}</ErrorMessage>
|
|
||||||
)}
|
|
||||||
</EditInPlace>
|
|
||||||
<Heading as="h3" type="body" weight="semibold" size="lg">
|
<Heading as="h3" type="body" weight="semibold" size="lg">
|
||||||
{t("developer_mode.matrixRTCMode.title")}
|
{t("developer_mode.matrixRTCMode.title")}
|
||||||
</Heading>
|
</Heading>
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
env={import.meta.env}
|
env={import.meta.env}
|
||||||
client={client}
|
client={client}
|
||||||
livekitRooms={livekitRooms}
|
livekitRooms={livekitRooms}
|
||||||
roomId={roomId}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,20 +34,15 @@ export class Setting<T> {
|
|||||||
|
|
||||||
this._value$ = new BehaviorSubject(initialValue);
|
this._value$ = new BehaviorSubject(initialValue);
|
||||||
this.value$ = this._value$;
|
this.value$ = this._value$;
|
||||||
this._lastUpdateReason$ = new BehaviorSubject<string | null>(null);
|
|
||||||
this.lastUpdateReason$ = this._lastUpdateReason$;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly key: string;
|
private readonly key: string;
|
||||||
|
|
||||||
private readonly _value$: BehaviorSubject<T>;
|
private readonly _value$: BehaviorSubject<T>;
|
||||||
private readonly _lastUpdateReason$: BehaviorSubject<string | null>;
|
|
||||||
public readonly value$: Behavior<T>;
|
public readonly value$: Behavior<T>;
|
||||||
public readonly lastUpdateReason$: Behavior<string | null>;
|
|
||||||
|
|
||||||
public readonly setValue = (value: T, reason?: string): void => {
|
public readonly setValue = (value: T): void => {
|
||||||
this._value$.next(value);
|
this._value$.next(value);
|
||||||
this._lastUpdateReason$.next(reason ?? null);
|
|
||||||
localStorage.setItem(this.key, JSON.stringify(value));
|
localStorage.setItem(this.key, JSON.stringify(value));
|
||||||
};
|
};
|
||||||
public readonly getValue = (): T => {
|
public readonly getValue = (): T => {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import {
|
|||||||
playReactionsSound,
|
playReactionsSound,
|
||||||
showReactions,
|
showReactions,
|
||||||
} from "../../settings/settings";
|
} from "../../settings/settings";
|
||||||
import { isFirefox, platform } from "../../Platform";
|
import { isFirefox } from "../../Platform";
|
||||||
import { setPipEnabled$ } from "../../controls";
|
import { setPipEnabled$ } from "../../controls";
|
||||||
import { TileStore } from "../TileStore";
|
import { TileStore } from "../TileStore";
|
||||||
import { gridLikeLayout } from "../GridLikeLayout";
|
import { gridLikeLayout } from "../GridLikeLayout";
|
||||||
@@ -1271,7 +1271,7 @@ export function createCallViewModel$(
|
|||||||
switchMap((mode) => {
|
switchMap((mode) => {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case "pip":
|
case "pip":
|
||||||
return of(platform === "desktop" ? true : false);
|
return of(false);
|
||||||
case "normal":
|
case "normal":
|
||||||
case "narrow":
|
case "narrow":
|
||||||
return of(true);
|
return of(true);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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 { platform } from "../Platform.ts";
|
|
||||||
import { type PipLayout, type PipLayoutMedia } from "./layout-types.ts";
|
import { type PipLayout, type PipLayoutMedia } from "./layout-types.ts";
|
||||||
import { type TileStore } from "./TileStore";
|
import { type TileStore } from "./TileStore";
|
||||||
|
|
||||||
@@ -17,11 +16,7 @@ export function pipLayout(
|
|||||||
prevTiles: TileStore,
|
prevTiles: TileStore,
|
||||||
): [PipLayout, TileStore] {
|
): [PipLayout, TileStore] {
|
||||||
const update = prevTiles.from(0);
|
const update = prevTiles.from(0);
|
||||||
// Dont maximise in pip on EW since we want the rounded corners and the footer
|
update.registerSpotlight(media.spotlight, true);
|
||||||
update.registerSpotlight(
|
|
||||||
media.spotlight,
|
|
||||||
platform === "desktop" ? false : true,
|
|
||||||
);
|
|
||||||
const tiles = update.build();
|
const tiles = update.build();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,18 +90,11 @@ export const testAudioContext = {
|
|||||||
createStereoPanner: vi.fn().mockReturnValue(panNode),
|
createStereoPanner: vi.fn().mockReturnValue(panNode),
|
||||||
close: vi.fn().mockResolvedValue(undefined),
|
close: vi.fn().mockResolvedValue(undefined),
|
||||||
};
|
};
|
||||||
|
export const TestAudioContextConstructor = vi.fn(() => testAudioContext);
|
||||||
const TestAudioContext = vi.fn(
|
|
||||||
class {
|
|
||||||
public constructor() {
|
|
||||||
return testAudioContext;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let user: UserEvent;
|
let user: UserEvent;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.stubGlobal("AudioContext", TestAudioContext);
|
vi.stubGlobal("AudioContext", TestAudioContextConstructor);
|
||||||
user = userEvent.setup();
|
user = userEvent.setup();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -443,10 +443,10 @@ export class MockRTCSession extends TypedEventEmitter<
|
|||||||
public asMockedSession(): MockedObject<MatrixRTCSession> {
|
public asMockedSession(): MockedObject<MatrixRTCSession> {
|
||||||
const session = this as unknown as MockedObject<MatrixRTCSession>;
|
const session = this as unknown as MockedObject<MatrixRTCSession>;
|
||||||
|
|
||||||
session.reemitEncryptionKeys = vi
|
vi.mocked(session).reemitEncryptionKeys = vi
|
||||||
.fn<() => void>()
|
.fn<() => void>()
|
||||||
.mockReturnValue(undefined);
|
.mockReturnValue(undefined);
|
||||||
session.getOldestMembership = vi
|
vi.mocked(session).getOldestMembership = vi
|
||||||
.fn<() => CallMembership | undefined>()
|
.fn<() => CallMembership | undefined>()
|
||||||
.mockReturnValue(this.memberships[0]);
|
.mockReturnValue(this.memberships[0]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user