openvidu-components: Added panel e2e tests

pull/713/head
csantosm 2022-04-06 10:02:54 +02:00
parent 4fc878f796
commit 4c2ab10e07
1 changed files with 118 additions and 3 deletions

View File

@ -8,7 +8,6 @@ const TIMEOUT = 5000;
describe('Testing API Directives', () => { describe('Testing API Directives', () => {
let browser: WebDriver; let browser: WebDriver;
async function createChromeBrowser(): Promise<WebDriver> { async function createChromeBrowser(): Promise<WebDriver> {
return await new Builder() return await new Builder()
.forBrowser(WebComponentConfig.browserName) .forBrowser(WebComponentConfig.browserName)
.withCapabilities(WebComponentConfig.browserCapabilities) .withCapabilities(WebComponentConfig.browserCapabilities)
@ -401,7 +400,6 @@ describe('Testing API Directives', () => {
describe('Testing videoconference EVENTS', () => { describe('Testing videoconference EVENTS', () => {
let browser: WebDriver; let browser: WebDriver;
async function createChromeBrowser(): Promise<WebDriver> { async function createChromeBrowser(): Promise<WebDriver> {
return await new Builder() return await new Builder()
.forBrowser(WebComponentConfig.browserName) .forBrowser(WebComponentConfig.browserName)
.withCapabilities(WebComponentConfig.browserCapabilities) .withCapabilities(WebComponentConfig.browserCapabilities)
@ -586,7 +584,6 @@ describe('Testing videoconference EVENTS', () => {
element = await browser.wait(until.elementLocated(By.id(`${participantName}-sessionDisconnected`)), TIMEOUT); element = await browser.wait(until.elementLocated(By.id(`${participantName}-sessionDisconnected`)), TIMEOUT);
expect(await element.isDisplayed()).to.be.true; expect(await element.isDisplayed()).to.be.true;
}); });
}); });
describe('Testing screenshare features', () => { describe('Testing screenshare features', () => {
@ -796,3 +793,121 @@ describe('Testing screenshare features', () => {
expect(isAudioEnabled).to.be.false; expect(isAudioEnabled).to.be.false;
}); });
}); });
describe('Testing panel toggling', () => {
let browser: WebDriver;
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();
});
afterEach(async () => {
await browser.quit();
});
it('should toggle CHAT panel', async () => {
let element;
await browser.get(`${url}?prejoin=false`);
element = await browser.wait(until.elementLocated(By.id('layout')), TIMEOUT);
expect(await element.isDisplayed()).to.be.true;
const chatButton = await browser.findElement(By.id('chat-panel-btn'));
expect(await chatButton.isDisplayed()).to.be.true;
await chatButton.click();
element = await browser.wait(until.elementLocated(By.className('sidenav-menu')), TIMEOUT);
element = await browser.findElements(By.className('input-container'));
expect(element.length).equals(1);
element = await browser.findElement(By.className('messages-container'));
expect(await element.isDisplayed()).to.be.true;
await chatButton.click();
element = await browser.findElements(By.className('input-container'));
expect(element.length).equals(0);
element = await browser.findElements(By.css('messages-container'));
expect(element.length).equals(0);
});
it('should toggle PARTICIPANTS panel', async () => {
let element;
await browser.get(`${url}?prejoin=false`);
element = await browser.wait(until.elementLocated(By.id('layout')), TIMEOUT);
expect(await element.isDisplayed()).to.be.true;
const participantBtn = await browser.findElement(By.id('participants-panel-btn'));
expect(await participantBtn.isDisplayed()).to.be.true;
await participantBtn.click();
element = await browser.wait(until.elementLocated(By.className('sidenav-menu')), TIMEOUT);
element = await browser.findElements(By.className('local-participant-container'));
expect(element.length).equals(1);
element = await browser.findElement(By.css('ov-participant-panel-item'));
expect(await element.isDisplayed()).to.be.true;
await participantBtn.click();
element = await browser.findElements(By.className('local-participant-container'));
expect(element.length).equals(0);
element = await browser.findElements(By.css('ov-participant-panel-item'));
expect(element.length).equals(0);
});
it('should switching between PARTICIPANTS and CHAT panels', async () => {
let element;
await browser.get(`${url}?prejoin=false`);
element = await browser.wait(until.elementLocated(By.id('layout')), TIMEOUT);
expect(await element.isDisplayed()).to.be.true;
// Open chat panel
const chatButton = await browser.findElement(By.id('chat-panel-btn'));
expect(await chatButton.isDisplayed()).to.be.true;
await chatButton.click();
element = await browser.wait(until.elementLocated(By.className('sidenav-menu')), TIMEOUT);
element = await browser.findElements(By.className('input-container'));
expect(element.length).equals(1);
element = await browser.findElement(By.className('messages-container'));
expect(await element.isDisplayed()).to.be.true;
// Open participants panel
const participantBtn = await browser.findElement(By.id('participants-panel-btn'));
expect(await participantBtn.isDisplayed()).to.be.true;
await participantBtn.click();
element = await browser.wait(until.elementLocated(By.className('sidenav-menu')), TIMEOUT);
element = await browser.findElements(By.className('local-participant-container'));
expect(element.length).equals(1);
element = await browser.findElement(By.css('ov-participant-panel-item'));
expect(await element.isDisplayed()).to.be.true;
// Switch to chat panel
await chatButton.click();
element = await browser.wait(until.elementLocated(By.className('sidenav-menu')), TIMEOUT);
element = await browser.findElements(By.className('input-container'));
expect(element.length).equals(1);
element = await browser.findElement(By.className('messages-container'));
expect(await element.isDisplayed()).to.be.true;
element = await browser.findElements(By.className('local-participant-container'));
expect(element.length).equals(0);
element = await browser.findElements(By.css('ov-participant-panel-item'));
expect(element.length).equals(0);
// Close chat panel
await chatButton.click();
element = await browser.findElements(By.className('input-container'));
expect(element.length).equals(0);
element = await browser.findElements(By.css('messages-container'));
expect(element.length).equals(0);
});
});