test(e2e): add tests to ensure that font and emoji stay unchanged

This commit is contained in:
Florian Duros 2025-12-22 17:36:01 +01:00
parent e90c50e0ab
commit fa8cf9f474
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15
4 changed files with 34 additions and 2 deletions

View File

@ -56,4 +56,35 @@ test.describe("Appearance user settings tab", () => {
// Assert that the font-family value was removed
await expect(page.locator("body")).toHaveCSS("font-family", '""');
});
test(
"should keep same font and emoji when switching theme",
{ tag: "@screenshot" },
async ({ page, app, user, util }) => {
const roomId = await util.createAndDisplayRoom();
await app.client.sendMessage(roomId, { body: "Message with 🦡", msgtype: "m.text" });
await app.settings.openUserSettings("Appearance");
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
await tab.getByRole("button", { name: "Show advanced" }).click();
await tab.getByRole("switch", { name: "Use bundled emoji font" }).click();
await tab.getByRole("switch", { name: "Use a system font" }).click();
await app.closeDialog();
await expect(page).toMatchScreenshot("window-before-switch.png", {
mask: [page.locator(".mx_MessageTimestamp")],
});
// Switch to dark theme
await app.settings.openUserSettings("Appearance");
await util.getMatchSystemThemeSwitch().click();
await util.getDarkTheme().click();
await app.closeDialog();
// Font and emoji should remain the same after theme switch
await expect(page).toMatchScreenshot("window-after-switch.png", {
mask: [page.locator(".mx_MessageTimestamp")],
});
},
);
});

View File

@ -150,9 +150,10 @@ class Helpers {
/**
* Create and display a room named Test Room
*/
async createAndDisplayRoom() {
await this.app.client.createRoom({ name: "Test Room" });
async createAndDisplayRoom(): Promise<string> {
const roomId = await this.app.client.createRoom({ name: "Test Room" });
await this.app.viewRoomByName("Test Room");
return roomId;
}
/**