Skip to content

Commit f80e945

Browse files
authored
Merge pull request #3037 from element-hq/valere/fix_i18n_test_not_configured
Fix: i18n not properly configured in vitest
2 parents 815b013 + 4c91326 commit f80e945

File tree

12 files changed

+30
-42
lines changed

12 files changed

+30
-42
lines changed

src/Modal.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test("the modal can be closed by clicking the close button", async () => {
4646
}
4747
const user = userEvent.setup();
4848
const { queryByRole, getByRole } = render(<ModalFn />);
49-
await user.click(getByRole("button", { name: "action.close" }));
49+
await user.click(getByRole("button", { name: "Close" }));
5050
expect(queryByRole("dialog")).toBeNull();
5151
});
5252

src/__snapshots__/QrCode.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`QrCode > renders 1`] = `
55
class="qrCode bar"
66
>
77
<img
8-
alt="qr_code"
8+
alt="QR Code"
99
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAB0CAYAAABUmhYnAAAAAklEQVR4AewaftIAAALBSURBVO3BQW7kQAwEwSxC//9yro88NSBI4/UQjIg/WGMUa5RijVKsUYo1SrFGKdYoxRqlWKMUa5RijVKsUYo1SrFGKdYoxRrl4qEk/CaVkyR0Kl0STlS6JPwmlSeKNUqxRinWKBcvU3lTEk6S8ITKHSpvSsKbijVKsUYp1igXH5aEO1Q+SaVLQqdyRxLuUPmkYo1SrFGKNcrFl1PpknCShE5lkmKNUqxRijXKxZdLQqdyotIloVP5ZsUapVijFGuUiw9T+UuS8CaVv6RYoxRrlGKNcvGyJPwlSehUuiTckYS/rFijFGuUYo0Sf/DFkvAmlW9WrFGKNUqxRrl4KAknKl0SOpWTJJyodEk4UbkjCXeodEk4UXlTsUYp1ijFGuXiIZUuCXck4USlS0KXhE7lk1TelIRO5YlijVKsUYo1ysXLVLok3KHSJaFT6ZLQJaFTOUnCicodSehUTpLwpmKNUqxRijXKxUNJ6FSeSEKn0iXhROUkCZ3Kb0pCp/KmYo1SrFGKNcrFh6mcJKFT6ZJwotIloVPpVLokdCpdEjqVLgmdyh1J6FSeKNYoxRqlWKPEH3yxJHQqJ0noVO5IwolKl4ROpUtCp/JEsUYp1ijFGuXioST8JpU7ktCpnCShUzlROVHpktCpvKlYoxRrlGKNcvEylTcl4USlS8JJEt6UhBOVTqVLQqfyRLFGKdYoxRrl4sOScIfKEyonSehUTpJwh0qXhN9UrFGKNUqxRrn4ckn4JJU7kvA/FWuUYo1SrFEuvpxKl4QTlS4JncodSehU7kjCm4o1SrFGKdYoFx+m8klJOFE5UemScKJyRxI6lU7lTcUapVijFGuUi5cl4X9SOUnCicoTSThJQqfypmKNUqxRijVK/MEao1ijFGuUYo1SrFGKNUqxRinWKMUapVijFGuUYo1SrFGKNUqxRinWKP8AKoQP/lIBoMIAAAAASUVORK5CYII="
1010
/>
1111
</div>

src/button/ReactionToggleButton.test.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test("Can open menu", async () => {
4747
const { getByLabelText, container } = render(
4848
<TestComponent vm={vm} rtcSession={rtcSession} />,
4949
);
50-
await user.click(getByLabelText("common.reactions"));
50+
await user.click(getByLabelText("Reactions"));
5151
expect(container).toMatchSnapshot();
5252
});
5353

@@ -58,8 +58,8 @@ test("Can raise hand", async () => {
5858
const { getByLabelText, container } = render(
5959
<TestComponent vm={vm} rtcSession={rtcSession} />,
6060
);
61-
await user.click(getByLabelText("common.reactions"));
62-
await user.click(getByLabelText("action.raise_hand"));
61+
await user.click(getByLabelText("Reactions"));
62+
await user.click(getByLabelText("Raise hand"));
6363
expect(rtcSession.room.client.sendEvent).toHaveBeenCalledWith(
6464
rtcSession.room.roomId,
6565
"m.reaction",
@@ -92,8 +92,8 @@ test("Can lower hand", async () => {
9292
const { getByLabelText, container } = render(
9393
<TestComponent vm={vm} rtcSession={rtcSession} />,
9494
);
95-
await user.click(getByLabelText("common.reactions"));
96-
await user.click(getByLabelText("action.raise_hand"));
95+
await user.click(getByLabelText("Reactions"));
96+
await user.click(getByLabelText("Raise hand"));
9797
act(() => {
9898
handRaisedSubject$.next({
9999
[localIdent]: {
@@ -103,8 +103,8 @@ test("Can lower hand", async () => {
103103
},
104104
});
105105
});
106-
await user.click(getByLabelText("common.reactions"));
107-
await user.click(getByLabelText("action.lower_hand"));
106+
await user.click(getByLabelText("Reactions"));
107+
await user.click(getByLabelText("Lower hand"));
108108
expect(rtcSession.room.client.redactEvent).toHaveBeenCalledWith(
109109
rtcSession.room.roomId,
110110
reactionEventId,
@@ -122,7 +122,7 @@ test("Can react with emoji", async () => {
122122
const { getByLabelText, getByText } = render(
123123
<TestComponent vm={vm} rtcSession={rtcSession} />,
124124
);
125-
await user.click(getByLabelText("common.reactions"));
125+
await user.click(getByLabelText("Reactions"));
126126
await user.click(getByText("🐶"));
127127
expect(rtcSession.room.client.sendEvent).toHaveBeenCalledWith(
128128
rtcSession.room.roomId,
@@ -144,8 +144,8 @@ test("Can fully expand emoji picker", async () => {
144144
const { getByLabelText, container, getByText } = render(
145145
<TestComponent vm={vm} rtcSession={rtcSession} />,
146146
);
147-
await user.click(getByLabelText("common.reactions"));
148-
await user.click(getByLabelText("action.show_more"));
147+
await user.click(getByLabelText("Reactions"));
148+
await user.click(getByLabelText("Show more"));
149149
expect(container).toMatchSnapshot();
150150
await user.click(getByText("🦗"));
151151
expect(rtcSession.room.client.sendEvent).toHaveBeenCalledWith(
@@ -168,8 +168,8 @@ test("Can close reaction dialog", async () => {
168168
const { getByLabelText, container } = render(
169169
<TestComponent vm={vm} rtcSession={rtcSession} />,
170170
);
171-
await user.click(getByLabelText("common.reactions"));
172-
await user.click(getByLabelText("action.show_more"));
173-
await user.click(getByLabelText("action.show_less"));
171+
await user.click(getByLabelText("Reactions"));
172+
await user.click(getByLabelText("Show more"));
173+
await user.click(getByLabelText("Show less"));
174174
expect(container).toMatchSnapshot();
175175
});

src/input/StarRating.test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ test("StarRatingInput is accessible", async () => {
2020
);
2121
expect(await axe(container)).toHaveNoViolations();
2222
// Change the rating to 4 stars
23-
await user.click(
24-
(
25-
await screen.findAllByRole("radio", { name: "star_rating_input_label" })
26-
)[3],
27-
);
23+
await user.click(await screen.findByLabelText("4 stars"));
2824
expect(onChange).toBeCalledWith(4);
2925
});

src/livekit/useECConnectionState.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ test.each<[string, ConnectionError]>([
6767
</MemoryRouter>,
6868
);
6969
await user.click(screen.getByRole("button", { name: "Connect" }));
70-
screen.getByText("error.insufficient_capacity");
70+
screen.getByText("Insufficient capacity");
7171
},
7272
);

src/reactions/__snapshots__/RaisedHandIndicator.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports[`RaisedHandIndicator > renders a smaller indicator when miniature is spe
88
class="reaction"
99
>
1010
<span
11-
aria-label="common.reaction"
11+
aria-label="Reaction"
1212
role="img"
1313
>
1414
@@ -28,7 +28,7 @@ exports[`RaisedHandIndicator > renders an indicator when a hand has been raised
2828
class="reaction reactionLarge"
2929
>
3030
<span
31-
aria-label="common.reaction"
31+
aria-label="Reaction"
3232
role="img"
3333
>
3434
@@ -48,7 +48,7 @@ exports[`RaisedHandIndicator > renders an indicator when a hand has been raised
4848
class="reaction reactionLarge"
4949
>
5050
<span
51-
aria-label="common.reaction"
51+
aria-label="Reaction"
5252
role="img"
5353
>
5454

src/room/GroupCallView.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ test("GroupCallView leaves the session when an error occurs", async () => {
199199
const user = userEvent.setup();
200200
const { rtcSession } = createGroupCallView(null);
201201
await user.click(screen.getByRole("button", { name: "Panic!" }));
202-
screen.getByText("error.generic");
202+
screen.getByText("Something went wrong");
203203
expect(leaveRTCSession).toHaveBeenCalledWith(
204204
rtcSession,
205205
"error",

src/room/InviteModal.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ test("InviteModal is accessible", async () => {
3030
);
3131

3232
expect(await axe(container)).toHaveNoViolations();
33-
await user.click(screen.getByRole("button", { name: "action.copy_link" }));
33+
await user.click(screen.getByRole("button", { name: "Copy link" }));
3434
expect(onDismiss).toBeCalled();
3535
});

src/room/VideoPreview.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ describe("VideoPreview", () => {
6666
children={<></>}
6767
/>,
6868
);
69-
expect(queryByRole("status")).toHaveTextContent(
70-
"video_tile.camera_starting",
71-
);
69+
expect(queryByRole("status")).toHaveTextContent("Video loading...");
7270
});
7371
});

