Skip to content

Commit

Permalink
openvidu-components: Updated captions e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Nov 16, 2022
1 parent 41e9cc9 commit 6ab6c22
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 87 deletions.
2 changes: 1 addition & 1 deletion openvidu-components-angular/e2e/selenium.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions openvidu-components-angular/e2e/webcomponent-app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
});
});
Expand Down
217 changes: 133 additions & 84 deletions openvidu-components-angular/e2e/webcomponent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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');
Expand All @@ -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', () => {
Expand Down

0 comments on commit 6ab6c22

Please sign in to comment.