From 6ab6c22158a8efb608b0bd68c666ae22a10ce3f4 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Wed, 16 Nov 2022 11:35:07 +0100 Subject: [PATCH] openvidu-components: Updated captions e2e test --- .../e2e/selenium.conf.ts | 2 +- .../e2e/webcomponent-app/app.js | 5 +- .../e2e/webcomponent.test.ts | 217 +++++++++++------- 3 files changed, 137 insertions(+), 87 deletions(-) diff --git a/openvidu-components-angular/e2e/selenium.conf.ts b/openvidu-components-angular/e2e/selenium.conf.ts index 88f9d3cda6..d1a5feda36 100644 --- a/openvidu-components-angular/e2e/selenium.conf.ts +++ b/openvidu-components-angular/e2e/selenium.conf.ts @@ -45,7 +45,7 @@ export const WebComponentConfig: BrowserConfig = { seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:3000/webdriver' : '', browserName: 'chrome', browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true), - browserOptions: new chrome.Options().excludeSwitches().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments)) + browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments)) }; export const AngularConfig: BrowserConfig = { diff --git a/openvidu-components-angular/e2e/webcomponent-app/app.js b/openvidu-components-angular/e2e/webcomponent-app/app.js index 7b82a3963b..fb138b47f8 100644 --- a/openvidu-components-angular/e2e/webcomponent-app/app.js +++ b/openvidu-components-angular/e2e/webcomponent-app/app.js @@ -33,7 +33,6 @@ $(document).ready(() => { SINGLE_TOKEN = url.searchParams.get("singleToken") === null ? false : url.searchParams.get("singleToken") === 'true'; - // Directives MINIMAL = url.searchParams.get("minimal") === null ? false : url.searchParams.get("minimal") === 'true'; PARTICIPANT_NAME = url.searchParams.get("participantName") || 'TEST_USER'; @@ -247,7 +246,9 @@ function createToken(sessionId) { Authorization: 'Basic ' + btoa('OPENVIDUAPP:' + OPENVIDU_SERVER_SECRET), 'Content-Type': 'application/json', }, - success: (response) => resolve(response.token), + success: (response) => { + resolve(response.token); + }, error: (error) => reject(error), }); }); diff --git a/openvidu-components-angular/e2e/webcomponent.test.ts b/openvidu-components-angular/e2e/webcomponent.test.ts index bfd890c087..a628ae77e8 100644 --- a/openvidu-components-angular/e2e/webcomponent.test.ts +++ b/openvidu-components-angular/e2e/webcomponent.test.ts @@ -1347,7 +1347,7 @@ describe('Testing captions features', () => { await browser.quit(); }); - it('should OPEN the CAPTIONS container', async () => { + it('should SHOW the CAPTIONS PRO feature dialog', async () => { await browser.get(`${url}?prejoin=false`); await utils.checkSessionIsPresent(); @@ -1364,21 +1364,14 @@ describe('Testing captions features', () => { await utils.waitForElement('.mat-menu-content'); expect(await utils.isPresent('.mat-menu-content')).to.be.true; - // Checking if captions button is present - await utils.waitForElement('#captions-btn'); - expect(await utils.isPresent('#captions-btn')).to.be.true; - await utils.clickOn('#captions-btn'); - - await utils.waitForElement('.captions-container'); - }); - - it('should OPEN the SETTINGS panel from captions button', async () => { - await browser.get(`${url}?prejoin=false`); - - await utils.checkSessionIsPresent(); + await utils.waitForElement('#toolbar-settings-btn'); + expect(await utils.isPresent('#toolbar-settings-btn')).to.be.true; + await utils.clickOn('#toolbar-settings-btn'); - // Checking if toolbar is present - await utils.checkToolbarIsPresent(); + // Expect captions panel shows the pro feature content + await utils.waitForElement('#settings-container'); + await utils.clickOn('#captions-opt'); + await utils.waitForElement('.pro-feature'); // Open more options menu await utils.clickOn('#more-options-btn'); @@ -1394,109 +1387,165 @@ describe('Testing captions features', () => { expect(await utils.isPresent('#captions-btn')).to.be.true; await utils.clickOn('#captions-btn'); - await utils.waitForElement('.captions-container'); - await utils.waitForElement('#caption-settings-btn'); - await utils.clickOn('#caption-settings-btn'); + await utils.waitForElement('ov-pro-feature-template'); + expect(await utils.isPresent('.captions-container')).to.be.false; + }); - await browser.sleep(500); +/** + * + * The following E2E TESTS only work with OpenVidu PRO + */ - await utils.waitForElement('.settings-container'); - expect(await utils.isPresent('.settings-container')).to.be.true; + // it('should OPEN the CAPTIONS container', async () => { + // await browser.get(`${url}?prejoin=false`); - await utils.waitForElement('ov-captions-settings'); + // await utils.checkSessionIsPresent(); - // Expect caption button is not present - expect(await utils.isPresent('#caption-settings-btn')).to.be.false; - }); + // // Checking if toolbar is present + // await utils.checkToolbarIsPresent(); - it('should TOGGLE the CAPTIONS container from settings panel', async () => { - await browser.get(`${url}?prejoin=false`); + // // Open more options menu + // await utils.clickOn('#more-options-btn'); - await utils.checkSessionIsPresent(); + // await browser.sleep(500); - // Checking if toolbar is present - await utils.checkToolbarIsPresent(); + // // Checking if button panel is present + // await utils.waitForElement('.mat-menu-content'); + // expect(await utils.isPresent('.mat-menu-content')).to.be.true; - // Open more options menu - await utils.clickOn('#more-options-btn'); + // // Checking if captions button is present + // await utils.waitForElement('#captions-btn'); + // expect(await utils.isPresent('#captions-btn')).to.be.true; + // await utils.clickOn('#captions-btn'); - await browser.sleep(500); + // await utils.waitForElement('.captions-container'); + // }); - // Checking if button panel is present - await utils.waitForElement('.mat-menu-content'); - expect(await utils.isPresent('.mat-menu-content')).to.be.true; + // it('should OPEN the SETTINGS panel from captions button', async () => { + // await browser.get(`${url}?prejoin=false`); - // Checking if captions button is present - await utils.waitForElement('#captions-btn'); - expect(await utils.isPresent('#captions-btn')).to.be.true; - await utils.clickOn('#captions-btn'); + // await utils.checkSessionIsPresent(); - await utils.waitForElement('.captions-container'); - await utils.waitForElement('#caption-settings-btn'); - await utils.clickOn('#caption-settings-btn'); + // // Checking if toolbar is present + // await utils.checkToolbarIsPresent(); - await browser.sleep(500); + // // Open more options menu + // await utils.clickOn('#more-options-btn'); - await utils.waitForElement('.settings-container'); - expect(await utils.isPresent('.settings-container')).to.be.true; + // await browser.sleep(500); - await utils.waitForElement('ov-captions-settings'); + // // Checking if button panel is present + // await utils.waitForElement('.mat-menu-content'); + // expect(await utils.isPresent('.mat-menu-content')).to.be.true; - expect(await utils.isPresent('.captions-container')).to.be.true; - await utils.clickOn('#captions-toggle-slide'); - expect(await utils.isPresent('.captions-container')).to.be.false; + // // Checking if captions button is present + // await utils.waitForElement('#captions-btn'); + // expect(await utils.isPresent('#captions-btn')).to.be.true; + // await utils.clickOn('#captions-btn'); - await browser.sleep(200); + // await utils.waitForElement('.captions-container'); + // await utils.waitForElement('#caption-settings-btn'); + // await utils.clickOn('#caption-settings-btn'); - await utils.clickOn('#captions-toggle-slide'); - expect(await utils.isPresent('.captions-container')).to.be.true; - }); + // await browser.sleep(500); - it('should change the CAPTIONS language', async () => { - await browser.get(`${url}?prejoin=false`); + // await utils.waitForElement('.settings-container'); + // expect(await utils.isPresent('.settings-container')).to.be.true; - await utils.checkSessionIsPresent(); + // await utils.waitForElement('ov-captions-settings'); - // Checking if toolbar is present - await utils.checkToolbarIsPresent(); + // // Expect caption button is not present + // expect(await utils.isPresent('#caption-settings-btn')).to.be.false; + // }); - // Open more options menu - await utils.clickOn('#more-options-btn'); + // it('should TOGGLE the CAPTIONS container from settings panel', async () => { + // await browser.get(`${url}?prejoin=false`); - await browser.sleep(500); + // await utils.checkSessionIsPresent(); - // Checking if button panel is present - await utils.waitForElement('.mat-menu-content'); - expect(await utils.isPresent('.mat-menu-content')).to.be.true; + // // Checking if toolbar is present + // await utils.checkToolbarIsPresent(); - // Checking if captions button is present - await utils.waitForElement('#captions-btn'); - expect(await utils.isPresent('#captions-btn')).to.be.true; - await utils.clickOn('#captions-btn'); + // // Open more options menu + // await utils.clickOn('#more-options-btn'); - await utils.waitForElement('.captions-container'); - await utils.waitForElement('#caption-settings-btn'); - await utils.clickOn('#caption-settings-btn'); + // await browser.sleep(500); - await browser.sleep(500); + // // Checking if button panel is present + // await utils.waitForElement('.mat-menu-content'); + // expect(await utils.isPresent('.mat-menu-content')).to.be.true; - await utils.waitForElement('.settings-container'); - expect(await utils.isPresent('.settings-container')).to.be.true; + // // Checking if captions button is present + // await utils.waitForElement('#captions-btn'); + // expect(await utils.isPresent('#captions-btn')).to.be.true; + // await utils.clickOn('#captions-btn'); - await utils.waitForElement('ov-captions-settings'); + // await utils.waitForElement('.captions-container'); + // await utils.waitForElement('#caption-settings-btn'); + // await utils.clickOn('#caption-settings-btn'); - expect(await utils.isPresent('.captions-container')).to.be.true; + // await browser.sleep(500); - await utils.clickOn('.lang-button'); - await browser.sleep(500); + // await utils.waitForElement('.settings-container'); + // expect(await utils.isPresent('.settings-container')).to.be.true; - await utils.clickOn('#es-ES'); - await utils.clickOn('.panel-close-button'); + // await utils.waitForElement('ov-captions-settings'); - const button = await utils.waitForElement('#caption-settings-btn'); - expect(await button.getText()).equals('settingsEspañol'); + // expect(await utils.isPresent('.captions-container')).to.be.true; + // await utils.clickOn('#captions-toggle-slide'); + // expect(await utils.isPresent('.captions-container')).to.be.false; - }); + // await browser.sleep(200); + + // await utils.clickOn('#captions-toggle-slide'); + // expect(await utils.isPresent('.captions-container')).to.be.true; + // }); + + // it('should change the CAPTIONS language', async () => { + // await browser.get(`${url}?prejoin=false`); + + // await utils.checkSessionIsPresent(); + + // // Checking if toolbar is present + // await utils.checkToolbarIsPresent(); + + // // Open more options menu + // await utils.clickOn('#more-options-btn'); + + // await browser.sleep(500); + + // // Checking if button panel is present + // await utils.waitForElement('.mat-menu-content'); + // expect(await utils.isPresent('.mat-menu-content')).to.be.true; + + // // Checking if captions button is present + // await utils.waitForElement('#captions-btn'); + // expect(await utils.isPresent('#captions-btn')).to.be.true; + // await utils.clickOn('#captions-btn'); + + // await utils.waitForElement('.captions-container'); + // await utils.waitForElement('#caption-settings-btn'); + // await utils.clickOn('#caption-settings-btn'); + + // await browser.sleep(500); + + // await utils.waitForElement('.settings-container'); + // expect(await utils.isPresent('.settings-container')).to.be.true; + + // await utils.waitForElement('ov-captions-settings'); + + // expect(await utils.isPresent('.captions-container')).to.be.true; + + // await utils.clickOn('.lang-button'); + // await browser.sleep(500); + + // await utils.clickOn('#es-ES'); + // await utils.clickOn('.panel-close-button'); + + // const button = await utils.waitForElement('#caption-settings-btn'); + // expect(await button.getText()).equals('settingsEspañol'); + + // }); }); describe('Testing WITHOUT MEDIA DEVICES permissions', () => {