Skip to content

VIDCS-3667: Adding a few more integration tests #153

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

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
48 changes: 48 additions & 0 deletions integration-tests/tests/meetingroom.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { expect } from '@playwright/test';
import * as crypto from 'crypto';
import { test } from '../fixtures/testWithLogging';
import { openMeetingRoomWithSettings, waitAndClickFirefox } from './utils';

test.describe('meeting room', () => {
test('force mute', async ({ page: pageOne, context, browserName, isMobile }) => {
const roomName = crypto.randomBytes(5).toString('hex');

const pageTwo = await context.newPage();

await openMeetingRoomWithSettings({
page: pageOne,
username: 'User One',
roomName,
audioOff: true,
browserName,
});
// These clicks and waits are needed for firefox
await waitAndClickFirefox(pageOne, browserName);

await openMeetingRoomWithSettings({
page: pageTwo,
username: 'User Two',
roomName,
audioOff: false,
browserName,
});
await expect(pageTwo.getByTestId('MicNoneIcon')).toBeVisible();

if (isMobile) {
await pageOne.getByTestId('MoreVertIcon').click();
await pageOne.mouse.move(0, 0); // Moves cursor to top-left corner to hide tooltip
}

const participantsListButton = await pageOne.getByTestId('PeopleIcon');
await participantsListButton.click();

const participantItem = await pageOne.locator('[data-testid^="participant-list-item"]', {
hasText: 'User Two',
});

await participantItem.getByTestId('MicIcon').click();
await pageOne.getByTestId('popup-dialog-primary-button').click();

await expect(pageTwo.getByTestId('MicOffToolbar')).toBeVisible();
});
});
33 changes: 33 additions & 0 deletions integration-tests/tests/pinning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,38 @@ test.describe('participant pinning', () => {
const publisherRect = await publisher.boundingBox();
expect(userTwoSubscriberRet.width).toBeGreaterThan(1.2 * publisherRect.width);
expect(userTwoSubscriberRet.height).toBeGreaterThan(2 * publisherRect.height);

// unpinning user 2 from the participants list
if (isMobile) {
await pageThree.getByTestId('MoreVertIcon').click();
await pageThree.mouse.move(0, 0); // Moves cursor to top-left corner to hide tooltip
}

const participantsListButton = await pageThree.getByTestId('PeopleIcon');
await participantsListButton.click();

const participantItem = await pageThree.locator('[data-testid^="participant-list-item"]', {
hasText: 'User Two',
});
// Within that list item, find and click the MoreVert button
await participantItem.getByTestId('MoreVertIcon').click();

await pageThree
.locator('[data-testid^="pin-menu-item"]', {
hasText: 'Unpin User Two',
})
.click();

const closeIconButton = pageThree.locator(
'//span[contains(text(),"Participants")]/following-sibling::button'
);
await closeIconButton.click();

const newUserTwoSubscriberRet = await userTwoSubscriber.boundingBox();
const newPublisherRect = await publisher.boundingBox();

await pageThree.waitForTimeout(1000);
expect(newUserTwoSubscriberRet.width).toBeLessThan(1.2 * newPublisherRect.width);
expect(newUserTwoSubscriberRet.height).toBeLessThan(2 * newPublisherRect.height);
});
});
94 changes: 94 additions & 0 deletions integration-tests/tests/recording.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { expect } from '@playwright/test';
import * as crypto from 'crypto';
import { test } from '../fixtures/testWithLogging';
import { openMeetingRoomWithSettings, waitAndClickFirefox } from './utils';

test.describe('Recording Feature', () => {
test('should start and stop recording and verify the download link', async ({
page: pageOne,
browserName,
isMobile,
}) => {
const roomName = crypto.randomBytes(5).toString('hex');

await openMeetingRoomWithSettings({
page: pageOne,
username: 'User One',
roomName,
audioOff: true,
browserName,
});

await waitAndClickFirefox(pageOne, browserName);
await pageOne.waitForSelector('.publisher', { state: 'visible' });

if (isMobile) {
await pageOne.getByTestId('MoreVertIcon').click();
await pageOne.mouse.move(0, 0); // Moves cursor to top-left corner to hide tooltip
}
const archivingButton = pageOne.getByTestId('archiving-button');
await archivingButton.click();

const confirmStartButton = pageOne.getByTestId('popup-dialog-primary-button');
await confirmStartButton.click();

if (isMobile) {
const recordingIndicator = pageOne
.getByTestId('smallViewportHeader')
.getByTestId('RadioButtonCheckedIcon');

await expect(recordingIndicator).toBeVisible({ timeout: 5000 });

const actualColor = await recordingIndicator.evaluate(
(el) => window.getComputedStyle(el).color
);
console.log('Mobile icon color:', actualColor);

await expect
.poll(() => recordingIndicator.evaluate((el) => window.getComputedStyle(el).color), {
message: 'Waiting for recording to start (mobile red icon)',
timeout: 5000,
})
.toBe('rgb(239, 68, 68)');

await pageOne.getByTestId('MoreVertIcon').click();
await pageOne.mouse.move(0, 0);
} else {
await expect
.poll(
() => archivingButton.locator('svg').evaluate((el) => window.getComputedStyle(el).color),
{
message: 'Waiting for recording to start (red icon)',
timeout: 5000,
}
)
.toBe('rgb(239, 68, 68)');
}
await archivingButton.click();
await confirmStartButton.click();

await expect
.poll(
() => archivingButton.locator('svg').evaluate((el) => window.getComputedStyle(el).color),
{
message: 'Waiting for recording to stop (white icon)',
timeout: 5000,
}
)
.toBe('rgb(255, 255, 255)');

await pageOne.getByTestId('CallEndIcon').click();

await pageOne.getByText('Recording 1', { exact: true }).waitFor();

const downloadIcon = pageOne.getByTestId('archive-download-button');
await expect(downloadIcon).toBeVisible({ timeout: 10000 });

const href = await downloadIcon.evaluate((el) => {
const anchor = el.closest('a');
return anchor ? anchor.href : null;
});

expect(href).toBeTruthy();
});
});
Loading