Files
upstream-rocketchat/apps/meteor/tests/e2e/emojis.spec.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 2s
snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:21:02 +05:00

107 lines
3.9 KiB
TypeScript

import { Users } from './fixtures/userStates';
import { HomeChannel, AdminEmoji } from './page-objects';
import { createTargetChannel } from './utils';
import { test, expect } from './utils/test';
test.use({ storageState: Users.admin.state });
test.describe.serial('emoji', () => {
let poHomeChannel: HomeChannel;
let poAdminEmoji: AdminEmoji;
let targetChannel: string;
test.beforeAll(async ({ api }) => {
targetChannel = await createTargetChannel(api);
});
test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
await poHomeChannel.gotoChannel(targetChannel);
});
test('should display emoji picker properly', async ({ page }) => {
await poHomeChannel.composer.btnEmoji.click();
await test.step('should display scroller', async () => {
await expect(poHomeChannel.scrollerEmojiPicker).toBeVisible();
});
await test.step('should focus the active emoji tab category', async () => {
const activityEmojiTab = poHomeChannel.getEmojiPickerTabByName('Activity');
await activityEmojiTab.click();
//Picker search input can steal focus and cause failures here
await expect(activityEmojiTab).toHaveAttribute('aria-selected', 'true');
await poHomeChannel.composer.inputMessage.click(); // To close the emoji picker
});
await test.step('should pick and send grinning emoji', async () => {
await poHomeChannel.pickEmoji('grinning');
await page.keyboard.press('Enter');
await expect(poHomeChannel.content.lastUserMessage).toContainText('😀');
});
});
test('expect send emoji via text', async ({ page }) => {
await poHomeChannel.content.sendMessage(':innocent:');
await page.keyboard.press('Enter');
await expect(poHomeChannel.content.lastUserMessage).toContainText('😇');
});
test('expect render special characters and numbers properly', async () => {
await poHomeChannel.content.sendMessage('® © ™ # *');
await expect(poHomeChannel.content.lastUserMessage).toContainText('® © ™ # *');
});
test('should add a custom emoji, send it, rename it, and check render', async ({ page }) => {
const emojiName = 'customemoji';
const newEmojiName = 'renamedemoji';
const emojiUrl = './tests/e2e/fixtures/files/test-image.jpeg';
poAdminEmoji = new AdminEmoji(page);
await test.step('Add custom emoji', async () => {
await poHomeChannel.navbar.openManageMenuItem('Workspace');
await poAdminEmoji.sidebar.linkEmoji.click();
await poAdminEmoji.btnNew.click();
await poAdminEmoji.addEmojiFlexTab.inputName.fill(emojiName);
const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'), page.locator('role=button[name="Custom Emoji"]').click()]);
await fileChooser.setFiles(emojiUrl);
await poAdminEmoji.addEmojiFlexTab.save();
await poAdminEmoji.sidebar.close();
await poHomeChannel.gotoChannel(targetChannel);
await poHomeChannel.content.sendMessage(`:${emojiName}:`);
await page.keyboard.press('Enter');
await expect(poHomeChannel.content.lastUserMessage.getByTitle(`:${emojiName}:`)).toBeVisible();
});
await test.step('Rename custom emoji', async () => {
await poHomeChannel.navbar.openManageMenuItem('Workspace');
await poAdminEmoji.sidebar.linkEmoji.click();
await (await poAdminEmoji.findEmojiByName(emojiName)).click();
await poAdminEmoji.editEmojiFlexTab.inputName.fill(newEmojiName);
await poAdminEmoji.editEmojiFlexTab.save();
await poAdminEmoji.sidebar.close();
await poHomeChannel.gotoChannel(targetChannel);
await poHomeChannel.content.sendMessage(`:${newEmojiName}:`);
await page.keyboard.press('Enter');
await expect(poHomeChannel.content.lastUserMessage.getByTitle(`:${newEmojiName}:`)).toBeVisible();
});
await test.step('Delete custom emoji', async () => {
await poHomeChannel.navbar.openManageMenuItem('Workspace');
await poAdminEmoji.sidebar.linkEmoji.click();
await poAdminEmoji.deleteEmoji(newEmojiName);
await expect(await poAdminEmoji.findEmojiByName(newEmojiName)).not.toBeVisible();
});
});
});