Files
upstream-rocketchat/apps/meteor/tests/e2e/federation/page-objects/fragments/home-content.ts
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

245 lines
8.3 KiB
TypeScript

import type { Locator, Page } from '@playwright/test';
export class FederationHomeContent {
protected readonly page: Page;
constructor(page: Page) {
this.page = page;
}
get inputMessage(): Locator {
return this.page.locator('[name="msg"]');
}
get messagePopUpItems(): Locator {
return this.page.locator('role=menu[name="People"]');
}
get messageListItems(): Locator {
return this.page.locator('[role="listitem"][aria-roledescription="message"]');
}
get lastUserMessage(): Locator {
return this.messageListItems.last();
}
get lastUserMessageBody(): Locator {
return this.lastUserMessage.locator('[role="document"][aria-roledescription="message body"]');
}
async sendMessage(text: string): Promise<void> {
await this.page.locator('[name="msg"]').type(text);
await this.page.locator('button[aria-label="Send"]').click();
}
async sendMessageUsingEnter(text: string): Promise<void> {
await this.page.locator('[name="msg"]').type(text);
await this.page.keyboard.press('Enter');
}
async editLastMessage(message: string): Promise<void> {
await this.openLastMessageMenu();
await this.btnOptionEditMessage.click();
await this.page.locator('[name="msg"]').fill(message);
await this.page.keyboard.press('Enter');
}
async deleteLastMessage(): Promise<void> {
await this.openLastMessageMenu();
await this.btnOptionDeleteMessage.click();
await this.page.locator('#modal-root dialog .rcx-modal__inner .rcx-modal__footer .rcx-button--danger').click();
}
async starLastMessage(): Promise<void> {
await this.openLastMessageMenu();
await this.btnOptionStarMessage.waitFor();
await this.btnOptionStarMessage.click();
}
async replyInDm(message: string): Promise<void> {
await this.openLastMessageMenu();
await this.btnOptionReplyDirectly.click();
await this.page.waitForTimeout(2000);
await this.page.locator('[name="msg"]').type(message, { delay: 100 });
await this.page.waitForTimeout(2000);
await this.page.keyboard.press('Enter');
}
async sendAudioRecordedMessage(): Promise<void> {
await this.btnRecordAudio.click();
await this.page.waitForTimeout(3000);
await this.page.locator('.rc-message-box__icon.rc-message-box__audio-message-done').click();
await this.btnModalConfirm.click();
}
async sendAudioRecordedInThreadMessage(): Promise<void> {
await this.btnRecordAudio.nth(1).click();
await this.page.waitForTimeout(3000);
await this.page.locator('.rc-message-box__icon.rc-message-box__audio-message-done').click();
await this.btnModalConfirm.click();
}
async sendVideoRecordedMessage(): Promise<void> {
await this.btnVideoMessage.click();
await this.page.locator('.rcx-box.rcx-box--full.rcx-icon--name-video').click();
await this.page.waitForTimeout(3000);
await this.page.locator('.rcx-box.rcx-box--full.rcx-icon--name-stop-unfilled').click();
await this.page.locator('button >> text="Send"').click();
await this.page.waitForTimeout(3000);
await this.btnModalConfirm.click();
}
async dispatchSlashCommand(text: string): Promise<void> {
await this.page.locator('[name="msg"]').fill(text);
await this.page.locator('button[aria-label="Send"]').waitFor();
await this.page.locator('button[aria-label="Send"]').click();
}
get btnModalConfirm(): Locator {
return this.page.locator('#modal-root .rcx-button-group--align-end .rcx-button--primary');
}
get lastMessageFileName(): Locator {
return this.page.locator('[role="listitem"][aria-roledescription="message"]:last-child');
}
async getLastFileMessageByFileName(filename: string): Promise<Locator> {
return this.page
.locator('[role="listitem"][aria-roledescription="message"]:last-child .rcx-message-container')
.last()
.locator(`div[title="${filename}"]`);
}
async getLastFileThreadMessageByFileName(filename: string): Promise<Locator> {
return this.page
.locator('div.thread-list ul.thread [role="listitem"][aria-roledescription="message"]:last-child .rcx-message-container')
.last()
.locator(`div[title="${filename}"]`);
}
get lastFileMessage(): Locator {
return this.page.locator('[role="listitem"][aria-roledescription="message"]:last-child .rcx-message-container').last();
}
get waitForLastMessageTextAttachmentEqualsText(): Locator {
return this.page.locator('[role="listitem"][aria-roledescription="message"]:last-child .rcx-attachment__details .rcx-message-body');
}
get waitForLastThreadMessageTextAttachmentEqualsText(): Locator {
return this.page
.locator('div.thread-list ul.thread [role="listitem"][aria-roledescription="message"]')
.last()
.locator('.rcx-attachment__details');
}
get btnOptionEditMessage(): Locator {
return this.page.locator('[data-qa-id="edit-message"]');
}
get btnOptionDeleteMessage(): Locator {
return this.page.locator('[data-qa-id="delete-message"]');
}
get btnOptionPinMessage(): Locator {
return this.page.locator('[data-qa-id="pin-message"]');
}
get btnOptionStarMessage(): Locator {
return this.page.locator('[data-qa-id="star-message"]');
}
get btnVideoMessage(): Locator {
return this.page.locator('[data-qa-id="video-message"]');
}
get btnRecordAudio(): Locator {
return this.page.locator('[data-qa-id="audio-record"]');
}
get btnMenuMoreActions() {
return this.page.locator('[data-qa-id="menu-more-actions"]');
}
get btnContactEdit(): Locator {
return this.page.locator('.rcx-vertical-bar button:has-text("Edit")');
}
get btnOptionReplyInThread(): Locator {
return this.page.locator('[data-qa-id="reply-in-thread"]');
}
get btnOptionStartDiscussion(): Locator {
return this.page.locator('[data-qa-id="start-discussion"]');
}
get btnOptionReplyDirectly(): Locator {
return this.page.locator('[data-qa-id="reply-directly"]');
}
get lastThreadMessageText(): Locator {
return this.page.locator('div.thread-list ul.thread [role="listitem"][aria-roledescription="message"]').last();
}
async sendFileMessage(fileName: string): Promise<void> {
await this.page.locator('input[type=file]').setInputFiles(`./tests/e2e/federation/files/${fileName}`);
}
async sendThreadMessage(message: string): Promise<void> {
await this.page.getByRole('dialog').locator('[name="msg"]').last().fill(message);
await this.page.keyboard.press('Enter');
}
async openLastMessageMenu(): Promise<void> {
await this.lastUserMessage.hover();
await this.lastUserMessage.getByRole('button', { name: 'More', exact: true }).waitFor();
await this.lastUserMessage.getByRole('button', { name: 'More', exact: true }).click();
}
threadSendToChannelAlso(): Locator {
return this.page.getByRole('dialog').locator('label', { hasText: 'Also send to channel' });
}
async quoteMessage(message: string): Promise<void> {
await this.openLastMessageMenu();
await this.page.locator('[data-qa-id="quote-message"]').click();
await this.page.locator('[name="msg"]').fill(message);
await this.page.keyboard.press('Enter');
}
async openLastThreadMessageMenu(): Promise<void> {
await this.lastThreadMessageText.hover();
await this.lastThreadMessageText.getByRole('button', { name: 'More', exact: true }).waitFor();
await this.lastThreadMessageText.getByRole('button', { name: 'More', exact: true }).click();
}
async quoteMessageInsideThread(message: string): Promise<void> {
await this.openLastThreadMessageMenu();
await this.page.locator('[data-qa-id="quote-message"]').click();
await this.sendThreadMessage(message);
}
async reactToMessage(emoji: string): Promise<void> {
await this.openLastMessageMenu();
await this.page.locator('[data-qa-id="reaction-message"]').click();
await this.page.locator('input.js-emojipicker-search').type(emoji);
await this.page.locator(`[data-emoji="${emoji}"]`).last().click();
}
async unreactLastMessage(): Promise<void> {
await this.lastUserMessage.locator('.rcx-message-reactions__reaction').nth(1).waitFor();
await this.lastUserMessage.locator('.rcx-message-reactions__reaction').nth(1).click();
}
async getSystemMessageByText(text: string): Promise<Locator> {
return this.page.locator('[role="document"][aria-roledescription="system message body"]', { hasText: text });
}
async getLastSystemMessageName(): Promise<Locator> {
return this.page.locator('[role="listitem"][aria-roledescription="system message"]').last().getByRole('button');
}
async getAllReactions(): Promise<Locator> {
return this.lastUserMessage.locator('.rcx-message-reactions__reaction');
}
}