diff --git a/modules/banner/element-web/e2e/banner.spec.ts b/modules/banner/element-web/e2e/banner.spec.ts index fd5021e95e..edaf519492 100644 --- a/modules/banner/element-web/e2e/banner.spec.ts +++ b/modules/banner/element-web/e2e/banner.spec.ts @@ -166,8 +166,8 @@ test.describe("Banner", () => { // Verify that the #matrixchat root got shrunk to fit rather than exploding the viewport const bodyBoundingBox = await page.locator("body").boundingBox(); const rootBoundingBox = await page.locator("#matrixchat").boundingBox(); - const headerElement = await page.locator("#matrixchat").evaluate((e) => e.previousElementSibling); - const headerBoundingBox = headerElement?.getBoundingClientRect(); + const headerBoundingBox = await page.getByTestId("banner").boundingBox(); + expect(rootBoundingBox!.height).toBeLessThan(bodyBoundingBox!.height); expect(rootBoundingBox!.height + headerBoundingBox!.height).toEqual(bodyBoundingBox!.height); }); diff --git a/modules/banner/element-web/src/index.tsx b/modules/banner/element-web/src/index.tsx index f4196af06f..538fb8b3af 100644 --- a/modules/banner/element-web/src/index.tsx +++ b/modules/banner/element-web/src/index.tsx @@ -36,6 +36,7 @@ class BannerModule implements Module { } const div = document.createElement("div"); + div.dataset.testid = "banner"; this.api.rootNode.before(div); const root = this.api.createRoot(div);