ov-components: Fixed webcomponent directives e2e tests

pull/839/head
Carlos Santos 2024-07-30 15:48:13 +02:00
parent 5072804e67
commit 9fd1c5b746
4 changed files with 18 additions and 116 deletions

View File

@ -1,3 +1,3 @@
export const LAUNCH_MODE = process.env.LAUNCH_MODE || 'DEV'; export const LAUNCH_MODE = process.env.LAUNCH_MODE || 'DEV';
export const OPENVIDU_CALL_SERVER = process.env.OPENVIDU_CALL_SERVER || 'http://localhost:5000'; export const OPENVIDU_CALL_SERVER = process.env.OPENVIDU_CALL_SERVER || 'http://localhost:6080';

View File

@ -48,7 +48,7 @@ const chromeArgumentsWithoutMediaDevicesCI = [
export const WebComponentConfig: BrowserConfig = { export const WebComponentConfig: BrowserConfig = {
appUrl: 'http://localhost:8080/', appUrl: 'http://localhost:8080/',
seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:3000/webdriver' : '', seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:4444/wd/hub' : '',
browserName: 'chrome', browserName: 'chrome',
browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true), browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true),
browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments)) browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments))

View File

@ -25,8 +25,6 @@ var PARTICIPANT_MUTE_BUTTON;
var PARTICIPANTS_PANEL_BUTTON; var PARTICIPANTS_PANEL_BUTTON;
var ACTIVITIES_RECORDING_ACTIVITY; var ACTIVITIES_RECORDING_ACTIVITY;
var ACTIVITIES_BROADCASTING_ACTIVITY; var ACTIVITIES_BROADCASTING_ACTIVITY;
var RECORDING_ERROR;
var BROADCASTING_ERROR;
var TOOLBAR_SETTINGS_BUTTON; var TOOLBAR_SETTINGS_BUTTON;
var CAPTIONS_BUTTON; var CAPTIONS_BUTTON;
@ -37,13 +35,11 @@ var FAKE_RECORDINGS;
var PARTICIPANT_NAME; var PARTICIPANT_NAME;
var OPENVIDU_CALL_SERVER_URL; var OPENVIDU_CALL_SERVER_URL;
// var OPENVIDU_SECRET;
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
var url = new URL(window.location.href); var url = new URL(window.location.href);
OPENVIDU_CALL_SERVER_URL = url.searchParams.get('OV_URL'); OPENVIDU_CALL_SERVER_URL = url.searchParams.get('OPENVIDU_CALL_SERVER_URL') || 'http://localhost:6080';
// OPENVIDU_SECRET = url.searchParams.get('OV_SECRET');
FAKE_DEVICES = url.searchParams.get('fakeDevices') === null ? false : url.searchParams.get('fakeDevices') === 'true'; FAKE_DEVICES = url.searchParams.get('fakeDevices') === null ? false : url.searchParams.get('fakeDevices') === 'true';
@ -69,10 +65,6 @@ document.addEventListener('DOMContentLoaded', () => {
BROADCASTING_BUTTON = BROADCASTING_BUTTON =
url.searchParams.get('toolbarBroadcastingButton') === null ? true : url.searchParams.get('toolbarBroadcastingButton') === 'true'; url.searchParams.get('toolbarBroadcastingButton') === null ? true : url.searchParams.get('toolbarBroadcastingButton') === 'true';
if (url.searchParams.get('broadcastingError') !== null) {
BROADCASTING_ERROR = url.searchParams.get('broadcastingError');
}
TOOLBAR_SETTINGS_BUTTON = TOOLBAR_SETTINGS_BUTTON =
url.searchParams.get('toolbarSettingsBtn') === null ? true : url.searchParams.get('toolbarSettingsBtn') === 'true'; url.searchParams.get('toolbarSettingsBtn') === null ? true : url.searchParams.get('toolbarSettingsBtn') === 'true';
CAPTIONS_BUTTON = url.searchParams.get('toolbarCaptionsBtn') === null ? true : url.searchParams.get('toolbarCaptionsBtn') === 'true'; CAPTIONS_BUTTON = url.searchParams.get('toolbarCaptionsBtn') === null ? true : url.searchParams.get('toolbarCaptionsBtn') === 'true';
@ -91,9 +83,6 @@ document.addEventListener('DOMContentLoaded', () => {
url.searchParams.get('activitiesPanelRecordingActivity') === null url.searchParams.get('activitiesPanelRecordingActivity') === null
? true ? true
: url.searchParams.get('activitiesPanelRecordingActivity') === 'true'; : url.searchParams.get('activitiesPanelRecordingActivity') === 'true';
if (url.searchParams.get('recordingError') !== null) {
RECORDING_ERROR = url.searchParams.get('recordingError');
}
DISPLAY_LOGO = url.searchParams.get('displayLogo') === null ? true : url.searchParams.get('displayLogo') === 'true'; DISPLAY_LOGO = url.searchParams.get('displayLogo') === null ? true : url.searchParams.get('displayLogo') === 'true';
DISPLAY_ROOM_NAME = url.searchParams.get('displayRoomName') === null ? true : url.searchParams.get('displayRoomName') === 'true'; DISPLAY_ROOM_NAME = url.searchParams.get('displayRoomName') === null ? true : url.searchParams.get('displayRoomName') === 'true';
@ -217,9 +206,6 @@ function setWebcomponentAttributes() {
webComponent.recordingActivityRecordingsList = [{ status: 'ready', filename: 'fakeRecording' }]; webComponent.recordingActivityRecordingsList = [{ status: 'ready', filename: 'fakeRecording' }];
} }
if (BROADCASTING_ERROR) {
webComponent.broadcastingActivityBroadcastingError = { message: BROADCASTING_ERROR, broadcastAvailable: true };
}
webComponent.prejoin = PREJOIN; webComponent.prejoin = PREJOIN;
webComponent.videoEnabled = VIDEO_ENABLED; webComponent.videoEnabled = VIDEO_ENABLED;
webComponent.audioEnabled = AUDIO_ENABLED; webComponent.audioEnabled = AUDIO_ENABLED;
@ -243,7 +229,6 @@ function setWebcomponentAttributes() {
webComponent.activitiesPanelRecordingActivity = ACTIVITIES_RECORDING_ACTIVITY; webComponent.activitiesPanelRecordingActivity = ACTIVITIES_RECORDING_ACTIVITY;
webComponent.activitiesPanelBroadcastingActivity = ACTIVITIES_BROADCASTING_ACTIVITY; webComponent.activitiesPanelBroadcastingActivity = ACTIVITIES_BROADCASTING_ACTIVITY;
webComponent.recordingActivityRecordingError = RECORDING_ERROR;
} }
function appendElement(id) { function appendElement(id) {

View File

@ -224,18 +224,17 @@ describe('Testing API Directives', () => {
await utils.checkPrejoinIsPresent(); await utils.checkPrejoinIsPresent();
// Checking if video is displayed // Checking if video is displayed
expect(await utils.getNumberOfElements('video')).equals(1); await utils.waitForElement('#video-poster');
expect(await utils.getNumberOfElements('video')).equals(0);
// Checking if virtual background button is disabled
// const button = await utils.waitForElement('#background-effects-btn');
// expect(await button.isEnabled()).to.be.false;
await utils.waitForElement('#videocam_off'); await utils.waitForElement('#videocam_off');
await utils.clickOn('#join-button'); await utils.clickOn('#join-button');
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
expect(await utils.getNumberOfElements('video')).equals(1); await utils.waitForElement('#video-poster');
expect(await utils.getNumberOfElements('video')).equals(0);
await utils.waitForElement('#videocam_off'); await utils.waitForElement('#videocam_off');
expect(await utils.isPresent('#videocam_off')).to.be.true; expect(await utils.isPresent('#videocam_off')).to.be.true;
@ -249,7 +248,8 @@ describe('Testing API Directives', () => {
await utils.checkLayoutPresent(); await utils.checkLayoutPresent();
// Checking if video is displayed // Checking if video is displayed
expect(await utils.getNumberOfElements('video')).equals(1); await utils.waitForElement('#video-poster');
expect(await utils.getNumberOfElements('video')).equals(0);
expect(await utils.getNumberOfElements('#video-poster')).equals(1); expect(await utils.getNumberOfElements('#video-poster')).equals(1);
await utils.waitForElement('#videocam_off'); await utils.waitForElement('#videocam_off');
@ -257,48 +257,38 @@ describe('Testing API Directives', () => {
}); });
it('should run the app with AUDIO DISABLED in prejoin page', async () => { it('should run the app with AUDIO DISABLED in prejoin page', async () => {
// let isAudioEnabled;
// const script = 'return document.getElementsByTagName("video")[0].srcObject.getAudioTracks()[0].enabled;';
await browser.get(`${url}&audioEnabled=false`); await browser.get(`${url}&audioEnabled=false`);
await utils.checkPrejoinIsPresent(); await utils.checkPrejoinIsPresent();
// Checking if video is displayed // Checking if video is displayed
await utils.checkVideoElementIsPresent(); await utils.checkVideoElementIsPresent();
expect(await utils.getNumberOfElements('video')).equals(1);
// Checking if audio track is disabled/muted expect(await utils.getNumberOfElements('audio')).equals(0);
// isAudioEnabled = await browser.executeScript(script);
// expect(isAudioEnabled).to.be.false;
await utils.waitForElement('#mic_off'); await utils.waitForElement('#mic_off');
expect(await utils.isPresent('#mic_off')).to.be.true; expect(await utils.isPresent('#mic_off')).to.be.true;
await utils.clickOn('#join-button'); await utils.clickOn('#join-button');
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
// isAudioEnabled = await browser.executeScript(script);
// expect(isAudioEnabled).to.be.false;
expect(await utils.getNumberOfElements('video')).equals(1);
expect(await utils.getNumberOfElements('audio')).equals(0);
await utils.waitForElement('#mic_off'); await utils.waitForElement('#mic_off');
expect(await utils.isPresent('#mic_off')).to.be.true; expect(await utils.isPresent('#mic_off')).to.be.true;
}); });
it('should run the app with AUDIO DISABLED and WITHOUT PREJOIN page', async () => { it('should run the app with AUDIO DISABLED and WITHOUT PREJOIN page', async () => {
// let isAudioEnabled;
// const audioEnableScript = 'return document.getElementsByTagName("video")[0].srcObject.getAudioTracks()[0].enabled;';
await browser.get(`${url}&prejoin=false&audioEnabled=false`); await browser.get(`${url}&prejoin=false&audioEnabled=false`);
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
// Checking if video is displayed // Checking if video is displayed
await utils.checkVideoElementIsPresent(); await utils.checkVideoElementIsPresent();
expect(await utils.getNumberOfElements('video')).equals(1);
// Checking if audio track is disabled/muted expect(await utils.getNumberOfElements('audio')).equals(0);
// isAudioEnabled = await browser.executeScript(audioEnableScript);
// expect(isAudioEnabled).to.be.false;
await utils.waitForElement('#mic_off'); await utils.waitForElement('#mic_off');
expect(await utils.isPresent('#mic_off')).to.be.true; expect(await utils.isPresent('#mic_off')).to.be.true;
}); });
@ -327,7 +317,7 @@ describe('Testing API Directives', () => {
expect(await utils.getNumberOfElements('#fullscreen-btn')).equals(0); expect(await utils.getNumberOfElements('#fullscreen-btn')).equals(0);
}); });
it('should HIDE the CAPTIONS button', async () => { it.skip('should HIDE the CAPTIONS button', async () => {
await browser.get(`${url}&prejoin=false&toolbarCaptionsBtn=false`); await browser.get(`${url}&prejoin=false&toolbarCaptionsBtn=false`);
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
@ -456,7 +446,7 @@ describe('Testing API Directives', () => {
expect(await utils.isPresent('#branding-logo')).to.be.false; expect(await utils.isPresent('#branding-logo')).to.be.false;
}); });
it('should HIDE the SESSION NAME', async () => { it('should HIDE the ROOM NAME', async () => {
await browser.get(`${url}&prejoin=false&displayRoomName=false`); await browser.get(`${url}&prejoin=false&displayRoomName=false`);
await utils.checkSessionIsPresent(); await utils.checkSessionIsPresent();
@ -576,79 +566,6 @@ describe('Testing API Directives', () => {
expect(await utils.isPresent('ov-recording-activity')).to.be.false; expect(await utils.isPresent('ov-recording-activity')).to.be.false;
}); });
it('should SHOW a RECORDING ERROR in activities panel', async () => {
let element;
const fixedUrl = `${url}&prejoin=false&recordingError=TEST_ERROR`;
await browser.get(fixedUrl);
await utils.checkSessionIsPresent();
// Checking if toolbar is present
await utils.checkToolbarIsPresent();
element = await utils.waitForElement('#activities-panel-btn');
await element.click();
// Checking if participatns panel is displayed
await utils.waitForElement('#default-activities-panel');
expect(await utils.isPresent('#default-activities-panel')).to.be.true;
// Checking if recording activity exists
await utils.waitForElement('#activities-container');
await utils.waitForElement('.activities-body-container');
await utils.waitForElement('ov-recording-activity');
expect(await utils.isPresent('ov-recording-activity')).to.be.true;
await utils.waitForElement('.failed');
expect(await utils.isPresent('.failed')).to.be.true;
// Open recording
await browser.sleep(500);
await utils.waitForElement('ov-recording-activity');
await utils.clickOn('ov-recording-activity');
await browser.sleep(500);
element = await utils.waitForElement('.recording-error');
expect(await element.getAttribute('innerText')).equal('"TEST_ERROR"');
expect(await utils.isPresent('.recording-error')).to.be.true;
});
it('should SHOW a BROADCASTING ERROR in activities panel', async () => {
let element;
const fixedUrl = `${url}&prejoin=false&broadcastingError=TEST_ERROR`;
await browser.get(fixedUrl);
await utils.checkSessionIsPresent();
// Checking if toolbar is present
await utils.checkToolbarIsPresent();
element = await utils.waitForElement('#activities-panel-btn');
await element.click();
// Checking if participatns panel is displayed
await utils.waitForElement('#default-activities-panel');
expect(await utils.isPresent('#default-activities-panel')).to.be.true;
// Checking if broadcasting activity exists
await utils.waitForElement('#activities-container');
await utils.waitForElement('.activities-body-container');
await utils.waitForElement('ov-broadcasting-activity');
expect(await utils.isPresent('ov-broadcasting-activity')).to.be.true;
const status = await utils.waitForElement('#broadcasting-status');
expect(await status.getAttribute('innerText')).equals('FAILED');
// Open broadcasting
await browser.sleep(500);
await utils.clickOn('ov-broadcasting-activity');
await browser.sleep(500);
element = await utils.waitForElement('#broadcasting-error');
expect(await element.getAttribute('innerText')).equal('TEST_ERROR');
});
it('should HIDE the BROADCASTING ACTIVITY in activities panel', async () => { it('should HIDE the BROADCASTING ACTIVITY in activities panel', async () => {
await browser.get(`${url}&prejoin=false&activitiesPanelBroadcastingActivity=false`); await browser.get(`${url}&prejoin=false&activitiesPanelBroadcastingActivity=false`);