Files
upstream-mirror 30810eecd7
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:21:02 +05:00

213 lines
5.0 KiB
TypeScript

import type { Locator, Page } from '@playwright/test';
import { MenuOptions } from './menu';
import { OmnichannelCloseChatModal, OmnichannelOnHoldModal } from './modals';
export abstract class Toolbar {
constructor(protected root: Locator) {}
click() {
return this.root.click();
}
}
export class RoomToolbar extends Toolbar {
readonly menu: MenuOptions;
constructor(page: Page) {
super(page.getByRole('toolbar', { name: 'Primary Room actions' }));
this.menu = new MenuOptions(page);
}
get btnRoomInfo() {
return this.root.getByRole('button', { name: 'Room Information' });
}
get btnMembers() {
return this.root.getByRole('button', { name: 'Members' });
}
get btnVideoCall() {
return this.root.getByRole('button', { name: 'Video Call' });
}
get btnVoiceCall() {
return this.root.getByRole('button', { name: 'Voice call' });
}
get btnUserInfo(): Locator {
return this.root.getByRole('button', { name: 'User Info' });
}
get btnDiscussion(): Locator {
return this.root.getByRole('button', { name: 'Discussions' });
}
get btnThreads(): Locator {
return this.root.getByRole('button', { name: 'Threads' });
}
get btnFiles(): Locator {
return this.root.getByRole('button', { name: 'Files' });
}
get btnMoreOptions(): Locator {
return this.root.getByRole('button', { name: 'Options' });
}
get btnSearchMessages(): Locator {
return this.root.getByRole('button', { name: 'Search Messages' });
}
get btnDisableE2EEncryption(): Locator {
return this.root.getByRole('button', { name: 'Disable E2E encryption' });
}
get menuItemExportMessages(): Locator {
return this.menu.getMenuItem('Export messages');
}
get menuItemMentions(): Locator {
return this.menu.getMenuItem('Mentions');
}
get menuItemStarredMessages(): Locator {
return this.menu.getMenuItem('Starred Messages');
}
get menuItemPinnedMessages(): Locator {
return this.menu.getMenuItem('Pinned Messages');
}
get menuItemPruneMessages(): Locator {
return this.menu.getMenuItem('Prune Messages');
}
get menuItemAutoTranslate(): Locator {
return this.menu.getMenuItem('Auto-Translate');
}
get menuItemNotificationsPreferences(): Locator {
return this.menu.getMenuItem('Notifications Preferences');
}
get menuItemDisableE2EEncryption(): Locator {
return this.menu.getMenuItem('Disable E2E encryption');
}
get menuItemEnableE2EEncryption(): Locator {
return this.menu.getMenuItem('Enable E2E encryption');
}
get menuItemFiles(): Locator {
return this.menu.getMenuItem('Files');
}
async openRoomInfo() {
await this.btnRoomInfo.click();
}
async openMembersTab() {
await this.btnMembers.click();
}
async openUserInfo() {
await this.btnUserInfo.click();
}
async openMoreOptions() {
await this.btnMoreOptions.click();
}
private get btnTeamChannels(): Locator {
return this.root.getByRole('button', { name: 'Team Channels' });
}
async openTeamChannels() {
await this.btnTeamChannels.click();
}
async waitFor() {
await this.root.waitFor({ state: 'visible' });
}
}
export class TeamToolbar extends RoomToolbar {
private get menuItemTeamMembers() {
return this.menu.getMenuItem('Teams Members');
}
private get btnTeamInfo() {
return this.root.getByRole('button', { name: 'Team info' });
}
async openTeamMembers() {
await this.menuItemTeamMembers.click();
}
async openTeamInfo() {
await this.btnTeamInfo.click();
}
}
export class EncryptedRoomToolbar extends RoomToolbar {}
export class OmnichannelRoomToolbar extends RoomToolbar {
private get btnContactInfo(): Locator {
return this.root.getByRole('button', { name: 'Contact Information' });
}
private get btnCannedResponses(): Locator {
return this.root.getByRole('button', { name: 'Canned Responses' });
}
async openContactInfo() {
await this.btnContactInfo.click();
}
async openCannedResponses() {
await this.btnCannedResponses.click();
}
}
export class OmnichannelQuickActionsRoomToolbar extends Toolbar {
private closeChatModal: OmnichannelCloseChatModal;
private onHoldModal: OmnichannelOnHoldModal;
constructor(page: Page) {
super(page.getByRole('toolbar', { name: 'Omnichannel Quick Actions' }));
this.closeChatModal = new OmnichannelCloseChatModal(page);
this.onHoldModal = new OmnichannelOnHoldModal(page);
}
get btnOnHold(): Locator {
return this.root.getByRole('button', { name: 'Place chat On-Hold' });
}
get btnForwardChat(): Locator {
return this.root.getByRole('button', { name: 'Forward chat' });
}
get btnEndConversation(): Locator {
return this.root.getByRole('button', { name: 'End conversation' });
}
/**
* FIXME: This `clickCount` seems a hack for a bad implementation
*/
async placeChatOnHold() {
await this.btnOnHold.click({ clickCount: 2 });
await this.onHoldModal.confirm();
}
async forwardChat() {
await this.btnForwardChat.click();
}
async closeChat({ comment = 'any_comment', downloadPDF = false } = {}): Promise<void> {
await this.btnEndConversation.click();
await this.closeChatModal.confirm(comment, downloadPDF);
}
}