Files
ThreadNet-Web/apps/web/playwright/pages/timeline.ts
T
sorB 3da363517f
Docker / Docker Buildx (push) Has been cancelled
Build Debian package / Build package (release) Has been cancelled
Build and Deploy / prepare (release) Has been cancelled
Deploy release / Deploy to Cloudflare Pages (release) Has been cancelled
Build and Deploy / Trigger Pro pipeline (release) Has been cancelled
Build and Deploy / Windows arm64 (release) Has been cancelled
Build and Deploy / Windows x64 (release) Has been cancelled
Build and Deploy / macOS (release) Has been cancelled
Build and Deploy / Linux amd64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / Linux arm64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }} (release) Has been cancelled
Build and Deploy / Deploy builds to ESS (release) Has been cancelled
feat: show call participants in room list (Discord-style)
2026-05-10 14:25:35 +02:00

45 lines
1.6 KiB
TypeScript

/*
Copyright 2024 New Vector Ltd.
Copyright 2023 The Matrix.org Foundation C.I.C.
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 type { Locator, Page } from "@playwright/test";
export class Timeline {
constructor(private page: Page) {}
// Scroll to the top of the timeline
async scrollToTop(): Promise<void> {
const locator = this.page.locator(".mx_RoomView_timeline .mx_ScrollPanel");
await locator.evaluate((node) => {
while (node.scrollTop > 0) {
node.scrollTo(0, 0);
}
});
}
public async scrollToBottom(): Promise<void> {
await this.page
.locator(".mx_ScrollPanel")
.evaluate((scrollPanel) => scrollPanel.scrollTo(0, scrollPanel.scrollHeight));
}
// Find the event tile matching the given sender & body
async findEventTile(sender: string, body: string): Promise<Locator> {
const locators = await this.page.locator(".mx_RoomView_MessageList .mx_EventTile").all();
let latestSender: string;
for (const locator of locators) {
const displayName = locator.locator(".mx_DisambiguatedProfile_displayName");
if (await displayName.count()) {
latestSender = await displayName.innerText();
}
if (latestSender === sender && (await locator.locator(".mx_EventTile_body").innerText()) === body) {
return locator;
}
}
}
}