Skip to content

Commit

Permalink
e2e: Added recording tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Aug 1, 2024
1 parent a0c724f commit fde7088
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 9 deletions.
60 changes: 51 additions & 9 deletions openvidu-call-front/e2e/recording.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { expect } from 'chai';
import { Builder, WebDriver, WebElement } from 'selenium-webdriver';
import { Builder, WebDriver } from 'selenium-webdriver';
import { OpenViduCallConfig } from './selenium.conf';
import { OpenViduCallPO } from './utils.po.test';
import * as fs from 'fs';
import { PNG } from 'pngjs';
import pixelmatch from 'pixelmatch';

const url = OpenViduCallConfig.appUrl;

Expand All @@ -22,6 +19,24 @@ describe('Testing recordings', () => {
.build();
}

async function connectStartAndStopRecording() {
await browser.get(`${url}${randomRoomName}`);

await utils.checkPrejoinIsPresent();
await utils.joinSession();

await utils.checkToolbarIsPresent();

await utils.startRecordingFromToolbar();
await utils.checkRecordingIsStarting();
await utils.checkRecordingIsStarted();

await browser.sleep(2000);

await utils.stopRecordingFromPanel();
await utils.checkRecordingIsStopped();
}

beforeEach(async () => {
browser = await createChromeBrowser();
utils = new OpenViduCallPO(browser);
Expand All @@ -32,12 +47,39 @@ describe('Testing recordings', () => {
await browser.quit();
});

it('should be able to record the session', async () => {});
it('should be able to record the session', async () => {
await connectStartAndStopRecording();

await utils.waitForElement('.recording-item');
expect(await utils.getNumberOfElements('.recording-item')).equals(1);
});

it('should be able to delete a recording', async () => {});
it('should be able to delete a recording', async () => {
await connectStartAndStopRecording();

it('should be able to play a recording', async () => {});
await utils.waitForElement('.recording-item');
expect(await utils.getNumberOfElements('.recording-item')).equals(1);

it('should be able to download a recording', async () => {});
await utils.deleteRecording();

await browser.sleep(500);
expect(await utils.getNumberOfElements('.recording-item')).equals(0);
});

it('should be able to play a recording', async () => {
await connectStartAndStopRecording();

await utils.waitForElement('.recording-item');
expect(await utils.getNumberOfElements('.recording-item')).equals(1);

await utils.playRecording();

await browser.sleep(1000);
await utils.waitForElement('app-recording-dialog');

// participant video and recording video
expect(await utils.getNumberOfElements('video')).equals(2);
});

});
// it('should be able to download a recording', async () => {});
});
56 changes: 56 additions & 0 deletions openvidu-call-front/e2e/utils.po.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,60 @@ export class OpenViduCallPO {
async getNumberOfElements(selector: string): Promise<number> {
return (await this.browser.findElements(By.css(selector))).length;
}

async startRecordingFromToolbar(): Promise<void> {
await this.waitForElement('#more-options-btn');
await this.clickOn('#more-options-btn');

await this.waitForElement('#recording-btn');
await this.clickOn('#recording-btn');
}

async stopRecordingFromToolbar(): Promise<void> {
await this.waitForElement('#more-options-btn');
await this.clickOn('#more-options-btn');
await this.waitForElement('#recording-btn');
await this.clickOn('#recording-btn');
}

async stopRecordingFromPanel(): Promise<void> {
await this.waitForElement('ov-activities-panel');
await this.waitForElement('#stop-recording-btn');
await this.clickOn('#stop-recording-btn');
}

async deleteRecording(): Promise<void> {
await this.waitForElement('.recording-item');
await this.waitForElement('#delete-recording-btn');
await this.clickOn('#delete-recording-btn');

await this.waitForElement('app-delete-dialog');
await this.waitForElement('#delete-recording-confirm-btn');
await this.clickOn('#delete-recording-confirm-btn');
}

async playRecording() {
await this.waitForElement('.recording-item');
await this.waitForElement('#play-recording-btn');
await this.clickOn('#play-recording-btn');
}

async checkRecordingIsStopped(): Promise<void> {
await this.waitForElement('#recording-status.stopped');
}

async checkRecordingIsStarting(): Promise<void> {
await this.waitForElement('ov-activities-panel');
await this.waitForElement('#recording-status.starting');
}

async checkRecordingIsStopping(): Promise<void> {
await this.waitForElement('ov-activities-panel');
await this.waitForElement('#recording-status.stopping');
}

async checkRecordingIsStarted(): Promise<void> {
await this.waitForElement('#recording-status.started');
await this.waitForElement('#recording-tag');
}
}

0 comments on commit fde7088

Please sign in to comment.