snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
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
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
This commit is contained in:
164
apps/meteor/tests/e2e/export-messages.spec.ts
Normal file
164
apps/meteor/tests/e2e/export-messages.spec.ts
Normal file
@@ -0,0 +1,164 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
import { Users } from './fixtures/userStates';
|
||||
import { HomeChannel } from './page-objects';
|
||||
import { createTargetChannel, deleteChannel } from './utils';
|
||||
import { test, expect } from './utils/test';
|
||||
|
||||
test.use({ storageState: Users.admin.state });
|
||||
|
||||
const uniqueMessage = (): string => `msg-${faker.string.uuid()}`;
|
||||
|
||||
test.describe('export-messages', () => {
|
||||
let poHomeChannel: HomeChannel;
|
||||
let targetChannel: string;
|
||||
|
||||
test.beforeAll(async ({ api }) => {
|
||||
targetChannel = await createTargetChannel(api);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
poHomeChannel = new HomeChannel(page);
|
||||
|
||||
await poHomeChannel.gotoChannel(targetChannel);
|
||||
});
|
||||
|
||||
test.afterAll(async ({ api }) => {
|
||||
await Promise.all([
|
||||
api.post('/users.setPreferences', { userId: 'rocketchat.internal.admin.test', data: { hideFlexTab: false } }),
|
||||
deleteChannel(api, targetChannel),
|
||||
]);
|
||||
});
|
||||
|
||||
test('should all export methods be available in targetChannel', async () => {
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.exposeMethods();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMethodOptionByName('Send email')).toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMethodOptionByName('Send file via email')).toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMethodOptionByName('Download file')).toBeVisible();
|
||||
});
|
||||
|
||||
test('should display export output format correctly depending on the selected method', async () => {
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
// TODO: Fix the base component to have a disabled statement and not only a class attribute
|
||||
// Here we are checking for a button because the internal select element is not accessible
|
||||
// and the higher component that is a button doesn't appear as disabled.
|
||||
await expect(poHomeChannel.tabs.exportMessages.outputFormat).toContainClass('disabled');
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.setMethod('Send file via email');
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.exposeOutputFormats();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('html')).toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('json')).toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('pdf')).not.toBeVisible();
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.setOutputFormat('html');
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.setMethod('Download file');
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.exposeOutputFormats();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('html')).not.toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('json')).toBeVisible();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getOutputFormatOptionByName('pdf')).toBeVisible();
|
||||
});
|
||||
|
||||
test('when trying to send email without filling to users or to additional emails, should mark both fields as invalid', async () => {
|
||||
const testMessage = uniqueMessage();
|
||||
|
||||
await poHomeChannel.content.sendMessage(testMessage);
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
await expect(poHomeChannel.btnContextualbarClose).toBeVisible();
|
||||
|
||||
await poHomeChannel.content.getMessageByText(testMessage).click();
|
||||
await poHomeChannel.tabs.exportMessages.send();
|
||||
|
||||
const usersField = poHomeChannel.tabs.exportMessages.inputUsers;
|
||||
const additionalEmailsField = poHomeChannel.tabs.exportMessages.inputAdditionalEmails;
|
||||
|
||||
await expect(usersField).toHaveAttribute('aria-invalid', 'true');
|
||||
await expect(additionalEmailsField).toHaveAttribute('aria-invalid', 'true');
|
||||
|
||||
const errorMessages = poHomeChannel.tabs.exportMessages.errorMessage(
|
||||
'You must select one or more users or provide one or more email addresses, separated by commas',
|
||||
);
|
||||
await expect(errorMessages).toHaveCount(2);
|
||||
});
|
||||
|
||||
test('should display an error when trying to send email without selecting any message', async ({ page }) => {
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.setAdditionalEmail('mail@mail.com');
|
||||
await poHomeChannel.tabs.exportMessages.send();
|
||||
|
||||
await expect(
|
||||
page.locator('[role="alert"]', {
|
||||
hasText: `You haven't selected any messages`,
|
||||
}),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should be able to send messages after closing export messages', async () => {
|
||||
const message1 = uniqueMessage();
|
||||
const message2 = uniqueMessage();
|
||||
|
||||
await poHomeChannel.content.sendMessage(message1);
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
await poHomeChannel.content.getMessageByText(message1).click();
|
||||
await poHomeChannel.btnContextualbarClose.click();
|
||||
await poHomeChannel.content.sendMessage(message2);
|
||||
|
||||
await expect(poHomeChannel.content.getMessageByText(message2)).toBeVisible();
|
||||
});
|
||||
|
||||
test('should be able to select a single message to export', async () => {
|
||||
const message1 = uniqueMessage();
|
||||
const message2 = uniqueMessage();
|
||||
|
||||
await poHomeChannel.content.sendMessage(message1);
|
||||
await poHomeChannel.content.sendMessage(message2);
|
||||
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
await poHomeChannel.tabs.exportMessages.waitForDisplay();
|
||||
|
||||
await poHomeChannel.content.getMessageByText(message1).click();
|
||||
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMessageCheckbox(message1)).toBeChecked();
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMessageCheckbox(message2)).not.toBeChecked();
|
||||
await expect(poHomeChannel.tabs.exportMessages.clearSelectionButton).toBeEnabled();
|
||||
|
||||
await expect(poHomeChannel.tabs.exportMessages.sendButton).toBeEnabled();
|
||||
});
|
||||
|
||||
test('should be able to select a single message to export with hide contextual bar preference enabled', async ({ api }) => {
|
||||
await api.post('/users.setPreferences', {
|
||||
userId: 'rocketchat.internal.admin.test',
|
||||
data: { hideFlexTab: true },
|
||||
});
|
||||
const message1 = uniqueMessage();
|
||||
const message2 = uniqueMessage();
|
||||
|
||||
await poHomeChannel.content.sendMessage(message1);
|
||||
await poHomeChannel.content.sendMessage(message2);
|
||||
|
||||
await poHomeChannel.roomToolbar.openMoreOptions();
|
||||
await poHomeChannel.roomToolbar.menuItemExportMessages.click();
|
||||
|
||||
await poHomeChannel.tabs.exportMessages.waitForDisplay();
|
||||
await poHomeChannel.content.getMessageByText(message1).click();
|
||||
|
||||
await expect(poHomeChannel.tabs.exportMessages.getMessageCheckbox(message1)).toBeChecked();
|
||||
await expect(poHomeChannel.tabs.exportMessages.clearSelectionButton).toBeEnabled();
|
||||
|
||||
await expect(poHomeChannel.tabs.exportMessages.sendButton).toBeEnabled();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user