src/tile/MediaView.test.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,14 @@ describe("MediaView", () => {
7070
<MediaView {...baseProps} video={undefined} localParticipant={true} />,
7171
);
7272
expect(screen.getByRole("img", { name: "some name" })).toBeVisible();
73-
expect(screen.queryAllByText("video_tile.waiting_for_media").length).toBe(
74-
0,
75-
);
73+
expect(screen.queryAllByText("Waiting for media...").length).toBe(0);
7674
});
7775
it("shows avatar and label for remote user", () => {
7876
render(
7977
<MediaView {...baseProps} video={undefined} localParticipant={false} />,
8078
);
8179
expect(screen.getByRole("img", { name: "some name" })).toBeVisible();
82-
expect(screen.getByText("video_tile.waiting_for_media")).toBeVisible();
80+
expect(screen.getByText("Waiting for media...")).toBeVisible();
8381
});
8482
});
8583

@@ -98,9 +96,7 @@ describe("MediaView", () => {
9896
</TooltipProvider>,
9997
);
10098
expect(await axe(container)).toHaveNoViolations();
101-
expect(
102-
screen.getByRole("img", { name: "common.unencrypted" }),
103-
).toBeTruthy();
99+
expect(screen.getByRole("img", { name: "Not encrypted" })).toBeTruthy();
104100
});
105101

106102
test("is not shown", () => {
@@ -110,7 +106,7 @@ describe("MediaView", () => {
110106
</TooltipProvider>,
111107
);
112108
expect(
113-
screen.queryAllByRole("img", { name: "common.unencrypted" }).length,
109+
screen.queryAllByRole("img", { name: "Not encrypted" }).length,
114110
).toBe(0);
115111
});
116112
});

0 commit comments

Comments
 (0)