Skip to content

Commit 2149673

Browse files
committed
ov-components: add camera and microphone button visibility controls in the E2E tests
1 parent 2bf212c commit 2149673

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

openvidu-components-angular/e2e/webcomponent-app/app.js

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ var PREJOIN;
99
var VIDEO_ENABLED;
1010
var AUDIO_ENABLED;
1111

12+
var CAMERA_BUTTON;
13+
var MICROPHONE_BUTTON;
1214
var SCREENSHARE_BUTTON;
1315
var FULLSCREEN_BUTTON;
1416
var ACTIVITIES_PANEL_BUTTON;
@@ -58,6 +60,8 @@ document.addEventListener('DOMContentLoaded', () => {
5860
PREJOIN = url.searchParams.get('prejoin') === null ? true : url.searchParams.get('prejoin') === 'true';
5961
VIDEO_ENABLED = url.searchParams.get('videoEnabled') === null ? true : url.searchParams.get('videoEnabled') === 'true';
6062
AUDIO_ENABLED = url.searchParams.get('audioEnabled') === null ? true : url.searchParams.get('audioEnabled') === 'true';
63+
CAMERA_BUTTON = url.searchParams.get('cameraBtn') === null ? true : url.searchParams.get('cameraBtn') === 'true';
64+
MICROPHONE_BUTTON = url.searchParams.get('microphoneBtn') === null ? true : url.searchParams.get('microphoneBtn') === 'true';
6165
SCREENSHARE_BUTTON = url.searchParams.get('screenshareBtn') === null ? true : url.searchParams.get('screenshareBtn') === 'true';
6266
RECORDING_BUTTON =
6367
url.searchParams.get('toolbarRecordingButton') === null ? true : url.searchParams.get('toolbarRecordingButton') === 'true';

openvidu-components-angular/e2e/webcomponent-e2e/api-directives.test.ts

+25
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,31 @@ describe('Testing API Directives', () => {
292292
expect(await utils.isPresent('#mic_off')).toBeTrue();
293293
});
294294

295+
it('should run the app without camera button' , async () => {
296+
await browser.get(`${url}&prejoin=false&cameraBtn=false`);
297+
298+
await utils.checkSessionIsPresent();
299+
300+
// Checking if toolbar is present
301+
await utils.checkToolbarIsPresent();
302+
303+
// Checking if camera button is not present
304+
expect(await utils.isPresent('#camera-btn')).toBeFalse();
305+
});
306+
307+
it('should run the app without microphone button' , async () => {
308+
await browser.get(`${url}&prejoin=false&microphoneBtn=false`);
309+
310+
await utils.checkSessionIsPresent();
311+
312+
// Checking if toolbar is present
313+
await utils.checkToolbarIsPresent();
314+
315+
// Checking if microphone button is not present
316+
expect(await utils.isPresent('#microphone-btn')).toBeFalse();
317+
});
318+
319+
295320
it('should HIDE the SCREENSHARE button', async () => {
296321
await browser.get(`${url}&prejoin=false&screenshareBtn=false`);
297322

openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.html

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
[prejoin]="_prejoin"
1010
[videoEnabled]="_videoEnabled"
1111
[audioEnabled]="_audioEnabled"
12+
[toolbarCameraButton]="_toolbarCameraButton"
13+
[toolbarMicrophoneButton]="_toolbarMicrophoneButton"
1214
[toolbarScreenshareButton]="_toolbarScreenshareButton"
1315
[toolbarRecordingButton]="_toolbarRecordingButton"
1416
[toolbarBroadcastingButton]="_toolbarBroadcastingButton"

openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts

+34
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ export class OpenviduWebComponentComponent {
8484
* @internal
8585
*/
8686
_audioEnabled: boolean = true;
87+
88+
/**
89+
* @internal
90+
*/
91+
_toolbarCameraButton: boolean = true;
92+
/**
93+
* @internal
94+
*/
95+
_toolbarMicrophoneButton: boolean = true;
8796
/**
8897
* @internal
8998
*/
@@ -309,6 +318,31 @@ export class OpenviduWebComponentComponent {
309318
this._audioEnabled = this.castToBoolean(value);
310319
}
311320

321+
/**
322+
* The **toolbarCameraButton** attribute allows show/hide the camera toolbar button.
323+
*
324+
* Default: `true`
325+
*
326+
* @example
327+
* <openvidu-webcomponent toolbar-camera-button="false"></openvidu-webcomponent>
328+
*/
329+
@Input() set toolbarCameraButton(value: string | boolean) {
330+
this._toolbarCameraButton = this.castToBoolean(value);
331+
}
332+
333+
/**
334+
* The **toolbarMicrophoneButton** attribute allows show/hide the microphone toolbar button.
335+
*
336+
* Default: `true`
337+
*
338+
* @example
339+
* <openvidu-webcomponent toolbar-microphone-button="false"></openvidu-webcomponent>
340+
*/
341+
342+
@Input() set toolbarMicrophoneButton(value: string | boolean) {
343+
this._toolbarMicrophoneButton = this.castToBoolean(value);
344+
}
345+
312346
/**
313347
* The **toolbarScreenshareButton** attribute allows show/hide the screenshare toolbar button.
314348
*

0 commit comments

Comments
 (0)