mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
Tag the video element with its track source for e2e specs
The SDK MediaView renders a plain video element, so LiveKit's data-lk-source attribute is gone. Expose data-source from the SDK track and point the screen-share spec at it.
This commit is contained in:
@@ -76,9 +76,9 @@ widgetTest("Sharing screen in group call", async ({ addUser, browserName }) => {
|
|||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
await expect(frame.locator('video[data-source="screenShare"]')).toHaveCount(
|
||||||
frame.locator('video[data-lk-source="screen_share"]'),
|
1,
|
||||||
).toHaveCount(1);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alice should be in grid mode as she is local sharing
|
// Alice should be in grid mode as she is local sharing
|
||||||
@@ -117,9 +117,9 @@ widgetTest("Sharing screen in group call", async ({ addUser, browserName }) => {
|
|||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
await expect(frame.locator('video[data-source="screenShare"]')).toHaveCount(
|
||||||
frame.locator('video[data-lk-source="screen_share"]'),
|
2,
|
||||||
).toHaveCount(2);
|
);
|
||||||
|
|
||||||
// Expect 2 indicators at the bottom
|
// Expect 2 indicators at the bottom
|
||||||
await expect(frame.getByTestId("screenshare-indicator")).toHaveCount(2);
|
await expect(frame.getByTestId("screenshare-indicator")).toHaveCount(2);
|
||||||
|
|||||||
@@ -46,6 +46,21 @@ describe("MediaView", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("with video", () => {
|
||||||
|
it("labels the video element with the track source", () => {
|
||||||
|
render(
|
||||||
|
<MediaView
|
||||||
|
{...baseProps}
|
||||||
|
video={mockVideoTrack({ source: "screenShare" })}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
expect(screen.getByTestId("video")).toHaveAttribute(
|
||||||
|
"data-source",
|
||||||
|
"screenShare",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("name tag", () => {
|
describe("name tag", () => {
|
||||||
test("is shown with name", () => {
|
test("is shown with name", () => {
|
||||||
render(<MediaView {...baseProps} displayName="Bob" />);
|
render(<MediaView {...baseProps} displayName="Bob" />);
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ export const MediaView: FC<Props> = ({
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
disablePictureInPicture
|
disablePictureInPicture
|
||||||
data-testid="video"
|
data-testid="video"
|
||||||
|
data-source={video.source}
|
||||||
// Set the placeholder to a small transparent image. (On Android web
|
// Set the placeholder to a small transparent image. (On Android web
|
||||||
// views the default poster image is particularly ugly.)
|
// views the default poster image is particularly ugly.)
|
||||||
poster={videoPlaceholder}
|
poster={videoPlaceholder}
|
||||||
|
|||||||
Reference in New Issue
Block a user