Iterate video room designs in labs (#8499)
* Remove blank header from video room view frame * Add video room option to space context menu * Remove duplicate tooltips from face piles * Factor RoomInfoLine out of SpaceRoomView * Factor RoomPreviewCard out of SpaceRoomView * Adapt RoomPreviewCard for video rooms * "New video room" → "Video room" * Add comment about unused cases in RoomPreviewCard * Make widgets in video rooms mutable again to de-risk future upgrades * Ensure that the video channel exists when mounting VideoRoomView
This commit is contained in:
parent
cda31136b9
commit
658ff4dfe6
20 changed files with 617 additions and 434 deletions
|
@ -17,9 +17,17 @@ limitations under the License.
|
|||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { act } from "react-dom/test-utils";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { MatrixWidgetType } from "matrix-widget-api";
|
||||
|
||||
import { stubClient, stubVideoChannelStore, mkRoom, wrapInMatrixClientContext } from "../../test-utils";
|
||||
import {
|
||||
stubClient,
|
||||
stubVideoChannelStore,
|
||||
StubVideoChannelStore,
|
||||
mkRoom,
|
||||
wrapInMatrixClientContext,
|
||||
} from "../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
|
||||
import { VIDEO_CHANNEL } from "../../../src/utils/VideoChannelUtils";
|
||||
import WidgetStore from "../../../src/stores/WidgetStore";
|
||||
|
@ -30,7 +38,6 @@ import AppTile from "../../../src/components/views/elements/AppTile";
|
|||
const VideoRoomView = wrapInMatrixClientContext(_VideoRoomView);
|
||||
|
||||
describe("VideoRoomView", () => {
|
||||
stubClient();
|
||||
jest.spyOn(WidgetStore.instance, "getApps").mockReturnValue([{
|
||||
id: VIDEO_CHANNEL,
|
||||
eventId: "$1:example.org",
|
||||
|
@ -45,22 +52,22 @@ describe("VideoRoomView", () => {
|
|||
value: { enumerateDevices: () => [] },
|
||||
});
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
const room = mkRoom(cli, "!1:example.org");
|
||||
let cli: MatrixClient;
|
||||
let room: Room;
|
||||
let store: StubVideoChannelStore;
|
||||
|
||||
let store;
|
||||
beforeEach(() => {
|
||||
stubClient();
|
||||
cli = MatrixClientPeg.get();
|
||||
jest.spyOn(WidgetStore.instance, "matrixClient", "get").mockReturnValue(cli);
|
||||
store = stubVideoChannelStore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
room = mkRoom(cli, "!1:example.org");
|
||||
});
|
||||
|
||||
it("shows lobby and keeps widget loaded when disconnected", async () => {
|
||||
const view = mount(<VideoRoomView room={room} resizing={false} />);
|
||||
// Wait for state to settle
|
||||
await act(async () => Promise.resolve());
|
||||
await act(() => Promise.resolve());
|
||||
|
||||
expect(view.find(VideoLobby).exists()).toEqual(true);
|
||||
expect(view.find(AppTile).exists()).toEqual(true);
|
||||
|
@ -70,7 +77,7 @@ describe("VideoRoomView", () => {
|
|||
store.connect("!1:example.org");
|
||||
const view = mount(<VideoRoomView room={room} resizing={false} />);
|
||||
// Wait for state to settle
|
||||
await act(async () => Promise.resolve());
|
||||
await act(() => Promise.resolve());
|
||||
|
||||
expect(view.find(VideoLobby).exists()).toEqual(false);
|
||||
expect(view.find(AppTile).exists()).toEqual(true);
|
||||
|
|
|
@ -37,35 +37,21 @@ describe("createRoom", () => {
|
|||
setupAsyncStoreWithClient(WidgetStore.instance, client);
|
||||
jest.spyOn(WidgetUtils, "waitForRoomWidget").mockResolvedValue();
|
||||
|
||||
const userId = client.getUserId();
|
||||
const roomId = await createRoom({ roomType: RoomType.ElementVideo });
|
||||
|
||||
const [[{
|
||||
power_level_content_override: {
|
||||
users: {
|
||||
[userId]: userPower,
|
||||
},
|
||||
events: {
|
||||
"im.vector.modular.widgets": widgetPower,
|
||||
[VIDEO_CHANNEL_MEMBER]: videoMemberPower,
|
||||
},
|
||||
events: { [VIDEO_CHANNEL_MEMBER]: videoMemberPower },
|
||||
},
|
||||
}]] = mocked(client.createRoom).mock.calls as any;
|
||||
}]] = mocked(client.createRoom).mock.calls as any; // no good type
|
||||
const [[widgetRoomId, widgetStateKey, , widgetId]] = mocked(client.sendStateEvent).mock.calls;
|
||||
|
||||
// We should have had enough power to be able to set up the Jitsi widget
|
||||
expect(userPower).toBeGreaterThanOrEqual(widgetPower);
|
||||
// and should have actually set it up
|
||||
// We should have set up the Jitsi widget
|
||||
expect(widgetRoomId).toEqual(roomId);
|
||||
expect(widgetStateKey).toEqual("im.vector.modular.widgets");
|
||||
expect(widgetId).toEqual(VIDEO_CHANNEL);
|
||||
|
||||
// All members should be able to update their connected devices
|
||||
expect(videoMemberPower).toEqual(0);
|
||||
// Jitsi widget should be immutable for admins
|
||||
expect(widgetPower).toBeGreaterThan(100);
|
||||
// and we should have been reset back to admin
|
||||
expect(client.setPowerLevel).toHaveBeenCalledWith(roomId, userId, 100, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue