Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sixty-ladybugs-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where the start call button is available in archived rooms
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useVideoCallRoomAction = () => {

const visible = groups.length > 0;
const allowed = visible && permittedToCallManagement && (!user?.username || !room.muted?.includes(user.username)) && !ownUser;
const disabled = federated || (!!room.ro && !permittedToPostReadonly);
const disabled = federated || (!!room.ro && !permittedToPostReadonly) || room.archived;
const tooltip = disabled ? t('core.Video_Call_unavailable_for_this_type_of_room') : '';

const handleOpenVideoConf = useEffectEvent(async () => {
Expand Down
16 changes: 16 additions & 0 deletions apps/meteor/tests/e2e/utils/create-target-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,19 @@ export async function createChannelWithTeam(api: BaseTest['api']): Promise<Recor

return { channelName, teamName };
}

export async function createArchivedChannel(api: BaseTest['api']): Promise<string> {
const { channel } = await createTargetChannelAndReturnFullRoom(api);

try {
await api.post('/channels.archive', { roomId: channel._id });
} catch (error) {
throw new Error(`Error archiving the channel: ${error}`);
}

if (!channel.name) {
throw new Error('Invalid channel was created');
}

return channel.name;
}
51 changes: 38 additions & 13 deletions apps/meteor/tests/e2e/video-conference.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { IS_EE } from './config/constants';
import { Users } from './fixtures/userStates';
import { HomeChannel } from './page-objects';
import { createTargetChannel, setUserPreferences, createTargetTeam, createDirectMessage } from './utils';
import {
createArchivedChannel,
createTargetChannel,
setUserPreferences,
createTargetTeam,
createDirectMessage,
deleteChannel,
deleteTeam,
} from './utils';
import { expect, test } from './utils/test';

test.use({ storageState: Users.user1.state });
Expand All @@ -11,15 +19,26 @@ test.describe('video conference', () => {
let poHomeChannel: HomeChannel;
let targetChannel: string;
let targetReadOnlyChannel: string;
let targetArchivedChannel: string;
let targetTeam: string;

test.beforeAll(async ({ api }) => {
targetChannel = await createTargetChannel(api);
targetReadOnlyChannel = await createTargetChannel(api, { readOnly: true });
targetArchivedChannel = await createArchivedChannel(api);
targetTeam = await createTargetTeam(api);
await createDirectMessage(api);
});

test.afterAll(async ({ api }) => {
await Promise.all([
deleteChannel(api, targetChannel),
deleteChannel(api, targetArchivedChannel),
deleteChannel(api, targetReadOnlyChannel),
deleteTeam(api, targetTeam),
]);
});

test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);

Expand Down Expand Up @@ -47,7 +66,7 @@ test.describe('video conference', () => {
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});

test.describe('test video conference message block', async () => {
test.describe('video conference message block', async () => {
test.use({ storageState: Users.admin.state });

test.beforeAll(async ({ api }) => {
Expand All @@ -58,22 +77,22 @@ test.describe('video conference', () => {
await setUserPreferences(api, { displayAvatars: true });
});

test('should not render avatars in video conference message block', async () => {
test('should NOT render avatars in video conference message block', async () => {
await poHomeChannel.sidenav.openChat(targetChannel);

await expect(poHomeChannel.content.videoConfMessageBlock.last().getByRole('figure')).toHaveCount(0);
});
});

test.describe('test received in a "target channel"', async () => {
test.describe('verify if user2 received a invite call in targetChannel', async () => {
test.use({ storageState: Users.user2.state });
test('verify if user received a invite call from "targetChannel"', async () => {
test('should display a message block in a targetChannel', async () => {
await poHomeChannel.sidenav.openChat(targetChannel);
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});
});

test('expect create video conference in a direct', async () => {
test('should create video conference in a direct room', async () => {
await poHomeChannel.sidenav.openChat('user2');

await poHomeChannel.content.btnVideoCall.click();
Expand All @@ -89,23 +108,23 @@ test.describe('video conference', () => {
});
});

test('expect create video conference in a "targetTeam"', async () => {
test('should create video conference in targetTeam', async () => {
await poHomeChannel.sidenav.openChat(targetTeam);

await poHomeChannel.content.btnVideoCall.click();
await poHomeChannel.content.btnStartVideoCall.click();
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});

test.describe('verify if received from a "targetTeam"', async () => {
test.describe('verify if user2 received from a targetTeam', async () => {
test.use({ storageState: Users.user2.state });
test('verify if user received from a "targetTeam"', async () => {
test('should display a message block in a targetTeam', async () => {
await poHomeChannel.sidenav.openChat(targetTeam);
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});
});

test('expect create video conference in a direct multiple', async () => {
test('should create video conference in a direct multiple', async () => {
await poHomeChannel.sidenav.openChat('rocketchat.internal.admin.test, user2');

await poHomeChannel.content.btnVideoCall.click();
Expand All @@ -115,15 +134,21 @@ test.describe('video conference', () => {

test.describe('received in a direct multiple', async () => {
test.use({ storageState: Users.user2.state });
test('verify if user received from a multiple', async () => {
test('should display a message block in a direct multiple', async () => {
await poHomeChannel.sidenav.openChat('rocketchat.internal.admin.test, user1');
await expect(poHomeChannel.content.videoConfMessageBlock.last()).toBeVisible();
});
});

test('expect create video conference not available in a "targetReadOnlyChannel"', async () => {
test('should NOT create video conference in a targetReadOnlyChannel', async () => {
await poHomeChannel.sidenav.openChat(targetReadOnlyChannel);

await expect(poHomeChannel.content.btnVideoCall).hasAttribute('disabled');
await expect(poHomeChannel.content.btnVideoCall).toBeDisabled();
});

test('should NOT be able to create video conference in targetArchivedChannel', async () => {
await poHomeChannel.sidenav.openChat(targetArchivedChannel);

await expect(poHomeChannel.content.btnVideoCall).toBeDisabled();
});
});
Loading