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

180 lines
4.7 KiB
TypeScript

import type { Page } from '@playwright/test';
import { FlexTab } from './flextab';
import { Listbox } from '../listbox';
import { MenuMore } from '../menu';
import { ConfirmRemoveModal } from '../modals';
import { UserInfoFlexTab } from './user-info-flextab';
import { Modal } from '../modals/modal';
export class ConfirmMuteModal extends Modal {
constructor(page: Page) {
super(page.getByRole('dialog', { name: 'Are you sure' }));
}
private get btnMute() {
return this.root.getByRole('button', { name: 'Yes, mute user!' });
}
async confirmMute() {
await this.btnMute.click();
await this.waitForDismissal();
}
}
export class RemoveTeamMemberModal extends Modal {
constructor(page: Page) {
super(page.getByRole('dialog', { name: 'Removing Member' }));
}
get description() {
return this.root.getByText('Select the channels you want the user to be removed from');
}
channel(channelName: string) {
return this.root.getByText(channelName);
}
channelCheckbox(channelName: string) {
return this.root.getByRole('row', { name: channelName }).getByRole('checkbox');
}
async selectChannel(channelName: string) {
await this.channel(channelName).click();
}
private get btnContinue() {
return this.root.getByRole('button', { name: 'Continue' });
}
async continue() {
await this.btnContinue.click();
await this.waitForDismissal();
}
}
class AddUsersFlexTab extends FlexTab {
readonly listbox: Listbox;
constructor(page: Page) {
super(page.getByRole('dialog', { name: 'Add users' }));
this.listbox = new Listbox(page);
}
private btnAddUsers() {
return this.root.getByRole('button', { name: 'Add users' });
}
async addUser(username: string) {
await this.root.getByRole('combobox', { name: 'Choose users' }).pressSequentially(username);
await this.listbox.selectOption(username);
await this.btnAddUsers().click();
await this.waitForDismissal();
}
}
export class MembersFlexTab extends FlexTab {
readonly listbox: Listbox;
readonly removeModal: ConfirmRemoveModal;
readonly removeTeamMemberModal: RemoveTeamMemberModal;
readonly menu: MenuMore;
readonly confirmMuteModal: ConfirmMuteModal;
readonly addUsersFlexTab: AddUsersFlexTab;
readonly userInfo: UserInfoFlexTab;
constructor(page: Page) {
super(page.getByRole('dialog', { name: 'Members' }));
this.removeModal = new ConfirmRemoveModal(page.getByRole('dialog', { name: 'Confirmation', exact: true }));
this.removeTeamMemberModal = new RemoveTeamMemberModal(page);
this.listbox = new Listbox(page);
this.menu = new MenuMore(page);
this.confirmMuteModal = new ConfirmMuteModal(page);
this.addUsersFlexTab = new AddUsersFlexTab(page);
this.userInfo = new UserInfoFlexTab(page);
}
memberOption(username: string) {
return this.root.locator('li', { hasText: username });
}
getMenuItemAction(action: string) {
return this.menu.getMenuItem(action);
}
async openMemberInfo(username: string) {
await this.memberOption(username).click();
}
async openMoreActions() {
await this.root.getByRole('button', { name: 'More' }).click();
}
async openMemberOptionMoreActions(username: string) {
await this.memberOption(username).hover();
await this.memberOption(username).getByRole('button', { name: 'More' }).click();
}
async addUser(username: string) {
await this.root.getByRole('button', { name: 'Add' }).click();
await this.addUsersFlexTab.addUser(username);
}
private get btnInviteLink() {
return this.root.getByRole('button', { name: 'Invite Link' });
}
async inviteUser() {
await this.btnInviteLink.click();
}
async muteUser(username: string) {
await this.openMemberOptionMoreActions(username);
await this.menu.selectMenuItem('Mute user');
await this.confirmMuteModal.confirmMute();
}
async unmuteUser(username: string) {
await this.openMemberOptionMoreActions(username);
await this.menu.selectMenuItem('Unmute user');
}
async setUserAsModerator(username: string) {
await this.openMemberOptionMoreActions(username);
await this.menu.selectMenuItem('Set as moderator');
}
async setUserAsOwner(username: string) {
await this.openMemberOptionMoreActions(username);
await this.menu.selectMenuItem('Set as owner');
}
async showAllUsers() {
await this.root.getByRole('button', { name: 'Online' }).click();
await this.listbox.selectOption('All');
}
private async ignoreUserAction(action: string, username: string) {
await this.openMemberInfo(username);
await this.userInfo.openMoreActions();
await this.userInfo.menu.selectMenuItem(action);
}
async ignoreUser(username: string) {
await this.ignoreUserAction('Ignore', username);
}
async unignoreUser(username: string) {
await this.ignoreUserAction('Unignore', username);
}
async confirmRemoveUser() {
return this.removeModal.confirmRemove();
}
}