@webex/plugin-meetings 1.156.3 → 1.157.1

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.
@@ -1,6 +1,7 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
+ import 'jsdom-global/register';
4
5
  import {cloneDeep, isEqual} from 'lodash';
5
6
  import sinon from 'sinon';
6
7
  import StateMachine from 'javascript-state-machine';
@@ -27,6 +28,7 @@ import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
27
28
  import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
28
29
  import BrowserDetection from '@webex/plugin-meetings/src/common/browser-detection';
29
30
  import Metrics from '@webex/plugin-meetings/src/metrics';
31
+ import {eventType} from '@webex/plugin-meetings/src/metrics/config';
30
32
  import {
31
33
  FLOOR_ACTION,
32
34
  SHARE_STATUS,
@@ -36,7 +38,7 @@ import {
36
38
  EVENT_TRIGGERS,
37
39
  _SIP_URI_
38
40
  } from '@webex/plugin-meetings/src/constants';
39
- import {BEHAVIORAL_METRICS} from '@webex/plugin-meetings/src/metrics/constants';
41
+ import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
40
42
 
41
43
  import {
42
44
  UserNotJoinedError,
@@ -71,6 +73,23 @@ describe('plugin-meetings', () => {
71
73
  };
72
74
 
73
75
  before(() => {
76
+ const MediaStream = {
77
+ getVideoTracks: () => [{
78
+ applyConstraints: () => { }
79
+ }]
80
+ };
81
+
82
+ Object.defineProperty(global.window.navigator, 'mediaDevices', {
83
+ writable: true,
84
+ value: {
85
+ getDisplayMedia: sinon.stub().returns(Promise.resolve(MediaStream))
86
+ }
87
+ });
88
+
89
+ Object.defineProperty(global.window, 'MediaStream', {
90
+ writable: true,
91
+ value: MediaStream
92
+ });
74
93
  LoggerConfig.set({verboseEvents: true, enable: false});
75
94
  LoggerProxy.set(logger);
76
95
  });
@@ -107,6 +126,9 @@ describe('plugin-meetings', () => {
107
126
  metrics: {},
108
127
  stats: {},
109
128
  experimental: {enableUnifiedMeetings: true}
129
+ },
130
+ metrics: {
131
+ type: ['behavioral']
110
132
  }
111
133
  }
112
134
  });
@@ -695,6 +717,11 @@ describe('plugin-meetings', () => {
695
717
  assert.calledWith(MeetingUtil.joinMeeting, meeting, {moderator: false, pin: '1234'});
696
718
  });
697
719
  });
