mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-25 22:35:49 +00:00
Expand GridTile test coverage
This commit is contained in:
@@ -5,7 +5,10 @@ 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 RemoteTrackPublication } from "livekit-client";
|
import {
|
||||||
|
type LocalTrackPublication,
|
||||||
|
type RemoteTrackPublication,
|
||||||
|
} from "livekit-client";
|
||||||
import { test, expect } from "vitest";
|
import { test, expect } from "vitest";
|
||||||
import { act, render, screen } from "@testing-library/react";
|
import { act, render, screen } from "@testing-library/react";
|
||||||
import { axe } from "vitest-axe";
|
import { axe } from "vitest-axe";
|
||||||
@@ -17,6 +20,9 @@ import {
|
|||||||
mockRtcMembership,
|
mockRtcMembership,
|
||||||
mockRemoteMedia,
|
mockRemoteMedia,
|
||||||
mockRemoteParticipant,
|
mockRemoteParticipant,
|
||||||
|
mockLocalMedia,
|
||||||
|
mockLocalParticipant,
|
||||||
|
mockMediaDevices,
|
||||||
} from "../utils/test";
|
} from "../utils/test";
|
||||||
import { GridTileViewModel } from "../state/TileViewModel";
|
import { GridTileViewModel } from "../state/TileViewModel";
|
||||||
import { ReactionsSenderProvider } from "../reactions/useReactionsSender";
|
import { ReactionsSenderProvider } from "../reactions/useReactionsSender";
|
||||||
@@ -54,7 +60,7 @@ const callVm = {
|
|||||||
handsRaised$: constant({}),
|
handsRaised$: constant({}),
|
||||||
} as Partial<CallViewModel> as CallViewModel;
|
} as Partial<CallViewModel> as CallViewModel;
|
||||||
|
|
||||||
test("GridTile is accessible", async () => {
|
test("GridTile displays remote media", async () => {
|
||||||
const vm = mockRemoteMedia(
|
const vm = mockRemoteMedia(
|
||||||
mockRtcMembership("@alice:example.org", "AAAA"),
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
||||||
{
|
{
|
||||||
@@ -88,6 +94,40 @@ test("GridTile is accessible", async () => {
|
|||||||
screen.getByText("Alice");
|
screen.getByText("Alice");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("GridTile displays local media", async () => {
|
||||||
|
const vm = mockLocalMedia(
|
||||||
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
||||||
|
{
|
||||||
|
rawDisplayName: "Alice",
|
||||||
|
getMxcAvatarUrl: () => "mxc://adfsg",
|
||||||
|
},
|
||||||
|
mockLocalParticipant({
|
||||||
|
getTrackPublication: () =>
|
||||||
|
({}) as Partial<LocalTrackPublication> as LocalTrackPublication,
|
||||||
|
}),
|
||||||
|
mockMediaDevices({}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const { container } = render(
|
||||||
|
<ReactionsSenderProvider vm={callVm} rtcSession={fakeRtcSession}>
|
||||||
|
<GridTile
|
||||||
|
vm={new GridTileViewModel(constant(vm))}
|
||||||
|
onOpenProfile={() => {}}
|
||||||
|
targetWidth={300}
|
||||||
|
targetHeight={200}
|
||||||
|
showSpeakingIndicators
|
||||||
|
showNameTags
|
||||||
|
showRingingStatus
|
||||||
|
showOutline
|
||||||
|
focusable
|
||||||
|
/>
|
||||||
|
</ReactionsSenderProvider>,
|
||||||
|
);
|
||||||
|
expect(await axe(container)).toHaveNoViolations();
|
||||||
|
// Name should be visible
|
||||||
|
screen.getByText("Alice");
|
||||||
|
});
|
||||||
|
|
||||||
test("GridTile displays ringing media", async () => {
|
test("GridTile displays ringing media", async () => {
|
||||||
const pickupState$ = new BehaviorSubject<
|
const pickupState$ = new BehaviorSubject<
|
||||||
RingingMediaViewModel["pickupState$"]["value"]
|
RingingMediaViewModel["pickupState$"]["value"]
|
||||||
|
|||||||
Reference in New Issue
Block a user