Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Disable slash commands for encrypted rooms #32548

Merged
merged 13 commits into from
Jun 19, 2024
38 changes: 38 additions & 0 deletions apps/meteor/tests/e2e/e2e-encryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,44 @@
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();
});

test.describe('un-encrypted messages not allowed in e2ee rooms', () => {
let poHomeChannel: HomeChannel;

test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
await page.goto('/home');
});
test.beforeAll(async ({ api }) => {
expect((await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false })).status()).toBe(200);
});

test.afterAll(async ({ api }) => {
expect((await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false })).status()).toBe(200);
});
yash-rajpal marked this conversation as resolved.
Show resolved Hide resolved

test('expect slash commands to be disabled in an e2ee room', async ({ page }) => {
await restoreState(page, Users.admin);
const channelName = faker.string.uuid();

await poHomeChannel.sidenav.createEncryptedChannel(channelName);

await expect(page).toHaveURL(`/group/${channelName}`);

await poHomeChannel.dismissToast();

await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible();

await poHomeChannel.content.sendMessage('This is an encrypted message.');

await expect(poHomeChannel.content.lastUserMessageBody).toHaveText('This is an encrypted message.');
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();

await page.locator('[name="msg"]').type('/');
await expect(page.locator('#popup-item-contextualbar')).toHaveClass(/disabled/)

Check failure on line 275 in apps/meteor/tests/e2e/e2e-encryption.spec.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Replace `⏎` with `;`
yash-rajpal marked this conversation as resolved.
Show resolved Hide resolved

});
});

test.describe('reset keys', () => {
let anotherClientPage: Page;

Expand Down
Loading