From 7105fe448d96ada7c5a8ff89104bf20885f887c2 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Thu, 24 Nov 2022 11:57:21 +0100 Subject: [PATCH] openvidu-components: Added PRO feature e2e tests --- .../e2e/utils.po.test.ts | 5 + .../e2e/webcomponent.test.ts | 277 +++++++++++------- 2 files changed, 173 insertions(+), 109 deletions(-) diff --git a/openvidu-components-angular/e2e/utils.po.test.ts b/openvidu-components-angular/e2e/utils.po.test.ts index 7a8e55e6..7139abe1 100644 --- a/openvidu-components-angular/e2e/utils.po.test.ts +++ b/openvidu-components-angular/e2e/utils.po.test.ts @@ -58,6 +58,11 @@ export class OpenViduComponentsPO { expect(await this.isPresent('#media-buttons-container')).to.be.true; } + async chceckProFeatureAlertIsPresent(): Promise { + await this.waitForElement('ov-pro-feature-template'); + expect(await this.isPresent('ov-pro-feature-template')).to.be.true; + } + async clickOn(selector: string): Promise { const element = await this.waitForElement(selector); await element.click(); diff --git a/openvidu-components-angular/e2e/webcomponent.test.ts b/openvidu-components-angular/e2e/webcomponent.test.ts index a628ae77..24042cd7 100644 --- a/openvidu-components-angular/e2e/webcomponent.test.ts +++ b/openvidu-components-angular/e2e/webcomponent.test.ts @@ -120,14 +120,16 @@ describe('Testing API Directives', () => { // Checking if video is displayed await utils.checkVideoElementIsPresent(); + // Checking if virtual background button is disabled + const button = await utils.waitForElement('#background-effects-btn'); + expect(button.isEnabled()).to.be.false; + // Checking if video track is disabled/muted idVideoEnabled = await browser.executeScript(script); expect(idVideoEnabled).to.be.false; await utils.waitForElement('#videocam_off'); - - const joinButton = await utils.waitForElement('#join-button'); - await joinButton.click(); + await utils.clickOn('#join-button'); // Checking if video is muted after join the room await utils.checkSessionIsPresent(); @@ -1325,8 +1327,7 @@ describe('Testing CHAT features', () => { }); }); - -describe('Testing captions features', () => { +describe('Testing PRO features with OpenVidu CE', () => { let browser: WebDriver; let utils: OpenViduComponentsPO; async function createChromeBrowser(): Promise { @@ -1347,6 +1348,41 @@ describe('Testing captions features', () => { await browser.quit(); }); + it('should SHOW the VIRTUAL BACKGROUND PRO feature dialog', async () => { + await browser.get(`${url}?prejoin=true`); + + await utils.checkPrejoinIsPresent(); + + await utils.waitForElement('#background-effects-btn'); + await utils.clickOn('#background-effects-btn'); + + await utils.chceckProFeatureAlertIsPresent(); + + // Join to room + await utils.clickOn('#join-button'); + + 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; + + await utils.waitForElement('#virtual-bg-btn'); + await utils.clickOn('#virtual-bg-btn'); + + // Expect it shows the pro feature alert + await utils.chceckProFeatureAlertIsPresent(); + + }); + it('should SHOW the CAPTIONS PRO feature dialog', async () => { await browser.get(`${url}?prejoin=false`); @@ -1390,163 +1426,186 @@ describe('Testing captions features', () => { await utils.waitForElement('ov-pro-feature-template'); expect(await utils.isPresent('.captions-container')).to.be.false; }); +}); + /** - * - * The following E2E TESTS only work with OpenVidu PRO + * TODO: + * The following E2E TESTS only work with OpenVidu PRO. + * It should run with OpenVidu PRO */ +// describe('Testing captions features', () => { +// let browser: WebDriver; +// let utils: OpenViduComponentsPO; +// async function createChromeBrowser(): Promise { +// return await new Builder() +// .forBrowser(WebComponentConfig.browserName) +// .withCapabilities(WebComponentConfig.browserCapabilities) +// .setChromeOptions(WebComponentConfig.browserOptions) +// .usingServer(WebComponentConfig.seleniumAddress) +// .build(); +// } - // it('should OPEN the CAPTIONS container', async () => { - // await browser.get(`${url}?prejoin=false`); +// beforeEach(async () => { +// browser = await createChromeBrowser(); +// utils = new OpenViduComponentsPO(browser); +// }); - // await utils.checkSessionIsPresent(); +// afterEach(async () => { +// await browser.quit(); +// }); - // // Checking if toolbar is present - // await utils.checkToolbarIsPresent(); +// it('should OPEN the CAPTIONS container', 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'); +// }); - // // Checking if toolbar is present - // await utils.checkToolbarIsPresent(); +// it('should OPEN the SETTINGS panel from captions button', 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'); - // await utils.waitForElement('#caption-settings-btn'); - // await utils.clickOn('#caption-settings-btn'); +// // Checking if button panel is present +// await utils.waitForElement('.mat-menu-content'); +// expect(await utils.isPresent('.mat-menu-content')).to.be.true; - // await browser.sleep(500); +// // 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('.settings-container'); - // expect(await utils.isPresent('.settings-container')).to.be.true; +// await utils.waitForElement('.captions-container'); +// await utils.waitForElement('#caption-settings-btn'); +// await utils.clickOn('#caption-settings-btn'); - // await utils.waitForElement('ov-captions-settings'); +// await browser.sleep(500); - // // Expect caption button is not present - // expect(await utils.isPresent('#caption-settings-btn')).to.be.false; - // }); +// await utils.waitForElement('.settings-container'); +// expect(await utils.isPresent('.settings-container')).to.be.true; - // it('should TOGGLE the CAPTIONS container from settings panel', 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'); - // await utils.waitForElement('#caption-settings-btn'); - // await utils.clickOn('#caption-settings-btn'); +// // Checking if button panel is present +// await utils.waitForElement('.mat-menu-content'); +// expect(await utils.isPresent('.mat-menu-content')).to.be.true; - // await browser.sleep(500); +// // 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('.settings-container'); - // expect(await utils.isPresent('.settings-container')).to.be.true; +// await utils.waitForElement('.captions-container'); +// await utils.waitForElement('#caption-settings-btn'); +// await utils.clickOn('#caption-settings-btn'); - // await utils.waitForElement('ov-captions-settings'); +// await browser.sleep(500); - // 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 utils.waitForElement('.settings-container'); +// expect(await utils.isPresent('.settings-container')).to.be.true; - // await browser.sleep(200); +// await utils.waitForElement('ov-captions-settings'); - // await utils.clickOn('#captions-toggle-slide'); - // expect(await utils.isPresent('.captions-container')).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; - // it('should change the CAPTIONS language', async () => { - // await browser.get(`${url}?prejoin=false`); +// await browser.sleep(200); - // await utils.checkSessionIsPresent(); +// await utils.clickOn('#captions-toggle-slide'); +// expect(await utils.isPresent('.captions-container')).to.be.true; +// }); - // // Checking if toolbar is present - // await utils.checkToolbarIsPresent(); +// it('should change the CAPTIONS language', 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'); - // await utils.waitForElement('#caption-settings-btn'); - // await utils.clickOn('#caption-settings-btn'); +// // Checking if button panel is present +// await utils.waitForElement('.mat-menu-content'); +// expect(await utils.isPresent('.mat-menu-content')).to.be.true; - // await browser.sleep(500); +// // 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('.settings-container'); - // expect(await utils.isPresent('.settings-container')).to.be.true; +// await utils.waitForElement('.captions-container'); +// await utils.waitForElement('#caption-settings-btn'); +// await utils.clickOn('#caption-settings-btn'); - // await utils.waitForElement('ov-captions-settings'); +// await browser.sleep(500); - // expect(await utils.isPresent('.captions-container')).to.be.true; +// await utils.waitForElement('.settings-container'); +// expect(await utils.isPresent('.settings-container')).to.be.true; - // await utils.clickOn('.lang-button'); - // await browser.sleep(500); +// await utils.waitForElement('ov-captions-settings'); - // await utils.clickOn('#es-ES'); - // await utils.clickOn('.panel-close-button'); +// expect(await utils.isPresent('.captions-container')).to.be.true; - // const button = await utils.waitForElement('#caption-settings-btn'); - // expect(await button.getText()).equals('settingsEspañol'); +// 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', () => { let browser: WebDriver;