@webex/plugin-meetings 2.14.1 → 2.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,6 +42,7 @@ import {
42
42
  } from '@webex/plugin-meetings/src/constants';
43
43
  import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
44
44
 
45
+ import locus from '../fixture/locus';
45
46
  import {
46
47
  UserNotJoinedError,
47
48
  MeetingNotActiveError,
@@ -724,16 +725,12 @@ describe('plugin-meetings', () => {
724
725
  });
725
726
  describe('#isTranscriptionSupported', () => {
726
727
  it('should return false if the feature is not supported for the meeting', () => {
727
- meeting.policy = {
728
- WEBEX_ASSISTANT_STATUS_INACTIVE: true
729
- };
728
+ meeting.locusInfo.controls = {transcribe: {transcribing: false}};
730
729
 
731
730
  assert.equal(meeting.isTranscriptionSupported(), false);
732
731
  });
733
732
  it('should return true if webex assitant is enabled', () => {
734
- meeting.policy = {
735
- WEBEX_ASSISTANT_STATUS_ACTIVE: true
736
- };
733
+ meeting.locusInfo.controls = {transcribe: {transcribing: true}};
737
734
 
738
735
  assert.equal(meeting.isTranscriptionSupported(), true);
739
736
  });
@@ -789,6 +786,7 @@ describe('plugin-meetings', () => {
789
786
  beforeEach(() => {
790
787
  meeting.setCorrelationId = sinon.stub().returns(true);
791
788
  meeting.setLocus = sinon.stub().returns(true);
789
+ webex.meetings.registered = true;
792
790
  });
793
791
  describe('successful', () => {
794
792
  beforeEach(() => {
@@ -857,6 +855,14 @@ describe('plugin-meetings', () => {
857
855
  assert.calledWith(MeetingUtil.joinMeeting, meeting, {moderator: false, pin: '1234'});
858
856
  });
859
857
  });
858
+
859
+ it('should throw error if device is not registered', async () => {
860
+ webex.meetings.registered = false;
861
+ await meeting.join().catch((error) => {
862
+ assert.equal(error.message, 'Meeting:index#join --> Device not registered');
863
+ });
864
+ });
865
+
860
866
  it('should post error event if failed', async () => {
861
867
  await meeting.join().catch(() => {
862
868
  assert.calledWithMatch(Metrics.postEvent, {event: eventType.LOCUS_JOIN_RESPONSE});
@@ -2565,6 +2571,7 @@ describe('plugin-meetings', () => {
2565
2571
  assert.equal(result.failureReason, MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA);
2566
2572
  });
2567
2573
  });
2574
+
2568
2575
  describe('#mediaNegotiatedEvent', () => {
2569
2576
  it('should have #mediaNegotiatedEvent', () => {
2570
2577
  assert.exists(meeting.mediaNegotiatedEvent);
@@ -2642,6 +2649,222 @@ describe('plugin-meetings', () => {
2642
2649
  assert.calledOnce(meeting?.roap?.stop);
2643
2650
  });
2644
2651
  });
2652
+
2653
+ describe('#moveTo', () => {
2654
+ let sandbox;
2655
+
2656
+ beforeEach(() => {
2657
+ sandbox = sinon.createSandbox();
2658
+ sandbox.stub(meeting, 'closeLocalStream');
2659
+ sandbox.stub(meeting, 'closeLocalShare');
2660
+
2661
+ sandbox.stub(meeting.mediaProperties, 'setMediaDirection');
2662
+ sandbox.stub(meeting.mediaProperties, 'unsetMediaTracks');
2663
+
2664
+ sandbox.stub(meeting.reconnectionManager, 'reconnectMedia').returns(Promise.resolve());
2665
+ sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(MeetingUtil.parseLocusJoin({body: {locus, mediaConnections: []}})));
2666
+ });
2667
+
2668
+ afterEach(() => {
2669
+ sandbox.restore();
2670
+ sandbox = null;
2671
+ });
2672
+
2673
+ it('should throw an error if resourceId not passed', async () => {
2674
+ try {
2675
+ await meeting.moveTo();
2676
+ }
2677
+ catch (err) {
2678
+ assert.instanceOf(err, ParameterError);
2679
+ assert.equal(err.sdkMessage, 'Cannot move call without a resourceId.');
2680
+ }
2681
+ });
2682
+
2683
+ it('should postEvent on moveTo ', async () => {
2684
+ await meeting.moveTo('resourceId');
2685
+ assert.calledWithMatch(Metrics.postEvent, {
2686
+ event: eventType.MEDIA_CAPABILITIES,
2687
+ data: {
2688
+ mediaCapabilities: {
2689
+ rx: {
2690
+ audio: false,
2691
+ share: true,
2692
+ share_audio: false,
2693
+ video: false,
2694
+ whiteboard: false
2695
+ },
2696
+ tx: {
2697
+ audio: false,
2698
+ share: false,
2699
+ share_audio: false,
2700
+ video: false,
2701
+ whiteboard: false
2702
+ }
2703
+ }
2704
+ }
2705
+ });
2706
+ assert.calledWithMatch(Metrics.postEvent, {event: eventType.MOVE_MEDIA});
2707
+ });
2708
+
2709
+ it('should call `MeetingUtil.joinMeetingOptions` with resourceId', async () => {
2710
+ sinon.spy(MeetingUtil, 'joinMeetingOptions');
2711
+ await meeting.moveTo('resourceId');
2712
+
2713
+ assert.calledWith(MeetingUtil.joinMeetingOptions, meeting, {resourceId: 'resourceId', moveToResource: true});
2714
+ });
2715
+
2716
+ it('should reconnectMedia after DX joins after moveTo', async () => {
2717
+ await meeting.moveTo('resourceId');
2718
+
2719
+
2720
+ await meeting.locusInfo.emitScoped(
2721
+ {
2722
+ file: 'locus-info',
2723
+ function: 'updateSelf'
2724
+ },
2725
+ 'SELF_OBSERVING'
2726
+ );
2727
+
2728
+ // beacuse we are calling callback so we need to wait
2729
+
2730
+ assert.called(meeting.closeLocalStream);
2731
+ assert.called(meeting.closeLocalShare);
2732
+
2733
+ // give queued Promise callbacks a chance to run
2734
+ await Promise.resolve();
2735
+
2736
+ assert.called(meeting.mediaProperties.setMediaDirection);
2737
+ assert.called(meeting.mediaProperties.unsetMediaTracks);
2738
+
2739
+ assert.calledWith(meeting.reconnectionManager.reconnectMedia,
2740
+ {
2741
+ mediaDirection: {
2742
+ sendVideo: false,
2743
+ receiveVideo: false,
2744
+ sendAudio: false,
2745
+ receiveAudio: false,
2746
+ sendShare: false,
2747
+ receiveShare: true
2748
+ }
2749
+ });
2750
+ });
2751
+
2752
+ it('should throw an error if moveTo call fails', async () => {
2753
+ MeetingUtil.joinMeeting = sinon.stub().returns(Promise.reject());
2754
+ try {
2755
+ await meeting.moveTo('resourceId');
2756
+ }
2757
+ catch {
2758
+ assert.calledOnce(Metrics.sendBehavioralMetric);
2759
+ assert.calledWith(
2760
+ Metrics.sendBehavioralMetric,
2761
+ BEHAVIORAL_METRICS.MOVE_TO_FAILURE,
2762
+ {
2763
+ correlation_id: meeting.correlationId,
2764
+ locus_id: meeting.locusUrl.split('/').pop(),
2765
+ reason: sinon.match.any,
2766
+ stack: sinon.match.any
2767
+ }
2768
+ );
2769
+ }
2770
+ Metrics.sendBehavioralMetric.reset();
2771
+ meeting.reconnectionManager.reconnectMedia = sinon.stub().returns(Promise.reject());
2772
+ try {
2773
+ await meeting.moveTo('resourceId');
2774
+
2775
+ await meeting.locusInfo.emitScoped(
2776
+ {
2777
+ file: 'locus-info',
2778
+ function: 'updateSelf'
2779
+ },
2780
+ 'SELF_OBSERVING'
2781
+ );
2782
+ }
2783
+ catch {
2784
+ assert.calledOnce(Metrics.sendBehavioralMetric);
2785
+ assert.calledWith(
2786
+ Metrics.sendBehavioralMetric,
2787
+ BEHAVIORAL_METRICS.MOVE_TO_FAILURE,
2788
+ {
2789
+ correlation_id: meeting.correlationId,
2790
+ locus_id: meeting.locusUrl.split('/').pop(),
2791
+ reason: sinon.match.any,
2792
+ stack: sinon.match.any
2793
+ }
2794
+ );
2795
+ }
2796
+ });
2797
+ });
2798
+
2799
+ describe('#moveFrom', () => {
2800
+ let sandbox;
2801
+
2802
+ beforeEach(() => {
2803
+ sandbox = sinon.createSandbox();
2804
+ sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(MeetingUtil.parseLocusJoin({body: {locus, mediaConnections: []}})));
2805
+ sandbox.stub(MeetingUtil, 'leaveMeeting').returns(Promise.resolve());
2806
+ });
2807
+
2808
+ afterEach(() => {
2809
+ sandbox.restore();
2810
+ sandbox = null;
2811
+ });
2812
+
2813
+ it('should throw an error if resourceId not passed', async () => {
2814
+ try {
2815
+ await meeting.moveFrom();
2816
+ }
2817
+ catch (err) {
2818
+ assert.instanceOf(err, ParameterError);
2819
+
2820
+ assert.equal(err.sdkMessage, 'Cannot move call without a resourceId.');
2821
+ }
2822
+ });
2823
+
2824
+ it('should postEvent on moveFrom ', async () => {
2825
+ await meeting.moveFrom('resourceId');
2826
+
2827
+ assert.calledWithMatch(Metrics.postEvent, {event: eventType.MOVE_MEDIA});
2828
+ });
2829
+
2830
+ it('should call `MeetingUtil.joinMeetingOptions` with resourceId', async () => {
2831
+ sinon.spy(MeetingUtil, 'joinMeetingOptions');
2832
+ await meeting.moveFrom('resourceId');
2833
+
2834
+ assert.calledWith(MeetingUtil.joinMeetingOptions, meeting);
2835
+ assert.calledWith(MeetingUtil.leaveMeeting, meeting, {
2836
+ resourceId: 'resourceId',
2837
+ correlationId: meeting.correlationId,
2838
+ moveMeeting: true
2839
+ });
2840
+
2841
+ assert.calledOnce(Metrics.sendBehavioralMetric);
2842
+ assert.calledWith(
2843
+ Metrics.sendBehavioralMetric,
2844
+ BEHAVIORAL_METRICS.MOVE_FROM_SUCCESS,
2845
+ );
2846
+ });
2847
+
2848
+ it('should throw an error if moveFrom call fails', async () => {
2849
+ MeetingUtil.joinMeeting = sinon.stub().returns(Promise.reject());
2850
+ try {
2851
+ await meeting.moveFrom('resourceId');
2852
+ }
2853
+ catch {
2854
+ assert.calledOnce(Metrics.sendBehavioralMetric);
2855
+ assert.calledWith(
2856
+ Metrics.sendBehavioralMetric,
2857
+ BEHAVIORAL_METRICS.MOVE_FROM_FAILURE,
2858
+ {
2859
+ correlation_id: meeting.correlationId,
2860
+ locus_id: meeting.locusUrl.split('/').pop(),
2861
+ reason: sinon.match.any,
2862
+ stack: sinon.match.any
2863
+ }
2864
+ );
2865
+ }
2866
+ });
2867
+ });
2645
2868
  });
2646
2869
 
2647
2870
  describe('Public Event Triggers', () => {