720
+ it('should post error event if failed', async () => {
721
+ await meeting.join().catch(() => {
722
+ assert.calledWithMatch(Metrics.postEvent, {event: eventType.LOCUS_JOIN_RESPONSE});
723
+ });
724
+ });
698
725
  it('should fail if password is required', async () => {
699
726
  meeting.passwordStatus = PASSWORD_STATUS.REQUIRED;
700
727
  await assert.isRejected(meeting.join(), PasswordError);
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
-
4
+ import 'jsdom-global/register';
5
5
  import {assert} from '@webex/test-helper-chai';
6
6
  import sinon from 'sinon';
7
7
  import MockWebex from '@webex/test-helper-mock-webex';
@@ -448,6 +448,13 @@ skipInBrowser(describe)('plugin-meetings', () => {
448
448
  assert.calledOnce(initialSetup);
449
449
  assert.calledWith(initialSetup, {id: uuid1, replaces: [{locusUrl: 'http:locusUrl'}], self: {callBackInfo: {callbackAddress: uri1}}});
450
450
  });
451
+ it('should setup the meeting by difference event without replaces', async () => {
452
+ await webex.meetings.handleLocusEvent({locus: {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}}, eventType: 'locus.difference', locusUrl: url1});
453
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
454
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
455
+ assert.calledOnce(initialSetup);
456
+ assert.calledWith(initialSetup, {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}});
457
+ });
451
458
  it('should setup the meeting by a not difference event', async () => {
452
459
  await webex.meetings.handleLocusEvent({locus: {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}}, eventType: test1, locusUrl: url1});
453
460
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
 
5
+ import 'jsdom-global/register';
5
6
  import sinon from 'sinon';
6
7
  import uuid from 'uuid';
7
8
  import chai from 'chai';
@@ -1,21 +1,15 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
- /* globals window */
4
+ import 'jsdom-global/register';
5
5
  import sinon from 'sinon';
6
6
  import Metrics from '@webex/internal-plugin-metrics';
7
- import metrics from '@webex/plugin-meetings/src/metrics';
8
- import BrowserDetection from '@webex/plugin-meetings/src/common/browser-detection';
9
7
  import MockWebex from '@webex/test-helper-mock-webex';
10
8
  import {browserOnly} from '@webex/test-helper-mocha';
11
9
  import {assert} from '@webex/test-helper-chai';
12
10
 
13
- const {
14
- getBrowserName,
15
- getBrowserVersion,
16
- getOSName,
17
- getOSVersion
18
- } = BrowserDetection();
11
+ import metrics from '@webex/plugin-meetings/src/metrics';
12
+
19
13
 
20
14
  /**
21
15
  * Meeting can only run in a browser, so we can only send metrics for
@@ -48,6 +42,7 @@ browserOnly(describe)('Meeting metrics', () => {
48
42
  clientId: 'mock-client-id'
49
43
  }
50
44
  };
45
+ webex.config.metrics.type = ['behavioral'];
51
46
  webex.internal.metrics.submitClientMetrics = mockSubmitMetric;
52
47
  metrics.initialSetup({}, webex);
53
48
  });
@@ -98,10 +93,10 @@ browserOnly(describe)('Meeting metrics', () => {
98
93
  });
99
94
 
100
95
  it('adds environment information to metric', () => {
101
- const data = {value: 567};
102
- const metadata = {test: true};
96
+ const fields = {value: 567};
97
+ const metricTags = {test: true};
103
98
 
104
- metrics.sendBehavioralMetric('myMetric', data, metadata);
99
+ metrics.sendBehavioralMetric('myMetric', fields, metricTags);
105
100
 
106
101
  assert.calledWithMatch(
107
102
  mockSubmitMetric,
@@ -109,27 +104,13 @@ browserOnly(describe)('Meeting metrics', () => {
109
104
  {
110
105
  type: ['behavioral'],
111
106
  fields: {
112
- browser_version: getBrowserVersion(),
113
- os_version: getOSVersion(),
114
- sdk_version: '1.2.3',
115
107
  value: 567
116
108
  },
117
109
  tags: {
118
- org_id: '7890',
119
- os: getOSName(),
120
- browser: getBrowserName(),
121
- domain: window.location.hostname,
122
110
  test: true
123
111
  }
124
112
  }
125
113
  );
126
114
  });
127
-
128
- it('throws error if no metric name is given', () => {
129
- assert.throws(
130
- () => metrics.sendBehavioralMetric(),
131
- 'Missing behavioral metric name. Please provide one'
132
- );
133
- });
134
115
  });
135
116
  });
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import chai from 'chai';
2
3
  import chaiAsPromised from 'chai-as-promised';
3
4
  import sinon from 'sinon';
@@ -1,4 +1,4 @@
1
-
1
+ import 'jsdom-global/register';
2
2
  import {assert} from '@webex/test-helper-chai';
3
3
  import sinon from 'sinon';
4
4
  import PeerConnectionManager from '@webex/plugin-meetings/src/peer-connection-manager/index';
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
 
5
+ import 'jsdom-global/register';
5
6
  import {assert} from '@webex/test-helper-chai';
6
7
  import sinon from 'sinon';
7
8
  import {
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import chai from 'chai';
2
3
  import chaiAsPromised from 'chai-as-promised';
3
4
  import sinon from 'sinon';
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import {assert} from '@webex/test-helper-chai';
2
3
  import RoapUtil from '@webex/plugin-meetings/src/roap/util';
3
4
  import PeerConnectionManager from '@webex/plugin-meetings/src/peer-connection-manager/index.js';
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import chai from 'chai';
2
3
  import chaiAsPromised from 'chai-as-promised';
3
4
  import sinon from 'sinon';
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import {assert} from '@webex/test-helper-chai';
2
3
  import sinon from 'sinon';
3
4
  import Transcription from '@webex/plugin-meetings/src/transcription';