openvidu/openvidu-components-angular/e2e/webcomponent-e2e/panels.test.ts

225 lines
7.3 KiB
TypeScript
Raw Normal View History

2024-07-02 19:19:05 +02:00
import { Builder, Key, WebDriver } from 'selenium-webdriver';
import { OPENVIDU_CALL_SERVER } from '../config';
import { getBrowserOptionsWithoutDevices, WebComponentConfig } from '../selenium.conf';
import { OpenViduComponentsPO } from '../utils.po.test';
const url = `${WebComponentConfig.appUrl}?OV_URL=${OPENVIDU_CALL_SERVER}`;
describe('Testing panels', () => {
let browser: WebDriver;
let utils: OpenViduComponentsPO;
async function createChromeBrowser(): Promise<WebDriver> {
return await new Builder()
.forBrowser(WebComponentConfig.browserName)
.withCapabilities(WebComponentConfig.browserCapabilities)
.setChromeOptions(WebComponentConfig.browserOptions)
.usingServer(WebComponentConfig.seleniumAddress)
.build();
}
beforeEach(async () => {
browser = await createChromeBrowser();
utils = new OpenViduComponentsPO(browser);
});
afterEach(async () => {
await browser.quit();
});
/**
* TODO
* It only works with OpenVidu PRO because this is a PRO feature
*/
// it('should toggle BACKGROUND panel on prejoin page when VIDEO is MUTED', async () => {
// let element;
// await browser.get(`${url}`);
// element = await utils.waitForElement('#pre-join-container');
// expect(await utils.isPresent('#pre-join-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
// const backgroundButton = await utils.waitForElement('#background-effects-btn');
// expect(await utils.isPresent('#background-effects-btn')).toBeTrue();
// expect(await backgroundButton.isEnabled()).toBeTrue();
2024-07-02 19:19:05 +02:00
// await backgroundButton.click();
// await browser.sleep(500);
// await utils.waitForElement('#background-effects-container');
// expect(await utils.isPresent('#background-effects-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
// element = await utils.waitForElement('#camera-button');
// expect(await utils.isPresent('#camera-button')).toBeTrue();
// expect(await element.isEnabled()).toBeTrue();
2024-07-02 19:19:05 +02:00
// await element.click();
// await browser.sleep(500);
// element = await utils.waitForElement('#video-poster');
// expect(await utils.isPresent('#video-poster')).toBeTrue();
2024-07-02 19:19:05 +02:00
// expect(await backgroundButton.isDisplayed()).toBeTrue();
// expect(await backgroundButton.isEnabled()).toBeFalse();
2024-07-02 19:19:05 +02:00
// expect(await utils.isPresent('#background-effects-container')).toBeFalse();
2024-07-02 19:19:05 +02:00
// });
it('should toggle CHAT panel', async () => {
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
const chatButton = await utils.waitForElement('#chat-panel-btn');
await chatButton.click();
await utils.waitForElement('.sidenav-menu');
await utils.waitForElement('.input-container');
expect(await utils.isPresent('.input-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
await utils.waitForElement('.messages-container');
expect(await utils.isPresent('.messages-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
await chatButton.click();
expect(await utils.isPresent('.input-container')).toBeFalse();
expect(await utils.isPresent('.messages-container')).toBeFalse();
2024-07-02 19:19:05 +02:00
});
it('should toggle PARTICIPANTS panel', async () => {
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
const participantBtn = await utils.waitForElement('#participants-panel-btn');
await participantBtn.click();
await utils.waitForElement('.sidenav-menu');
await utils.waitForElement('.local-participant-container');
expect(await utils.isPresent('.local-participant-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
await utils.waitForElement('ov-participant-panel-item');
expect(await utils.isPresent('ov-participant-panel-item')).toBeTrue();
2024-07-02 19:19:05 +02:00
await participantBtn.click();
expect(await utils.isPresent('.local-participant-container')).toBeFalse();
expect(await utils.isPresent('ov-participant-panel-item')).toBeFalse();
2024-07-02 19:19:05 +02:00
});
it('should toggle ACTIVITIES panel', async () => {
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
// Get activities button and click into it
const activitiesBtn = await utils.waitForElement('#activities-panel-btn');
await activitiesBtn.click();
await utils.waitForElement('.sidenav-menu');
await utils.waitForElement('#activities-container');
expect(await utils.isPresent('#activities-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
await utils.waitForElement('#recording-activity');
expect(await utils.isPresent('#recording-activity')).toBeTrue();
2024-07-02 19:19:05 +02:00
await activitiesBtn.click();
expect(await utils.isPresent('#activities-container')).toBeFalse();
expect(await utils.isPresent('#recording-activity')).toBeFalse();
2024-07-02 19:19:05 +02:00
});
it('should toggle SETTINGS panel', async () => {
let element;
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
// Checking if toolbar is present
await utils.checkToolbarIsPresent();
await utils.togglePanel('settings');
element = await utils.waitForElement('.sidenav-menu');
expect(await utils.isPresent('#default-settings-panel')).toBeTrue();
2024-07-02 19:19:05 +02:00
});
it('should switching between PARTICIPANTS and CHAT panels', async () => {
await browser.get(`${url}&prejoin=false`);
await utils.checkSessionIsPresent();
await utils.checkToolbarIsPresent();
// Open chat panel
const chatButton = await utils.waitForElement('#chat-panel-btn');
await chatButton.click();
await utils.waitForElement('.sidenav-menu');
expect(await utils.isPresent('.sidenav-menu')).toBeTrue();
2024-07-02 19:19:05 +02:00
await utils.waitForElement('.input-container');
expect(await utils.isPresent('.input-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
expect(await utils.isPresent('.messages-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
// Open participants panel
const participantBtn = await utils.waitForElement('#participants-panel-btn');
await participantBtn.click();
await utils.waitForElement('.sidenav-menu');
expect(await utils.isPresent('.local-participant-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
expect(await utils.isPresent('ov-participant-panel-item')).toBeTrue();
2024-07-02 19:19:05 +02:00
// Switch to chat panel
await chatButton.click();
await utils.waitForElement('.sidenav-menu');
expect(await utils.isPresent('.input-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
expect(await utils.isPresent('.messages-container')).toBeTrue();
2024-07-02 19:19:05 +02:00
expect(await utils.isPresent('.local-participant-container')).toBeFalse();
2024-07-02 19:19:05 +02:00
expect(await utils.isPresent('ov-participant-panel-item')).toBeFalse();
2024-07-02 19:19:05 +02:00
// Close chat panel
await chatButton.click();
expect(await utils.getNumberOfElements('.input-container')).toEqual(0);
expect(await utils.isPresent('messages-container')).toBeFalse();
2024-07-02 19:19:05 +02:00
});
it('should switching between sections in SETTINGS PANEL', async () => {
let element;
await browser.get(`${url}&prejoin=false`);
await utils.checkToolbarIsPresent();
// Checking if toolbar is present
await utils.checkToolbarIsPresent();
// Open more options menu
await utils.togglePanel('settings');
await utils.waitForElement('.sidenav-menu');
expect(await utils.isPresent('.sidenav-menu')).toBeTrue();
2024-07-02 19:19:05 +02:00
// Check if general section is shown
element = await utils.waitForElement('#general-opt');
await element.click();
expect(await utils.isPresent('ov-participant-name-input')).toBeTrue();
2024-07-02 19:19:05 +02:00
// Check if video section is shown
element = await utils.waitForElement('#video-opt');
await element.click();
expect(await utils.isPresent('ov-video-devices-select')).toBeTrue();
2024-07-02 19:19:05 +02:00
// Check if audio section is shown
element = await utils.waitForElement('#audio-opt');
await element.click();
expect(await utils.isPresent('ov-audio-devices-select')).toBeTrue();
2024-07-02 19:19:05 +02:00
});
});