From a8c170f8be8ddf9c65a9fb994378b73cb0a919c4 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 13 Jan 2025 13:12:04 +0000 Subject: [PATCH] Add tests --- playwright/e2e/branding/title.spec.ts | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 playwright/e2e/branding/title.spec.ts diff --git a/playwright/e2e/branding/title.spec.ts b/playwright/e2e/branding/title.spec.ts new file mode 100644 index 0000000000..71cb864aad --- /dev/null +++ b/playwright/e2e/branding/title.spec.ts @@ -0,0 +1,46 @@ +/* +Copyright 2025 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE files in the repository root for full details. +*/ + +import { expect, test } from "../../element-web-test"; + +/* + * Tests for branding configuration + **/ + +test.describe('Test without branding config', () => { + test("Shows standard branding when showing the home page", async ({ pageWithCredentials: page }) => { + await page.goto("/"); + await page.waitForSelector(".mx_MatrixChat", { timeout: 30000 }); + expect(page.title()).toEqual('Element *'); + }); + test("Shows standard branding when showing a room", async ({ app, pageWithCredentials: page }) => { + await app.client.createRoom({ name: "Test Room" }); + await app.viewRoomByName("Test Room"); + expect(page.title()).toEqual('Element * | Test Room'); + }); +}); + +test.describe('Test with custom branding', () => { + test.use({ config: { + brand: 'TestBrand', + branding: { + title_template: 'TestingApp $ignoredParameter $brand $status $ignoredParameter', + title_template_in_room: 'TestingApp $brand $status $room_name $ignoredParameter' + } + }}); + test("Shows custom branding when showing the home page", async ({ pageWithCredentials: page }) => { + await page.goto("/"); + await page.waitForSelector(".mx_MatrixChat", { timeout: 30000 }); + expect(page.title()).toEqual('TestingApp TestBrand * $ignoredParameter'); + }); + test("Shows custom branding when showing a room", async ({ app, pageWithCredentials: page }) => { + await app.client.createRoom({ name: "Test Room" }); + await app.viewRoomByName("Test Room"); + expect(page.title()).toEqual('TestingApp TestBrand * Test Room $ignoredParameter'); + }); +}); +