Skip to content

Commit 54a58f5

Browse files
authored
test: Export messages PDF for e2e rooms (RocketChat#36417)
1 parent d277737 commit 54a58f5

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

apps/meteor/tests/e2e/e2e-encryption.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,34 @@ test.describe('basic features', () => {
284284
await expect(exportMessagesTab.downloadFileMethod).toBeVisible();
285285
await expect(exportMessagesTab.sendEmailMethod).not.toBeVisible();
286286
});
287+
288+
test('should allow exporting messages as PDF in an encrypted room', async ({ page }) => {
289+
const sidenav = new HomeSidenav(page);
290+
const encryptedRoomPage = new EncryptedRoomPage(page);
291+
const exportMessagesTab = new HomeFlextabExportMessages(page);
292+
293+
const channelName = faker.string.uuid();
294+
295+
await sidenav.createEncryptedChannel(channelName);
296+
await expect(page).toHaveURL(`/group/${channelName}`);
297+
await expect(encryptedRoomPage.encryptedRoomHeaderIcon).toBeVisible();
298+
299+
await encryptedRoomPage.sendMessage('This is a message to export as PDF.');
300+
await encryptedRoomPage.showExportMessagesTab();
301+
await expect(exportMessagesTab.downloadFileMethod).toBeVisible();
302+
303+
// Select Output format as PDF
304+
await exportMessagesTab.outputFormat.click();
305+
await exportMessagesTab.getMethodByName('PDF').click();
306+
307+
// select messages to be exported
308+
await exportMessagesTab.btnSelectMessages.click();
309+
310+
// Wait for download event and match format
311+
const [download] = await Promise.all([page.waitForEvent('download'), exportMessagesTab.btnDownloadExportMessages.click()]);
312+
const suggestedFilename = download.suggestedFilename();
313+
expect(suggestedFilename).toMatch(/\.pdf$/);
314+
});
287315
});
288316

289317
test.describe.serial('e2e-encryption', () => {

apps/meteor/tests/e2e/page-objects/fragments/home-flextab-exportMessages.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ export class HomeFlextabExportMessages {
1919
return this.page.getByRole('option', { name });
2020
}
2121

22+
get outputFormat() {
23+
return this.page.getByRole('button', { name: 'JSON' });
24+
}
25+
26+
get btnSelectMessages() {
27+
return this.page.getByRole('button', { name: 'Select 1 messages' });
28+
}
29+
30+
get btnDownloadExportMessages() {
31+
return this.page.getByRole('button', { name: 'Download', exact: true });
32+
}
33+
2234
get textboxAdditionalEmails() {
2335
return this.page.getByRole('textbox', { name: 'To additional emails' });
2436
}

0 commit comments

Comments
 (0)