openvidu/openvidu-components-angular/e2e/toolbar.test.ts

65 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-07-02 19:19:05 +02:00
import { Builder, WebDriver } from 'selenium-webdriver';
import { TestAppConfig } from './selenium.conf';
import { OpenViduComponentsPO } from './utils.po.test';
2024-07-02 19:19:05 +02:00
const url = TestAppConfig.appUrl;
2024-07-02 19:19:05 +02:00
describe('Toolbar button functionality for local media control', () => {
2024-07-02 19:19:05 +02:00
let browser: WebDriver;
let utils: OpenViduComponentsPO;
async function createChromeBrowser(): Promise<WebDriver> {
return await new Builder()
.forBrowser(TestAppConfig.browserName)
.withCapabilities(TestAppConfig.browserCapabilities)
.setChromeOptions(TestAppConfig.browserOptions)
.usingServer(TestAppConfig.seleniumAddress)
2024-07-02 19:19:05 +02:00
.build();
}
beforeEach(async () => {
browser = await createChromeBrowser();
utils = new OpenViduComponentsPO(browser);
});
afterEach(async () => {
try {
await utils.leaveRoom();
} catch (error) {}
2024-07-02 19:19:05 +02:00
await browser.quit();
});
it('should toggle mute/unmute on the local microphone and update the icon accordingly', async () => {
2024-07-02 19:19:05 +02:00
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
const micButton = await utils.waitForElement('#mic-btn');
await micButton.click();
await utils.waitForElement('#mic-btn #mic_off');
expect(await utils.isPresent('#mic-btn #mic_off')).toBeTrue();
2024-07-02 19:19:05 +02:00
await micButton.click();
await utils.waitForElement('#mic-btn #mic');
expect(await utils.isPresent('#mic-btn #mic')).toBeTrue();
2024-07-02 19:19:05 +02:00
});
it('should toggle mute/unmute on the local camera and update the icon accordingly', async () => {
2024-07-02 19:19:05 +02:00
await browser.get(`${url}&prejoin=false`);
await utils.checkLayoutPresent();
const cameraButton = await utils.waitForElement('#camera-btn');
await cameraButton.click();
await utils.waitForElement('#camera-btn #videocam_off');
expect(await utils.isPresent('#camera-btn #videocam_off')).toBeTrue();
2024-07-02 19:19:05 +02:00
await cameraButton.click();
await utils.waitForElement('#camera-btn #videocam');
expect(await utils.isPresent('#camera-btn #videocam')).toBeTrue();
2024-07-02 19:19:05 +02:00
});
});