@webex/internal-plugin-metrics 3.8.0 → 3.8.1-next.2
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.
- package/dist/call-diagnostic/call-diagnostic-metrics.js +102 -37
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/config.js +29 -2
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +15 -4
- package/dist/new-metrics.js.map +1 -1
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +22 -22
- package/dist/types/call-diagnostic/config.d.ts +12 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/metrics.types.d.ts +11 -1
- package/dist/types/new-metrics.d.ts +10 -3
- package/package.json +12 -12
- package/src/call-diagnostic/call-diagnostic-metrics.ts +89 -42
- package/src/call-diagnostic/config.ts +28 -0
- package/src/index.ts +2 -0
- package/src/metrics.types.ts +14 -1
- package/src/new-metrics.ts +21 -4
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +783 -97
- package/test/unit/spec/new-metrics.ts +27 -3
- package/dist/call-diagnostic-events-batcher.js +0 -59
- package/dist/call-diagnostic-events-batcher.js.map +0 -1
|
@@ -13,8 +13,12 @@ import {
|
|
|
13
13
|
} from '@webex/internal-plugin-metrics';
|
|
14
14
|
import uuid from 'uuid';
|
|
15
15
|
import {omit} from 'lodash';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import {glob} from 'glob';
|
|
17
|
+
import {expect} from 'chai';
|
|
18
|
+
import {
|
|
19
|
+
ClientEmailInput,
|
|
20
|
+
ClientUserNameInput,
|
|
21
|
+
} from '@webex/internal-plugin-metrics/src/metrics.types';
|
|
18
22
|
|
|
19
23
|
//@ts-ignore
|
|
20
24
|
global.window = {location: {hostname: 'whatever'}};
|
|
@@ -60,10 +64,26 @@ describe('internal-plugin-metrics', () => {
|
|
|
60
64
|
sessionCorrelationId: 'sessionCorrelationId3',
|
|
61
65
|
};
|
|
62
66
|
|
|
67
|
+
const fakeMeeting4 = {
|
|
68
|
+
...fakeMeeting,
|
|
69
|
+
id: '4',
|
|
70
|
+
isoLocalClientMeetingJoinTime: 'testTimeString',
|
|
71
|
+
};
|
|
72
|
+
const fakeMeeting5 = {
|
|
73
|
+
...fakeMeeting,
|
|
74
|
+
id: '5',
|
|
75
|
+
correlationId: 'correlationId5',
|
|
76
|
+
sessionCorrelationId: 'sessionCorrelationId5',
|
|
77
|
+
userNameInput: 'test',
|
|
78
|
+
emailInput: 'test@test.com',
|
|
79
|
+
};
|
|
80
|
+
|
|
63
81
|
const fakeMeetings = {
|
|
64
82
|
1: fakeMeeting,
|
|
65
83
|
2: fakeMeeting2,
|
|
66
84
|
3: fakeMeeting3,
|
|
85
|
+
4: fakeMeeting4,
|
|
86
|
+
5: fakeMeeting5,
|
|
67
87
|
};
|
|
68
88
|
|
|
69
89
|
let webex;
|
|
@@ -763,50 +783,470 @@ describe('internal-plugin-metrics', () => {
|
|
|
763
783
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
764
784
|
globalMeetingId: 'globalMeetingId1',
|
|
765
785
|
},
|
|
766
|
-
name: 'client.alert.displayed',
|
|
767
|
-
},
|
|
768
|
-
options
|
|
769
|
-
);
|
|
786
|
+
name: 'client.alert.displayed',
|
|
787
|
+
},
|
|
788
|
+
options
|
|
789
|
+
);
|
|
790
|
+
|
|
791
|
+
assert.calledWith(getOriginStub, options, options.meetingId);
|
|
792
|
+
assert.calledOnce(clearEmptyKeysRecursivelyStub);
|
|
793
|
+
assert.deepEqual(res, {
|
|
794
|
+
event: {
|
|
795
|
+
canProceed: false,
|
|
796
|
+
identifiers: {
|
|
797
|
+
correlationId: 'id',
|
|
798
|
+
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
799
|
+
globalMeetingId: 'globalMeetingId1',
|
|
800
|
+
},
|
|
801
|
+
name: 'client.alert.displayed',
|
|
802
|
+
},
|
|
803
|
+
eventId: 'my-fake-id',
|
|
804
|
+
origin: {
|
|
805
|
+
origin: 'fake-origin',
|
|
806
|
+
},
|
|
807
|
+
originTime: {
|
|
808
|
+
sent: 'not_defined_yet',
|
|
809
|
+
triggered: 'fake-triggered-time',
|
|
810
|
+
},
|
|
811
|
+
senderCountryCode: 'UK',
|
|
812
|
+
version: 1,
|
|
813
|
+
});
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
describe('#submitClientEvent', () => {
|
|
817
|
+
it('should submit client event successfully with meetingId', () => {
|
|
818
|
+
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
819
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
820
|
+
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
821
|
+
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
822
|
+
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
823
|
+
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
824
|
+
const validatorSpy = sinon.spy(cd, 'validator');
|
|
825
|
+
const options = {
|
|
826
|
+
meetingId: fakeMeeting.id,
|
|
827
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
828
|
+
};
|
|
829
|
+
cd.setMercuryConnectedStatus(true);
|
|
830
|
+
|
|
831
|
+
cd.submitClientEvent({
|
|
832
|
+
name: 'client.alert.displayed',
|
|
833
|
+
options,
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
assert.called(getIdentifiersSpy);
|
|
837
|
+
assert.calledWith(getIdentifiersSpy, {
|
|
838
|
+
meeting: fakeMeeting,
|
|
839
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
840
|
+
webexConferenceIdStr: undefined,
|
|
841
|
+
sessionCorrelationId: undefined,
|
|
842
|
+
globalMeetingId: undefined,
|
|
843
|
+
});
|
|
844
|
+
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
845
|
+
assert.calledWith(
|
|
846
|
+
prepareDiagnosticEventSpy,
|
|
847
|
+
{
|
|
848
|
+
canProceed: true,
|
|
849
|
+
eventData: {
|
|
850
|
+
webClientDomain: 'whatever',
|
|
851
|
+
isMercuryConnected: true,
|
|
852
|
+
},
|
|
853
|
+
identifiers: {
|
|
854
|
+
correlationId: 'correlationId',
|
|
855
|
+
deviceId: 'deviceUrl',
|
|
856
|
+
locusId: 'url',
|
|
857
|
+
locusStartTime: 'lastActive',
|
|
858
|
+
locusUrl: 'locus/url',
|
|
859
|
+
mediaAgentAlias: 'alias',
|
|
860
|
+
mediaAgentGroupId: '1',
|
|
861
|
+
orgId: 'orgId',
|
|
862
|
+
userId: 'userId',
|
|
863
|
+
},
|
|
864
|
+
loginType: 'login-ci',
|
|
865
|
+
name: 'client.alert.displayed',
|
|
866
|
+
userType: 'host',
|
|
867
|
+
isConvergedArchitectureEnabled: undefined,
|
|
868
|
+
webexSubServiceType: undefined,
|
|
869
|
+
webClientPreload: undefined,
|
|
870
|
+
},
|
|
871
|
+
options
|
|
872
|
+
);
|
|
873
|
+
assert.calledWith(submitToCallDiagnosticsSpy, {
|
|
874
|
+
event: {
|
|
875
|
+
canProceed: true,
|
|
876
|
+
eventData: {
|
|
877
|
+
webClientDomain: 'whatever',
|
|
878
|
+
isMercuryConnected: true,
|
|
879
|
+
},
|
|
880
|
+
identifiers: {
|
|
881
|
+
correlationId: 'correlationId',
|
|
882
|
+
deviceId: 'deviceUrl',
|
|
883
|
+
locusId: 'url',
|
|
884
|
+
locusStartTime: 'lastActive',
|
|
885
|
+
locusUrl: 'locus/url',
|
|
886
|
+
mediaAgentAlias: 'alias',
|
|
887
|
+
mediaAgentGroupId: '1',
|
|
888
|
+
orgId: 'orgId',
|
|
889
|
+
userId: 'userId',
|
|
890
|
+
},
|
|
891
|
+
loginType: 'login-ci',
|
|
892
|
+
name: 'client.alert.displayed',
|
|
893
|
+
userType: 'host',
|
|
894
|
+
isConvergedArchitectureEnabled: undefined,
|
|
895
|
+
webexSubServiceType: undefined,
|
|
896
|
+
webClientPreload: undefined,
|
|
897
|
+
},
|
|
898
|
+
eventId: 'my-fake-id',
|
|
899
|
+
origin: {
|
|
900
|
+
origin: 'fake-origin',
|
|
901
|
+
},
|
|
902
|
+
originTime: {
|
|
903
|
+
sent: 'not_defined_yet',
|
|
904
|
+
triggered: now.toISOString(),
|
|
905
|
+
},
|
|
906
|
+
senderCountryCode: 'UK',
|
|
907
|
+
version: 1,
|
|
908
|
+
});
|
|
909
|
+
assert.calledWith(validatorSpy, {
|
|
910
|
+
type: 'ce',
|
|
911
|
+
event: {
|
|
912
|
+
event: {
|
|
913
|
+
canProceed: true,
|
|
914
|
+
eventData: {
|
|
915
|
+
webClientDomain: 'whatever',
|
|
916
|
+
isMercuryConnected: true,
|
|
917
|
+
},
|
|
918
|
+
identifiers: {
|
|
919
|
+
correlationId: 'correlationId',
|
|
920
|
+
deviceId: 'deviceUrl',
|
|
921
|
+
locusId: 'url',
|
|
922
|
+
locusStartTime: 'lastActive',
|
|
923
|
+
locusUrl: 'locus/url',
|
|
924
|
+
mediaAgentAlias: 'alias',
|
|
925
|
+
mediaAgentGroupId: '1',
|
|
926
|
+
orgId: 'orgId',
|
|
927
|
+
userId: 'userId',
|
|
928
|
+
},
|
|
929
|
+
loginType: 'login-ci',
|
|
930
|
+
name: 'client.alert.displayed',
|
|
931
|
+
userType: 'host',
|
|
932
|
+
isConvergedArchitectureEnabled: undefined,
|
|
933
|
+
webexSubServiceType: undefined,
|
|
934
|
+
webClientPreload: undefined,
|
|
935
|
+
},
|
|
936
|
+
eventId: 'my-fake-id',
|
|
937
|
+
origin: {
|
|
938
|
+
origin: 'fake-origin',
|
|
939
|
+
},
|
|
940
|
+
originTime: {
|
|
941
|
+
sent: 'not_defined_yet',
|
|
942
|
+
triggered: now.toISOString(),
|
|
943
|
+
},
|
|
944
|
+
senderCountryCode: 'UK',
|
|
945
|
+
version: 1,
|
|
946
|
+
},
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
950
|
+
assert.deepEqual(webexLoggerLogCalls[1].args, [
|
|
951
|
+
'call-diagnostic-events -> ',
|
|
952
|
+
'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
|
|
953
|
+
`name: client.alert.displayed`,
|
|
954
|
+
]);
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
it('should submit client event correctly when mercury is not connected', () => {
|
|
958
|
+
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
959
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
960
|
+
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
961
|
+
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
962
|
+
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
963
|
+
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
964
|
+
const validatorSpy = sinon.spy(cd, 'validator');
|
|
965
|
+
const options = {
|
|
966
|
+
meetingId: fakeMeeting.id,
|
|
967
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
968
|
+
};
|
|
969
|
+
cd.setMercuryConnectedStatus(false);
|
|
970
|
+
cd.submitClientEvent({
|
|
971
|
+
name: 'client.alert.displayed',
|
|
972
|
+
options,
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
assert.called(getIdentifiersSpy);
|
|
976
|
+
assert.calledWith(getIdentifiersSpy, {
|
|
977
|
+
meeting: fakeMeeting,
|
|
978
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
979
|
+
webexConferenceIdStr: undefined,
|
|
980
|
+
sessionCorrelationId: undefined,
|
|
981
|
+
globalMeetingId: undefined,
|
|
982
|
+
});
|
|
983
|
+
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
984
|
+
assert.calledWith(
|
|
985
|
+
prepareDiagnosticEventSpy,
|
|
986
|
+
{
|
|
987
|
+
canProceed: true,
|
|
988
|
+
eventData: {
|
|
989
|
+
webClientDomain: 'whatever',
|
|
990
|
+
isMercuryConnected: false,
|
|
991
|
+
},
|
|
992
|
+
identifiers: {
|
|
993
|
+
correlationId: 'correlationId',
|
|
994
|
+
deviceId: 'deviceUrl',
|
|
995
|
+
locusId: 'url',
|
|
996
|
+
locusStartTime: 'lastActive',
|
|
997
|
+
locusUrl: 'locus/url',
|
|
998
|
+
mediaAgentAlias: 'alias',
|
|
999
|
+
mediaAgentGroupId: '1',
|
|
1000
|
+
orgId: 'orgId',
|
|
1001
|
+
userId: 'userId',
|
|
1002
|
+
},
|
|
1003
|
+
loginType: 'login-ci',
|
|
1004
|
+
name: 'client.alert.displayed',
|
|
1005
|
+
userType: 'host',
|
|
1006
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1007
|
+
webexSubServiceType: undefined,
|
|
1008
|
+
webClientPreload: undefined,
|
|
1009
|
+
},
|
|
1010
|
+
options
|
|
1011
|
+
);
|
|
1012
|
+
assert.calledWith(submitToCallDiagnosticsSpy, {
|
|
1013
|
+
event: {
|
|
1014
|
+
canProceed: true,
|
|
1015
|
+
eventData: {
|
|
1016
|
+
webClientDomain: 'whatever',
|
|
1017
|
+
isMercuryConnected: false,
|
|
1018
|
+
},
|
|
1019
|
+
identifiers: {
|
|
1020
|
+
correlationId: 'correlationId',
|
|
1021
|
+
deviceId: 'deviceUrl',
|
|
1022
|
+
locusId: 'url',
|
|
1023
|
+
locusStartTime: 'lastActive',
|
|
1024
|
+
locusUrl: 'locus/url',
|
|
1025
|
+
mediaAgentAlias: 'alias',
|
|
1026
|
+
mediaAgentGroupId: '1',
|
|
1027
|
+
orgId: 'orgId',
|
|
1028
|
+
userId: 'userId',
|
|
1029
|
+
},
|
|
1030
|
+
loginType: 'login-ci',
|
|
1031
|
+
name: 'client.alert.displayed',
|
|
1032
|
+
userType: 'host',
|
|
1033
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1034
|
+
webexSubServiceType: undefined,
|
|
1035
|
+
webClientPreload: undefined,
|
|
1036
|
+
},
|
|
1037
|
+
eventId: 'my-fake-id',
|
|
1038
|
+
origin: {
|
|
1039
|
+
origin: 'fake-origin',
|
|
1040
|
+
},
|
|
1041
|
+
originTime: {
|
|
1042
|
+
sent: 'not_defined_yet',
|
|
1043
|
+
triggered: now.toISOString(),
|
|
1044
|
+
},
|
|
1045
|
+
senderCountryCode: 'UK',
|
|
1046
|
+
version: 1,
|
|
1047
|
+
});
|
|
1048
|
+
assert.calledWith(validatorSpy, {
|
|
1049
|
+
type: 'ce',
|
|
1050
|
+
event: {
|
|
1051
|
+
event: {
|
|
1052
|
+
canProceed: true,
|
|
1053
|
+
eventData: {
|
|
1054
|
+
webClientDomain: 'whatever',
|
|
1055
|
+
isMercuryConnected: false,
|
|
1056
|
+
},
|
|
1057
|
+
identifiers: {
|
|
1058
|
+
correlationId: 'correlationId',
|
|
1059
|
+
deviceId: 'deviceUrl',
|
|
1060
|
+
locusId: 'url',
|
|
1061
|
+
locusStartTime: 'lastActive',
|
|
1062
|
+
locusUrl: 'locus/url',
|
|
1063
|
+
mediaAgentAlias: 'alias',
|
|
1064
|
+
mediaAgentGroupId: '1',
|
|
1065
|
+
orgId: 'orgId',
|
|
1066
|
+
userId: 'userId',
|
|
1067
|
+
},
|
|
1068
|
+
loginType: 'login-ci',
|
|
1069
|
+
name: 'client.alert.displayed',
|
|
1070
|
+
userType: 'host',
|
|
1071
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1072
|
+
webexSubServiceType: undefined,
|
|
1073
|
+
webClientPreload: undefined,
|
|
1074
|
+
},
|
|
1075
|
+
eventId: 'my-fake-id',
|
|
1076
|
+
origin: {
|
|
1077
|
+
origin: 'fake-origin',
|
|
1078
|
+
},
|
|
1079
|
+
originTime: {
|
|
1080
|
+
sent: 'not_defined_yet',
|
|
1081
|
+
triggered: now.toISOString(),
|
|
1082
|
+
},
|
|
1083
|
+
senderCountryCode: 'UK',
|
|
1084
|
+
version: 1,
|
|
1085
|
+
},
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
1089
|
+
assert.deepEqual(webexLoggerLogCalls[1].args, [
|
|
1090
|
+
'call-diagnostic-events -> ',
|
|
1091
|
+
'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
|
|
1092
|
+
`name: client.alert.displayed`,
|
|
1093
|
+
]);
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
|
|
1097
|
+
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
1098
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
1099
|
+
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
1100
|
+
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
1101
|
+
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
1102
|
+
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
1103
|
+
const validatorSpy = sinon.spy(cd, 'validator');
|
|
1104
|
+
const options = {
|
|
1105
|
+
meetingId: fakeMeeting3.id,
|
|
1106
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1107
|
+
};
|
|
1108
|
+
cd.setMercuryConnectedStatus(true);
|
|
1109
|
+
cd.submitClientEvent({
|
|
1110
|
+
name: 'client.alert.displayed',
|
|
1111
|
+
options,
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
assert.called(getIdentifiersSpy);
|
|
1115
|
+
assert.calledWith(getIdentifiersSpy, {
|
|
1116
|
+
meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
|
|
1117
|
+
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1118
|
+
webexConferenceIdStr: undefined,
|
|
1119
|
+
globalMeetingId: undefined,
|
|
1120
|
+
sessionCorrelationId: undefined,
|
|
1121
|
+
});
|
|
1122
|
+
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
1123
|
+
assert.calledWith(
|
|
1124
|
+
prepareDiagnosticEventSpy,
|
|
1125
|
+
{
|
|
1126
|
+
canProceed: true,
|
|
1127
|
+
eventData: {
|
|
1128
|
+
webClientDomain: 'whatever',
|
|
1129
|
+
isMercuryConnected: true,
|
|
1130
|
+
},
|
|
1131
|
+
identifiers: {
|
|
1132
|
+
correlationId: 'correlationId3',
|
|
1133
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1134
|
+
deviceId: 'deviceUrl',
|
|
1135
|
+
locusId: 'url',
|
|
1136
|
+
locusStartTime: 'lastActive',
|
|
1137
|
+
locusUrl: 'locus/url',
|
|
1138
|
+
mediaAgentAlias: 'alias',
|
|
1139
|
+
mediaAgentGroupId: '1',
|
|
1140
|
+
orgId: 'orgId',
|
|
1141
|
+
userId: 'userId',
|
|
1142
|
+
},
|
|
1143
|
+
loginType: 'login-ci',
|
|
1144
|
+
name: 'client.alert.displayed',
|
|
1145
|
+
userType: 'host',
|
|
1146
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1147
|
+
webexSubServiceType: undefined,
|
|
1148
|
+
webClientPreload: undefined,
|
|
1149
|
+
},
|
|
1150
|
+
options
|
|
1151
|
+
);
|
|
1152
|
+
assert.calledWith(submitToCallDiagnosticsSpy, {
|
|
1153
|
+
event: {
|
|
1154
|
+
canProceed: true,
|
|
1155
|
+
eventData: {
|
|
1156
|
+
webClientDomain: 'whatever',
|
|
1157
|
+
isMercuryConnected: true,
|
|
1158
|
+
},
|
|
1159
|
+
identifiers: {
|
|
1160
|
+
correlationId: 'correlationId3',
|
|
1161
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1162
|
+
deviceId: 'deviceUrl',
|
|
1163
|
+
locusId: 'url',
|
|
1164
|
+
locusStartTime: 'lastActive',
|
|
1165
|
+
locusUrl: 'locus/url',
|
|
1166
|
+
mediaAgentAlias: 'alias',
|
|
1167
|
+
mediaAgentGroupId: '1',
|
|
1168
|
+
orgId: 'orgId',
|
|
1169
|
+
userId: 'userId',
|
|
1170
|
+
},
|
|
1171
|
+
loginType: 'login-ci',
|
|
1172
|
+
name: 'client.alert.displayed',
|
|
1173
|
+
userType: 'host',
|
|
1174
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1175
|
+
webexSubServiceType: undefined,
|
|
1176
|
+
webClientPreload: undefined,
|
|
1177
|
+
},
|
|
1178
|
+
eventId: 'my-fake-id',
|
|
1179
|
+
origin: {
|
|
1180
|
+
origin: 'fake-origin',
|
|
1181
|
+
},
|
|
1182
|
+
originTime: {
|
|
1183
|
+
sent: 'not_defined_yet',
|
|
1184
|
+
triggered: now.toISOString(),
|
|
1185
|
+
},
|
|
1186
|
+
senderCountryCode: 'UK',
|
|
1187
|
+
version: 1,
|
|
1188
|
+
});
|
|
1189
|
+
assert.calledWith(validatorSpy, {
|
|
1190
|
+
type: 'ce',
|
|
1191
|
+
event: {
|
|
1192
|
+
event: {
|
|
1193
|
+
canProceed: true,
|
|
1194
|
+
eventData: {
|
|
1195
|
+
webClientDomain: 'whatever',
|
|
1196
|
+
isMercuryConnected: true,
|
|
1197
|
+
},
|
|
1198
|
+
identifiers: {
|
|
1199
|
+
correlationId: 'correlationId3',
|
|
1200
|
+
sessionCorrelationId: 'sessionCorrelationId3',
|
|
1201
|
+
deviceId: 'deviceUrl',
|
|
1202
|
+
locusId: 'url',
|
|
1203
|
+
locusStartTime: 'lastActive',
|
|
1204
|
+
locusUrl: 'locus/url',
|
|
1205
|
+
mediaAgentAlias: 'alias',
|
|
1206
|
+
mediaAgentGroupId: '1',
|
|
1207
|
+
orgId: 'orgId',
|
|
1208
|
+
userId: 'userId',
|
|
1209
|
+
},
|
|
1210
|
+
loginType: 'login-ci',
|
|
1211
|
+
name: 'client.alert.displayed',
|
|
1212
|
+
userType: 'host',
|
|
1213
|
+
isConvergedArchitectureEnabled: undefined,
|
|
1214
|
+
webexSubServiceType: undefined,
|
|
1215
|
+
webClientPreload: undefined,
|
|
1216
|
+
},
|
|
1217
|
+
eventId: 'my-fake-id',
|
|
1218
|
+
origin: {
|
|
1219
|
+
origin: 'fake-origin',
|
|
1220
|
+
},
|
|
1221
|
+
originTime: {
|
|
1222
|
+
sent: 'not_defined_yet',
|
|
1223
|
+
triggered: now.toISOString(),
|
|
1224
|
+
},
|
|
1225
|
+
senderCountryCode: 'UK',
|
|
1226
|
+
version: 1,
|
|
1227
|
+
},
|
|
1228
|
+
});
|
|
770
1229
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
correlationId: 'id',
|
|
778
|
-
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
779
|
-
globalMeetingId: 'globalMeetingId1',
|
|
780
|
-
},
|
|
781
|
-
name: 'client.alert.displayed',
|
|
782
|
-
},
|
|
783
|
-
eventId: 'my-fake-id',
|
|
784
|
-
origin: {
|
|
785
|
-
origin: 'fake-origin',
|
|
786
|
-
},
|
|
787
|
-
originTime: {
|
|
788
|
-
sent: 'not_defined_yet',
|
|
789
|
-
triggered: 'fake-triggered-time',
|
|
790
|
-
},
|
|
791
|
-
senderCountryCode: 'UK',
|
|
792
|
-
version: 1,
|
|
1230
|
+
const webexLoggerLogCalls = webex.logger.log.getCalls();
|
|
1231
|
+
assert.deepEqual(webexLoggerLogCalls[1].args, [
|
|
1232
|
+
'call-diagnostic-events -> ',
|
|
1233
|
+
'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
|
|
1234
|
+
`name: client.alert.displayed`,
|
|
1235
|
+
]);
|
|
793
1236
|
});
|
|
794
|
-
});
|
|
795
1237
|
|
|
796
|
-
|
|
797
|
-
it('should submit client event successfully with meetingId', () => {
|
|
1238
|
+
it('should submit client event successfully with meetingId which has a meetingJoinedTime', () => {
|
|
798
1239
|
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
799
1240
|
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
800
1241
|
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
801
1242
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
802
|
-
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
803
1243
|
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
804
1244
|
const validatorSpy = sinon.spy(cd, 'validator');
|
|
805
1245
|
const options = {
|
|
806
|
-
meetingId:
|
|
1246
|
+
meetingId: fakeMeeting4.id,
|
|
807
1247
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
808
1248
|
};
|
|
809
|
-
|
|
1249
|
+
cd.setMercuryConnectedStatus(true);
|
|
810
1250
|
cd.submitClientEvent({
|
|
811
1251
|
name: 'client.alert.displayed',
|
|
812
1252
|
options,
|
|
@@ -814,19 +1254,21 @@ describe('internal-plugin-metrics', () => {
|
|
|
814
1254
|
|
|
815
1255
|
assert.called(getIdentifiersSpy);
|
|
816
1256
|
assert.calledWith(getIdentifiersSpy, {
|
|
817
|
-
meeting:
|
|
1257
|
+
meeting: {...fakeMeeting4},
|
|
818
1258
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
819
1259
|
webexConferenceIdStr: undefined,
|
|
820
|
-
sessionCorrelationId: undefined,
|
|
821
1260
|
globalMeetingId: undefined,
|
|
1261
|
+
sessionCorrelationId: undefined,
|
|
822
1262
|
});
|
|
823
1263
|
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
824
1264
|
assert.calledWith(
|
|
825
1265
|
prepareDiagnosticEventSpy,
|
|
826
1266
|
{
|
|
1267
|
+
meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
|
|
827
1268
|
canProceed: true,
|
|
828
1269
|
eventData: {
|
|
829
1270
|
webClientDomain: 'whatever',
|
|
1271
|
+
isMercuryConnected: true,
|
|
830
1272
|
},
|
|
831
1273
|
identifiers: {
|
|
832
1274
|
correlationId: 'correlationId',
|
|
@@ -840,19 +1282,21 @@ describe('internal-plugin-metrics', () => {
|
|
|
840
1282
|
userId: 'userId',
|
|
841
1283
|
},
|
|
842
1284
|
loginType: 'login-ci',
|
|
1285
|
+
webClientPreload: undefined,
|
|
843
1286
|
name: 'client.alert.displayed',
|
|
844
1287
|
userType: 'host',
|
|
845
1288
|
isConvergedArchitectureEnabled: undefined,
|
|
846
1289
|
webexSubServiceType: undefined,
|
|
847
|
-
webClientPreload: undefined,
|
|
848
1290
|
},
|
|
849
1291
|
options
|
|
850
1292
|
);
|
|
851
1293
|
assert.calledWith(submitToCallDiagnosticsSpy, {
|
|
852
1294
|
event: {
|
|
1295
|
+
meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
|
|
853
1296
|
canProceed: true,
|
|
854
1297
|
eventData: {
|
|
855
1298
|
webClientDomain: 'whatever',
|
|
1299
|
+
isMercuryConnected: true,
|
|
856
1300
|
},
|
|
857
1301
|
identifiers: {
|
|
858
1302
|
correlationId: 'correlationId',
|
|
@@ -866,11 +1310,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
866
1310
|
userId: 'userId',
|
|
867
1311
|
},
|
|
868
1312
|
loginType: 'login-ci',
|
|
1313
|
+
webClientPreload: undefined,
|
|
869
1314
|
name: 'client.alert.displayed',
|
|
870
1315
|
userType: 'host',
|
|
871
1316
|
isConvergedArchitectureEnabled: undefined,
|
|
872
1317
|
webexSubServiceType: undefined,
|
|
873
|
-
webClientPreload: undefined,
|
|
874
1318
|
},
|
|
875
1319
|
eventId: 'my-fake-id',
|
|
876
1320
|
origin: {
|
|
@@ -887,9 +1331,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
887
1331
|
type: 'ce',
|
|
888
1332
|
event: {
|
|
889
1333
|
event: {
|
|
1334
|
+
meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
|
|
890
1335
|
canProceed: true,
|
|
891
1336
|
eventData: {
|
|
892
1337
|
webClientDomain: 'whatever',
|
|
1338
|
+
isMercuryConnected: true,
|
|
893
1339
|
},
|
|
894
1340
|
identifiers: {
|
|
895
1341
|
correlationId: 'correlationId',
|
|
@@ -903,11 +1349,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
903
1349
|
userId: 'userId',
|
|
904
1350
|
},
|
|
905
1351
|
loginType: 'login-ci',
|
|
1352
|
+
webClientPreload: undefined,
|
|
906
1353
|
name: 'client.alert.displayed',
|
|
907
1354
|
userType: 'host',
|
|
908
1355
|
isConvergedArchitectureEnabled: undefined,
|
|
909
1356
|
webexSubServiceType: undefined,
|
|
910
|
-
webClientPreload: undefined,
|
|
911
1357
|
},
|
|
912
1358
|
eventId: 'my-fake-id',
|
|
913
1359
|
origin: {
|
|
@@ -930,19 +1376,18 @@ describe('internal-plugin-metrics', () => {
|
|
|
930
1376
|
]);
|
|
931
1377
|
});
|
|
932
1378
|
|
|
933
|
-
it('should submit client event successfully with meetingId which has
|
|
1379
|
+
it('should submit client event successfully with meetingId which has emailInput and userNameInput', () => {
|
|
934
1380
|
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
935
1381
|
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
936
1382
|
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
937
1383
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
938
|
-
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
939
1384
|
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
940
1385
|
const validatorSpy = sinon.spy(cd, 'validator');
|
|
941
1386
|
const options = {
|
|
942
|
-
meetingId:
|
|
1387
|
+
meetingId: fakeMeeting5.id,
|
|
943
1388
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
944
1389
|
};
|
|
945
|
-
|
|
1390
|
+
cd.setMercuryConnectedStatus(true);
|
|
946
1391
|
cd.submitClientEvent({
|
|
947
1392
|
name: 'client.alert.displayed',
|
|
948
1393
|
options,
|
|
@@ -950,7 +1395,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
950
1395
|
|
|
951
1396
|
assert.called(getIdentifiersSpy);
|
|
952
1397
|
assert.calledWith(getIdentifiersSpy, {
|
|
953
|
-
meeting: {...
|
|
1398
|
+
meeting: {...fakeMeeting5, sessionCorrelationId: 'sessionCorrelationId5'},
|
|
954
1399
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
955
1400
|
webexConferenceIdStr: undefined,
|
|
956
1401
|
globalMeetingId: undefined,
|
|
@@ -963,10 +1408,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
963
1408
|
canProceed: true,
|
|
964
1409
|
eventData: {
|
|
965
1410
|
webClientDomain: 'whatever',
|
|
1411
|
+
isMercuryConnected: true,
|
|
966
1412
|
},
|
|
967
1413
|
identifiers: {
|
|
968
|
-
correlationId: '
|
|
969
|
-
sessionCorrelationId: '
|
|
1414
|
+
correlationId: 'correlationId5',
|
|
1415
|
+
sessionCorrelationId: 'sessionCorrelationId5',
|
|
970
1416
|
deviceId: 'deviceUrl',
|
|
971
1417
|
locusId: 'url',
|
|
972
1418
|
locusStartTime: 'lastActive',
|
|
@@ -979,6 +1425,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
979
1425
|
loginType: 'login-ci',
|
|
980
1426
|
name: 'client.alert.displayed',
|
|
981
1427
|
userType: 'host',
|
|
1428
|
+
userNameInput: 'test',
|
|
1429
|
+
emailInput: 'test@test.com',
|
|
982
1430
|
isConvergedArchitectureEnabled: undefined,
|
|
983
1431
|
webexSubServiceType: undefined,
|
|
984
1432
|
webClientPreload: undefined,
|
|
@@ -990,10 +1438,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
990
1438
|
canProceed: true,
|
|
991
1439
|
eventData: {
|
|
992
1440
|
webClientDomain: 'whatever',
|
|
1441
|
+
isMercuryConnected: true,
|
|
993
1442
|
},
|
|
994
1443
|
identifiers: {
|
|
995
|
-
correlationId: '
|
|
996
|
-
sessionCorrelationId: '
|
|
1444
|
+
correlationId: 'correlationId5',
|
|
1445
|
+
sessionCorrelationId: 'sessionCorrelationId5',
|
|
997
1446
|
deviceId: 'deviceUrl',
|
|
998
1447
|
locusId: 'url',
|
|
999
1448
|
locusStartTime: 'lastActive',
|
|
@@ -1006,6 +1455,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
1006
1455
|
loginType: 'login-ci',
|
|
1007
1456
|
name: 'client.alert.displayed',
|
|
1008
1457
|
userType: 'host',
|
|
1458
|
+
userNameInput: 'test',
|
|
1459
|
+
emailInput: 'test@test.com',
|
|
1009
1460
|
isConvergedArchitectureEnabled: undefined,
|
|
1010
1461
|
webexSubServiceType: undefined,
|
|
1011
1462
|
webClientPreload: undefined,
|
|
@@ -1028,10 +1479,11 @@ describe('internal-plugin-metrics', () => {
|
|
|
1028
1479
|
canProceed: true,
|
|
1029
1480
|
eventData: {
|
|
1030
1481
|
webClientDomain: 'whatever',
|
|
1482
|
+
isMercuryConnected: true,
|
|
1031
1483
|
},
|
|
1032
1484
|
identifiers: {
|
|
1033
|
-
correlationId: '
|
|
1034
|
-
sessionCorrelationId: '
|
|
1485
|
+
correlationId: 'correlationId5',
|
|
1486
|
+
sessionCorrelationId: 'sessionCorrelationId5',
|
|
1035
1487
|
deviceId: 'deviceUrl',
|
|
1036
1488
|
locusId: 'url',
|
|
1037
1489
|
locusStartTime: 'lastActive',
|
|
@@ -1044,6 +1496,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
1044
1496
|
loginType: 'login-ci',
|
|
1045
1497
|
name: 'client.alert.displayed',
|
|
1046
1498
|
userType: 'host',
|
|
1499
|
+
userNameInput: 'test',
|
|
1500
|
+
emailInput: 'test@test.com',
|
|
1047
1501
|
isConvergedArchitectureEnabled: undefined,
|
|
1048
1502
|
webexSubServiceType: undefined,
|
|
1049
1503
|
webClientPreload: undefined,
|
|
@@ -1076,7 +1530,14 @@ describe('internal-plugin-metrics', () => {
|
|
|
1076
1530
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
1077
1531
|
const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
|
|
1078
1532
|
const validatorSpy = sinon.spy(cd, 'validator');
|
|
1079
|
-
|
|
1533
|
+
|
|
1534
|
+
Object.defineProperty(global, 'navigator', {
|
|
1535
|
+
value: {
|
|
1536
|
+
userAgent,
|
|
1537
|
+
},
|
|
1538
|
+
configurable: true,
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1080
1541
|
sinon.stub(bowser, 'getParser').returns(userAgent);
|
|
1081
1542
|
|
|
1082
1543
|
const options = {
|
|
@@ -1130,7 +1591,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1130
1591
|
globalMeetingId: 'globalMeetingId1',
|
|
1131
1592
|
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1132
1593
|
};
|
|
1133
|
-
|
|
1594
|
+
cd.setMercuryConnectedStatus(true);
|
|
1134
1595
|
cd.submitClientEvent({
|
|
1135
1596
|
name: 'client.alert.displayed',
|
|
1136
1597
|
options,
|
|
@@ -1151,6 +1612,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1151
1612
|
canProceed: true,
|
|
1152
1613
|
eventData: {
|
|
1153
1614
|
webClientDomain: 'whatever',
|
|
1615
|
+
isMercuryConnected: true,
|
|
1154
1616
|
},
|
|
1155
1617
|
identifiers: {
|
|
1156
1618
|
correlationId: 'correlationId',
|
|
@@ -1164,7 +1626,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1164
1626
|
},
|
|
1165
1627
|
loginType: 'login-ci',
|
|
1166
1628
|
name: 'client.alert.displayed',
|
|
1167
|
-
webClientPreload: undefined
|
|
1629
|
+
webClientPreload: undefined,
|
|
1168
1630
|
},
|
|
1169
1631
|
options
|
|
1170
1632
|
);
|
|
@@ -1173,6 +1635,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1173
1635
|
canProceed: true,
|
|
1174
1636
|
eventData: {
|
|
1175
1637
|
webClientDomain: 'whatever',
|
|
1638
|
+
isMercuryConnected: true,
|
|
1176
1639
|
},
|
|
1177
1640
|
identifiers: {
|
|
1178
1641
|
correlationId: 'correlationId',
|
|
@@ -1186,7 +1649,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1186
1649
|
},
|
|
1187
1650
|
loginType: 'login-ci',
|
|
1188
1651
|
name: 'client.alert.displayed',
|
|
1189
|
-
webClientPreload: undefined
|
|
1652
|
+
webClientPreload: undefined,
|
|
1190
1653
|
},
|
|
1191
1654
|
eventId: 'my-fake-id',
|
|
1192
1655
|
origin: {
|
|
@@ -1218,13 +1681,102 @@ describe('internal-plugin-metrics', () => {
|
|
|
1218
1681
|
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
1219
1682
|
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
1220
1683
|
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
1684
|
+
cd.setMercuryConnectedStatus(true);
|
|
1685
|
+
const options = {
|
|
1686
|
+
correlationId: 'correlationId',
|
|
1687
|
+
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1688
|
+
globalMeetingId: 'globalMeetingId1',
|
|
1689
|
+
preLoginId: 'myPreLoginId',
|
|
1690
|
+
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
cd.submitClientEvent({
|
|
1694
|
+
name: 'client.alert.displayed',
|
|
1695
|
+
options,
|
|
1696
|
+
});
|
|
1697
|
+
|
|
1698
|
+
assert.calledWith(getIdentifiersSpy, {
|
|
1699
|
+
correlationId: 'correlationId',
|
|
1700
|
+
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1701
|
+
globalMeetingId: 'globalMeetingId1',
|
|
1702
|
+
preLoginId: 'myPreLoginId',
|
|
1703
|
+
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
assert.notCalled(generateClientEventErrorPayloadSpy);
|
|
1707
|
+
assert.calledWith(
|
|
1708
|
+
prepareDiagnosticEventSpy,
|
|
1709
|
+
{
|
|
1710
|
+
canProceed: true,
|
|
1711
|
+
eventData: {
|
|
1712
|
+
webClientDomain: 'whatever',
|
|
1713
|
+
isMercuryConnected: true,
|
|
1714
|
+
},
|
|
1715
|
+
identifiers: {
|
|
1716
|
+
correlationId: 'correlationId',
|
|
1717
|
+
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1718
|
+
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1719
|
+
globalMeetingId: 'globalMeetingId1',
|
|
1720
|
+
deviceId: 'deviceUrl',
|
|
1721
|
+
locusUrl: 'locus-url',
|
|
1722
|
+
orgId: 'orgId',
|
|
1723
|
+
userId: 'myPreLoginId',
|
|
1724
|
+
},
|
|
1725
|
+
loginType: 'login-ci',
|
|
1726
|
+
name: 'client.alert.displayed',
|
|
1727
|
+
webClientPreload: undefined,
|
|
1728
|
+
},
|
|
1729
|
+
options
|
|
1730
|
+
);
|
|
1731
|
+
assert.notCalled(submitToCallDiagnosticsSpy);
|
|
1732
|
+
assert.calledWith(
|
|
1733
|
+
submitToCallDiagnosticsPreLoginSpy,
|
|
1734
|
+
{
|
|
1735
|
+
eventId: 'my-fake-id',
|
|
1736
|
+
version: 1,
|
|
1737
|
+
origin: {origin: 'fake-origin'},
|
|
1738
|
+
originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
|
|
1739
|
+
senderCountryCode: 'UK',
|
|
1740
|
+
event: {
|
|
1741
|
+
name: 'client.alert.displayed',
|
|
1742
|
+
canProceed: true,
|
|
1743
|
+
identifiers: {
|
|
1744
|
+
correlationId: 'correlationId',
|
|
1745
|
+
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1746
|
+
userId: 'myPreLoginId',
|
|
1747
|
+
deviceId: 'deviceUrl',
|
|
1748
|
+
orgId: 'orgId',
|
|
1749
|
+
locusUrl: 'locus-url',
|
|
1750
|
+
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1751
|
+
globalMeetingId: 'globalMeetingId1',
|
|
1752
|
+
},
|
|
1753
|
+
eventData: {webClientDomain: 'whatever', isMercuryConnected: true},
|
|
1754
|
+
loginType: 'login-ci',
|
|
1755
|
+
webClientPreload: undefined,
|
|
1756
|
+
},
|
|
1757
|
+
},
|
|
1758
|
+
options.preLoginId
|
|
1759
|
+
);
|
|
1760
|
+
});
|
|
1761
|
+
|
|
1762
|
+
it('should submit client event successfully with emailInput and userNameInput as options', () => {
|
|
1763
|
+
cd.device.userId = undefined;
|
|
1221
1764
|
|
|
1765
|
+
const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
|
|
1766
|
+
const submitToCallDiagnosticsPreLoginSpy = sinon.spy(cd, 'submitToCallDiagnosticsPreLogin');
|
|
1767
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
1768
|
+
const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
|
|
1769
|
+
const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
|
|
1770
|
+
sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
|
|
1771
|
+
cd.setMercuryConnectedStatus(true);
|
|
1222
1772
|
const options = {
|
|
1223
1773
|
correlationId: 'correlationId',
|
|
1224
1774
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1225
1775
|
globalMeetingId: 'globalMeetingId1',
|
|
1226
1776
|
preLoginId: 'myPreLoginId',
|
|
1227
1777
|
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1778
|
+
userNameInput: 'current' as ClientUserNameInput,
|
|
1779
|
+
emailInput: 'current' as ClientEmailInput,
|
|
1228
1780
|
};
|
|
1229
1781
|
|
|
1230
1782
|
cd.submitClientEvent({
|
|
@@ -1247,6 +1799,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1247
1799
|
canProceed: true,
|
|
1248
1800
|
eventData: {
|
|
1249
1801
|
webClientDomain: 'whatever',
|
|
1802
|
+
isMercuryConnected: true,
|
|
1250
1803
|
},
|
|
1251
1804
|
identifiers: {
|
|
1252
1805
|
correlationId: 'correlationId',
|
|
@@ -1258,6 +1811,8 @@ describe('internal-plugin-metrics', () => {
|
|
|
1258
1811
|
orgId: 'orgId',
|
|
1259
1812
|
userId: 'myPreLoginId',
|
|
1260
1813
|
},
|
|
1814
|
+
userNameInput: 'current',
|
|
1815
|
+
emailInput: 'current',
|
|
1261
1816
|
loginType: 'login-ci',
|
|
1262
1817
|
name: 'client.alert.displayed',
|
|
1263
1818
|
webClientPreload: undefined,
|
|
@@ -1286,8 +1841,10 @@ describe('internal-plugin-metrics', () => {
|
|
|
1286
1841
|
webexConferenceIdStr: 'webexConferenceIdStr1',
|
|
1287
1842
|
globalMeetingId: 'globalMeetingId1',
|
|
1288
1843
|
},
|
|
1289
|
-
eventData: {webClientDomain: 'whatever'},
|
|
1844
|
+
eventData: {webClientDomain: 'whatever', isMercuryConnected: true},
|
|
1290
1845
|
loginType: 'login-ci',
|
|
1846
|
+
userNameInput: 'current',
|
|
1847
|
+
emailInput: 'current',
|
|
1291
1848
|
webClientPreload: undefined,
|
|
1292
1849
|
},
|
|
1293
1850
|
},
|
|
@@ -1302,7 +1859,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1302
1859
|
meetingId: fakeMeeting2.id,
|
|
1303
1860
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1304
1861
|
};
|
|
1305
|
-
|
|
1862
|
+
cd.setMercuryConnectedStatus(true);
|
|
1306
1863
|
cd.submitClientEvent({
|
|
1307
1864
|
name: 'client.alert.displayed',
|
|
1308
1865
|
options,
|
|
@@ -1313,6 +1870,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1313
1870
|
canProceed: true,
|
|
1314
1871
|
eventData: {
|
|
1315
1872
|
webClientDomain: 'whatever',
|
|
1873
|
+
isMercuryConnected: true,
|
|
1316
1874
|
},
|
|
1317
1875
|
identifiers: {
|
|
1318
1876
|
correlationId: 'correlationId2',
|
|
@@ -1354,7 +1912,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1354
1912
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1355
1913
|
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1356
1914
|
};
|
|
1357
|
-
|
|
1915
|
+
cd.setMercuryConnectedStatus(true);
|
|
1358
1916
|
cd.submitClientEvent({
|
|
1359
1917
|
name: 'client.alert.displayed',
|
|
1360
1918
|
options,
|
|
@@ -1365,6 +1923,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1365
1923
|
canProceed: true,
|
|
1366
1924
|
eventData: {
|
|
1367
1925
|
webClientDomain: 'whatever',
|
|
1926
|
+
isMercuryConnected: true,
|
|
1368
1927
|
},
|
|
1369
1928
|
identifiers: {
|
|
1370
1929
|
correlationId: 'correlationId2',
|
|
@@ -1413,7 +1972,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1413
1972
|
globalMeetingId: 'globalMeetingId1',
|
|
1414
1973
|
sessionCorrelationId: 'sessionCorrelationId1',
|
|
1415
1974
|
};
|
|
1416
|
-
|
|
1975
|
+
cd.setMercuryConnectedStatus(true);
|
|
1417
1976
|
cd.submitClientEvent({
|
|
1418
1977
|
name: 'client.alert.displayed',
|
|
1419
1978
|
options,
|
|
@@ -1426,6 +1985,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1426
1985
|
canProceed: true,
|
|
1427
1986
|
eventData: {
|
|
1428
1987
|
webClientDomain: 'whatever',
|
|
1988
|
+
isMercuryConnected: true,
|
|
1429
1989
|
},
|
|
1430
1990
|
identifiers: {
|
|
1431
1991
|
correlationId: 'correlationId',
|
|
@@ -1448,6 +2008,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1448
2008
|
canProceed: true,
|
|
1449
2009
|
eventData: {
|
|
1450
2010
|
webClientDomain: 'whatever',
|
|
2011
|
+
isMercuryConnected: true,
|
|
1451
2012
|
},
|
|
1452
2013
|
identifiers: {
|
|
1453
2014
|
correlationId: 'correlationId',
|
|
@@ -1491,7 +2052,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1491
2052
|
},
|
|
1492
2053
|
},
|
|
1493
2054
|
};
|
|
1494
|
-
|
|
2055
|
+
cd.setMercuryConnectedStatus(true);
|
|
1495
2056
|
cd.submitClientEvent({
|
|
1496
2057
|
name: 'client.alert.displayed',
|
|
1497
2058
|
options,
|
|
@@ -1502,6 +2063,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1502
2063
|
canProceed: true,
|
|
1503
2064
|
eventData: {
|
|
1504
2065
|
webClientDomain: 'whatever',
|
|
2066
|
+
isMercuryConnected: true,
|
|
1505
2067
|
},
|
|
1506
2068
|
identifiers: {
|
|
1507
2069
|
correlationId: 'correlationId',
|
|
@@ -1557,7 +2119,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1557
2119
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1558
2120
|
'call-diagnostic-events -> ',
|
|
1559
2121
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1560
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
|
|
2122
|
+
`generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
|
|
1561
2123
|
]);
|
|
1562
2124
|
});
|
|
1563
2125
|
|
|
@@ -1570,7 +2132,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1570
2132
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1571
2133
|
rawError: new Error('bad times'),
|
|
1572
2134
|
};
|
|
1573
|
-
|
|
2135
|
+
cd.setMercuryConnectedStatus(true);
|
|
1574
2136
|
cd.submitClientEvent({
|
|
1575
2137
|
name: 'client.alert.displayed',
|
|
1576
2138
|
options,
|
|
@@ -1581,6 +2143,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1581
2143
|
canProceed: true,
|
|
1582
2144
|
eventData: {
|
|
1583
2145
|
webClientDomain: 'whatever',
|
|
2146
|
+
isMercuryConnected: true,
|
|
1584
2147
|
},
|
|
1585
2148
|
identifiers: {
|
|
1586
2149
|
correlationId: 'correlationId',
|
|
@@ -1637,7 +2200,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1637
2200
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1638
2201
|
'call-diagnostic-events -> ',
|
|
1639
2202
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1640
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
2203
|
+
`generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1641
2204
|
]);
|
|
1642
2205
|
});
|
|
1643
2206
|
|
|
@@ -1649,7 +2212,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1649
2212
|
correlationId: 'correlationId',
|
|
1650
2213
|
rawError: new Error('bad times'),
|
|
1651
2214
|
};
|
|
1652
|
-
|
|
2215
|
+
cd.setMercuryConnectedStatus(true);
|
|
1653
2216
|
cd.submitClientEvent({
|
|
1654
2217
|
name: 'client.alert.displayed',
|
|
1655
2218
|
options,
|
|
@@ -1660,6 +2223,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1660
2223
|
canProceed: true,
|
|
1661
2224
|
eventData: {
|
|
1662
2225
|
webClientDomain: 'whatever',
|
|
2226
|
+
isMercuryConnected: true,
|
|
1663
2227
|
},
|
|
1664
2228
|
identifiers: {
|
|
1665
2229
|
correlationId: 'correlationId',
|
|
@@ -1710,7 +2274,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1710
2274
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1711
2275
|
'call-diagnostic-events -> ',
|
|
1712
2276
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1713
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
2277
|
+
`generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
|
|
1714
2278
|
]);
|
|
1715
2279
|
});
|
|
1716
2280
|
|
|
@@ -1726,7 +2290,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1726
2290
|
},
|
|
1727
2291
|
},
|
|
1728
2292
|
};
|
|
1729
|
-
|
|
2293
|
+
cd.setMercuryConnectedStatus(true);
|
|
1730
2294
|
cd.submitClientEvent({
|
|
1731
2295
|
name: 'client.alert.displayed',
|
|
1732
2296
|
options,
|
|
@@ -1737,6 +2301,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1737
2301
|
canProceed: true,
|
|
1738
2302
|
eventData: {
|
|
1739
2303
|
webClientDomain: 'whatever',
|
|
2304
|
+
isMercuryConnected: true,
|
|
1740
2305
|
},
|
|
1741
2306
|
identifiers: {
|
|
1742
2307
|
correlationId: 'correlationId',
|
|
@@ -1784,7 +2349,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1784
2349
|
assert.deepEqual(webexLoggerLogCalls[2].args, [
|
|
1785
2350
|
'call-diagnostic-events -> ',
|
|
1786
2351
|
'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
|
|
1787
|
-
`generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
|
|
2352
|
+
`generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
|
|
1788
2353
|
]);
|
|
1789
2354
|
});
|
|
1790
2355
|
|
|
@@ -1796,7 +2361,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1796
2361
|
meetingId: fakeMeeting.id,
|
|
1797
2362
|
mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
|
|
1798
2363
|
};
|
|
1799
|
-
|
|
2364
|
+
cd.setMercuryConnectedStatus(true);
|
|
1800
2365
|
cd.submitClientEvent({
|
|
1801
2366
|
name: 'client.alert.displayed',
|
|
1802
2367
|
payload: {
|
|
@@ -1817,6 +2382,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
1817
2382
|
canProceed: true,
|
|
1818
2383
|
eventData: {
|
|
1819
2384
|
webClientDomain: 'whatever',
|
|
2385
|
+
isMercuryConnected: true,
|
|
1820
2386
|
},
|
|
1821
2387
|
identifiers: {
|
|
1822
2388
|
correlationId: 'correlationId',
|
|
@@ -2164,8 +2730,37 @@ describe('internal-plugin-metrics', () => {
|
|
|
2164
2730
|
rawErrorMessage: 'bad times',
|
|
2165
2731
|
};
|
|
2166
2732
|
|
|
2733
|
+
it('should be cached if called twice with the same payload', () => {
|
|
2734
|
+
const error = new Error('bad times');
|
|
2735
|
+
const expectedPayload = {
|
|
2736
|
+
category: 'other',
|
|
2737
|
+
errorCode: 9999,
|
|
2738
|
+
errorData: {errorName: 'Error'},
|
|
2739
|
+
serviceErrorCode: 9999,
|
|
2740
|
+
fatal: true,
|
|
2741
|
+
shownToUser: false,
|
|
2742
|
+
name: 'other',
|
|
2743
|
+
rawErrorMessage: 'bad times',
|
|
2744
|
+
errorDescription: 'UnknownError',
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2748
|
+
assert.isFalse(cached);
|
|
2749
|
+
assert.deepEqual(res, expectedPayload);
|
|
2750
|
+
|
|
2751
|
+
const [res2, cached2] = cd.generateClientEventErrorPayload(error);
|
|
2752
|
+
assert.isTrue(cached2);
|
|
2753
|
+
assert.deepEqual(res2, expectedPayload);
|
|
2754
|
+
|
|
2755
|
+
// after clearing the cache, it should be false again
|
|
2756
|
+
cd.clearErrorCache();
|
|
2757
|
+
const [res3, cached3] = cd.generateClientEventErrorPayload(error);
|
|
2758
|
+
assert.isFalse(cached3);
|
|
2759
|
+
assert.deepEqual(res3, expectedPayload);
|
|
2760
|
+
});
|
|
2761
|
+
|
|
2167
2762
|
const checkNameError = (payload: any, isExpectedToBeCalled: boolean) => {
|
|
2168
|
-
const res = cd.generateClientEventErrorPayload(payload);
|
|
2763
|
+
const [res, cached] = cd.generateClientEventErrorPayload(payload);
|
|
2169
2764
|
const expectedResult = {
|
|
2170
2765
|
category: 'expected',
|
|
2171
2766
|
errorDescription: 'CameraPermissionDenied',
|
|
@@ -2194,7 +2789,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2194
2789
|
});
|
|
2195
2790
|
|
|
2196
2791
|
const checkCodeError = (payload: any, expetedRes: any) => {
|
|
2197
|
-
const res = cd.generateClientEventErrorPayload(payload);
|
|
2792
|
+
const [res, cached] = cd.generateClientEventErrorPayload(payload);
|
|
2198
2793
|
assert.deepEqual(res, expetedRes);
|
|
2199
2794
|
};
|
|
2200
2795
|
it('should generate event error payload correctly', () => {
|
|
@@ -2220,7 +2815,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2220
2815
|
});
|
|
2221
2816
|
|
|
2222
2817
|
const checkLocusError = (payload: any, isExpectedToBeCalled: boolean) => {
|
|
2223
|
-
const res = cd.generateClientEventErrorPayload(payload);
|
|
2818
|
+
const [res, cached] = cd.generateClientEventErrorPayload(payload);
|
|
2224
2819
|
const expectedResult = {
|
|
2225
2820
|
category: 'signaling',
|
|
2226
2821
|
errorDescription: 'NewLocusError',
|
|
@@ -2248,7 +2843,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2248
2843
|
});
|
|
2249
2844
|
|
|
2250
2845
|
const checkMeetingInfoError = (payload: any, isExpectedToBeCalled: boolean) => {
|
|
2251
|
-
const res = cd.generateClientEventErrorPayload(payload);
|
|
2846
|
+
const [res, cached] = cd.generateClientEventErrorPayload(payload);
|
|
2252
2847
|
const expectedResult = {
|
|
2253
2848
|
category: 'signaling',
|
|
2254
2849
|
errorDescription: 'MeetingInfoLookupError',
|
|
@@ -2289,7 +2884,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2289
2884
|
});
|
|
2290
2885
|
|
|
2291
2886
|
it('should return NetworkError code for a NetworkOrCORSERror', () => {
|
|
2292
|
-
const res = cd.generateClientEventErrorPayload(
|
|
2887
|
+
const [res, cached] = cd.generateClientEventErrorPayload(
|
|
2293
2888
|
new WebexHttpError.NetworkOrCORSError({
|
|
2294
2889
|
url: 'https://example.com',
|
|
2295
2890
|
statusCode: 0,
|
|
@@ -2333,7 +2928,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2333
2928
|
message: 'No codecs present in m-line with MID 0 after filtering.',
|
|
2334
2929
|
},
|
|
2335
2930
|
};
|
|
2336
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
2931
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2337
2932
|
assert.deepEqual(res, {
|
|
2338
2933
|
category: 'expected',
|
|
2339
2934
|
errorCode: 2051,
|
|
@@ -2359,7 +2954,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2359
2954
|
message: 'empty local SDP',
|
|
2360
2955
|
},
|
|
2361
2956
|
};
|
|
2362
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
2957
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2363
2958
|
assert.deepEqual(res, {
|
|
2364
2959
|
category: 'media',
|
|
2365
2960
|
errorCode: 2050,
|
|
@@ -2384,7 +2979,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2384
2979
|
category: 'expected',
|
|
2385
2980
|
};
|
|
2386
2981
|
|
|
2387
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
2982
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2388
2983
|
assert.deepEqual(res, {
|
|
2389
2984
|
category: 'expected',
|
|
2390
2985
|
errorDescription: 'UnknownError',
|
|
@@ -2413,7 +3008,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2413
3008
|
category: 'expected',
|
|
2414
3009
|
};
|
|
2415
3010
|
|
|
2416
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
3011
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2417
3012
|
assert.deepEqual(res, {
|
|
2418
3013
|
category: 'expected',
|
|
2419
3014
|
errorDescription: 'NetworkError',
|
|
@@ -2428,7 +3023,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2428
3023
|
});
|
|
2429
3024
|
|
|
2430
3025
|
it('should return AuthenticationFailed code for an Unauthorized error', () => {
|
|
2431
|
-
const res = cd.generateClientEventErrorPayload(
|
|
3026
|
+
const [res, cached] = cd.generateClientEventErrorPayload(
|
|
2432
3027
|
new WebexHttpError.Unauthorized({
|
|
2433
3028
|
url: 'https://example.com',
|
|
2434
3029
|
statusCode: 0,
|
|
@@ -2461,7 +3056,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2461
3056
|
category: 'expected',
|
|
2462
3057
|
};
|
|
2463
3058
|
|
|
2464
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
3059
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2465
3060
|
assert.deepEqual(res, {
|
|
2466
3061
|
category: 'expected',
|
|
2467
3062
|
errorDescription: 'AuthenticationFailed',
|
|
@@ -2476,7 +3071,10 @@ describe('internal-plugin-metrics', () => {
|
|
|
2476
3071
|
});
|
|
2477
3072
|
|
|
2478
3073
|
it('should return unknown error otherwise', () => {
|
|
2479
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3074
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
3075
|
+
something: 'new',
|
|
3076
|
+
message: 'bad times',
|
|
3077
|
+
});
|
|
2480
3078
|
assert.deepEqual(res, {
|
|
2481
3079
|
category: 'other',
|
|
2482
3080
|
errorDescription: 'UnknownError',
|
|
@@ -2490,7 +3088,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2490
3088
|
});
|
|
2491
3089
|
|
|
2492
3090
|
it('should generate event error payload correctly for locus error 2423012', () => {
|
|
2493
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3091
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2494
3092
|
body: {errorCode: 2423012},
|
|
2495
3093
|
message: 'bad times',
|
|
2496
3094
|
});
|
|
@@ -2506,7 +3104,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2506
3104
|
});
|
|
2507
3105
|
});
|
|
2508
3106
|
it('should generate event error payload correctly for locus error 2409062', () => {
|
|
2509
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3107
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2510
3108
|
body: {errorCode: 2409062},
|
|
2511
3109
|
message: 'bad times',
|
|
2512
3110
|
});
|
|
@@ -2523,7 +3121,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2523
3121
|
});
|
|
2524
3122
|
|
|
2525
3123
|
it('should generate event error payload correctly for locus error 2423021', () => {
|
|
2526
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3124
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2527
3125
|
body: {errorCode: 2423021},
|
|
2528
3126
|
message: 'bad times',
|
|
2529
3127
|
});
|
|
@@ -2540,7 +3138,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2540
3138
|
});
|
|
2541
3139
|
|
|
2542
3140
|
it('should generate event error payload correctly for wdm error 4404002', () => {
|
|
2543
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3141
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2544
3142
|
body: {errorCode: 4404002},
|
|
2545
3143
|
message: 'Operation denied due to region restriction',
|
|
2546
3144
|
});
|
|
@@ -2557,7 +3155,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2557
3155
|
});
|
|
2558
3156
|
|
|
2559
3157
|
it('should generate event error payload correctly for wdm error 4404003', () => {
|
|
2560
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3158
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2561
3159
|
body: {errorCode: 4404003},
|
|
2562
3160
|
message: 'Operation denied due to region restriction',
|
|
2563
3161
|
});
|
|
@@ -2575,7 +3173,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2575
3173
|
|
|
2576
3174
|
describe('httpStatusCode', () => {
|
|
2577
3175
|
it('should include httpStatusCode for browser media errors', () => {
|
|
2578
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3176
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2579
3177
|
name: 'PermissionDeniedError',
|
|
2580
3178
|
message: 'bad times',
|
|
2581
3179
|
statusCode: 401,
|
|
@@ -2597,7 +3195,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2597
3195
|
});
|
|
2598
3196
|
|
|
2599
3197
|
it('should include httpStatusCode for SdpOfferCreationErrors', () => {
|
|
2600
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3198
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2601
3199
|
name: 'SdpOfferCreationError',
|
|
2602
3200
|
message: 'bad times',
|
|
2603
3201
|
statusCode: 404,
|
|
@@ -2619,7 +3217,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2619
3217
|
});
|
|
2620
3218
|
|
|
2621
3219
|
it('should include httpStatusCode for service error codes', () => {
|
|
2622
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3220
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2623
3221
|
body: {errorCode: 58400},
|
|
2624
3222
|
message: 'bad times',
|
|
2625
3223
|
statusCode: 400,
|
|
@@ -2638,7 +3236,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2638
3236
|
});
|
|
2639
3237
|
|
|
2640
3238
|
it('should include httpStatusCode for locus service error codes', () => {
|
|
2641
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3239
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2642
3240
|
body: {errorCode: 2403001},
|
|
2643
3241
|
message: 'bad times',
|
|
2644
3242
|
statusCode: 400,
|
|
@@ -2657,7 +3255,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2657
3255
|
});
|
|
2658
3256
|
|
|
2659
3257
|
it('should include httpStatusCode for meetingInfo service error codes', () => {
|
|
2660
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3258
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2661
3259
|
body: {data: {meetingInfo: {}}},
|
|
2662
3260
|
message: 'bad times',
|
|
2663
3261
|
statusCode: 400,
|
|
@@ -2680,7 +3278,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2680
3278
|
statusCode: 400,
|
|
2681
3279
|
options: {service: '', headers: {}},
|
|
2682
3280
|
});
|
|
2683
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
3281
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2684
3282
|
assert.deepEqual(res, {
|
|
2685
3283
|
category: 'network',
|
|
2686
3284
|
errorCode: 1026,
|
|
@@ -2699,7 +3297,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2699
3297
|
statusCode: 401,
|
|
2700
3298
|
options: {service: '', headers: {}},
|
|
2701
3299
|
});
|
|
2702
|
-
const res = cd.generateClientEventErrorPayload(error);
|
|
3300
|
+
const [res, cached] = cd.generateClientEventErrorPayload(error);
|
|
2703
3301
|
assert.deepEqual(res, {
|
|
2704
3302
|
category: 'network',
|
|
2705
3303
|
errorCode: 1010,
|
|
@@ -2714,7 +3312,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2714
3312
|
});
|
|
2715
3313
|
|
|
2716
3314
|
it('should include httpStatusCode for unknown errors', () => {
|
|
2717
|
-
const res = cd.generateClientEventErrorPayload({
|
|
3315
|
+
const [res, cached] = cd.generateClientEventErrorPayload({
|
|
2718
3316
|
message: 'bad times',
|
|
2719
3317
|
statusCode: 404,
|
|
2720
3318
|
});
|
|
@@ -2763,22 +3361,32 @@ describe('internal-plugin-metrics', () => {
|
|
|
2763
3361
|
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'ScheduledMeeting');
|
|
2764
3362
|
});
|
|
2765
3363
|
|
|
2766
|
-
it('returns subServicetype as Webinar when meeting is Webinar', () => {
|
|
3364
|
+
it('returns subServicetype as Webinar when meeting is non-converged Webinar', () => {
|
|
2767
3365
|
fakeMeeting.meetingInfo = {
|
|
2768
3366
|
webexScheduled: true,
|
|
2769
3367
|
pmr: false,
|
|
3368
|
+
enableEvent: true,
|
|
3369
|
+
enableConvergedArchitecture: false,
|
|
3370
|
+
};
|
|
3371
|
+
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
|
|
3372
|
+
});
|
|
3373
|
+
|
|
3374
|
+
it('returns subServicetype as Webinar when meeting is converged Webinar', () => {
|
|
3375
|
+
fakeMeeting.meetingInfo = {
|
|
2770
3376
|
enableEvent: true,
|
|
2771
3377
|
isConvergedWebinar: true,
|
|
3378
|
+
isConvergedWebinarWebcast: false,
|
|
3379
|
+
enableConvergedArchitecture: true,
|
|
2772
3380
|
};
|
|
2773
3381
|
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
|
|
2774
3382
|
});
|
|
2775
3383
|
|
|
2776
|
-
it('returns subServicetype as Webcast when meeting is Webinar and enable webcast', () => {
|
|
3384
|
+
it('returns subServicetype as Webcast when meeting is converged Webinar and enable webcast', () => {
|
|
2777
3385
|
fakeMeeting.meetingInfo = {
|
|
2778
|
-
webexScheduled: true,
|
|
2779
|
-
pmr: false,
|
|
2780
3386
|
enableEvent: true,
|
|
3387
|
+
isConvergedWebinar: false,
|
|
2781
3388
|
isConvergedWebinarWebcast: true,
|
|
3389
|
+
enableConvergedArchitecture: true,
|
|
2782
3390
|
};
|
|
2783
3391
|
assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webcast');
|
|
2784
3392
|
});
|
|
@@ -2814,7 +3422,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2814
3422
|
meetingId: fakeMeeting.id,
|
|
2815
3423
|
preLoginId,
|
|
2816
3424
|
};
|
|
2817
|
-
|
|
3425
|
+
cd.setMercuryConnectedStatus(true);
|
|
2818
3426
|
const triggered = new Date();
|
|
2819
3427
|
const fetchOptions = await cd.buildClientEventFetchRequestOptions({
|
|
2820
3428
|
name: 'client.exit.app',
|
|
@@ -2830,6 +3438,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
2830
3438
|
canProceed: false,
|
|
2831
3439
|
eventData: {
|
|
2832
3440
|
webClientDomain: 'whatever',
|
|
3441
|
+
isMercuryConnected: true,
|
|
2833
3442
|
},
|
|
2834
3443
|
identifiers: {
|
|
2835
3444
|
correlationId: 'correlationId',
|
|
@@ -3061,6 +3670,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
3061
3670
|
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
3062
3671
|
|
|
3063
3672
|
const options = {
|
|
3673
|
+
meetingId: 'meetingId',
|
|
3064
3674
|
correlationId: 'correlationId',
|
|
3065
3675
|
};
|
|
3066
3676
|
|
|
@@ -3093,6 +3703,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
3093
3703
|
name: 'client.alert.displayed',
|
|
3094
3704
|
payload: undefined,
|
|
3095
3705
|
options: {
|
|
3706
|
+
meetingId: 'meetingId',
|
|
3096
3707
|
correlationId: 'correlationId',
|
|
3097
3708
|
triggeredTime: now.toISOString(),
|
|
3098
3709
|
},
|
|
@@ -3101,6 +3712,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
3101
3712
|
name: 'client.alert.removed',
|
|
3102
3713
|
payload: undefined,
|
|
3103
3714
|
options: {
|
|
3715
|
+
meetingId: 'meetingId',
|
|
3104
3716
|
correlationId: 'correlationId',
|
|
3105
3717
|
triggeredTime: now.toISOString(),
|
|
3106
3718
|
},
|
|
@@ -3109,6 +3721,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
3109
3721
|
name: 'client.call.aborted',
|
|
3110
3722
|
payload: undefined,
|
|
3111
3723
|
options: {
|
|
3724
|
+
meetingId: 'meetingId',
|
|
3112
3725
|
correlationId: 'correlationId',
|
|
3113
3726
|
triggeredTime: now.toISOString(),
|
|
3114
3727
|
},
|
|
@@ -3120,6 +3733,79 @@ describe('internal-plugin-metrics', () => {
|
|
|
3120
3733
|
// should not call submitClientEvent again if delayedClientEvents was cleared
|
|
3121
3734
|
assert.notCalled(submitClientEventSpy);
|
|
3122
3735
|
});
|
|
3736
|
+
|
|
3737
|
+
it('calls submitClientEvent for every delayed event with overrides and clears delayedClientEvents array', () => {
|
|
3738
|
+
const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
|
|
3739
|
+
const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
|
|
3740
|
+
|
|
3741
|
+
const options = {
|
|
3742
|
+
meetingId: 'meetingId',
|
|
3743
|
+
correlationId: 'correlationId',
|
|
3744
|
+
};
|
|
3745
|
+
|
|
3746
|
+
const overrides = {
|
|
3747
|
+
correlationId: 'newCorrelationId',
|
|
3748
|
+
};
|
|
3749
|
+
|
|
3750
|
+
cd.submitClientEvent({
|
|
3751
|
+
name: 'client.alert.displayed',
|
|
3752
|
+
options,
|
|
3753
|
+
delaySubmitEvent: true,
|
|
3754
|
+
});
|
|
3755
|
+
|
|
3756
|
+
cd.submitClientEvent({
|
|
3757
|
+
name: 'client.alert.removed',
|
|
3758
|
+
options,
|
|
3759
|
+
delaySubmitEvent: true,
|
|
3760
|
+
});
|
|
3761
|
+
|
|
3762
|
+
cd.submitClientEvent({
|
|
3763
|
+
name: 'client.call.aborted',
|
|
3764
|
+
options,
|
|
3765
|
+
delaySubmitEvent: true,
|
|
3766
|
+
});
|
|
3767
|
+
|
|
3768
|
+
assert.notCalled(submitToCallDiagnosticsSpy);
|
|
3769
|
+
assert.calledThrice(submitClientEventSpy);
|
|
3770
|
+
submitClientEventSpy.resetHistory();
|
|
3771
|
+
|
|
3772
|
+
cd.submitDelayedClientEvents(overrides);
|
|
3773
|
+
|
|
3774
|
+
assert.calledThrice(submitClientEventSpy);
|
|
3775
|
+
assert.calledWith(submitClientEventSpy.firstCall, {
|
|
3776
|
+
name: 'client.alert.displayed',
|
|
3777
|
+
payload: undefined,
|
|
3778
|
+
options: {
|
|
3779
|
+
meetingId: 'meetingId',
|
|
3780
|
+
correlationId: 'newCorrelationId',
|
|
3781
|
+
triggeredTime: now.toISOString(),
|
|
3782
|
+
},
|
|
3783
|
+
});
|
|
3784
|
+
assert.calledWith(submitClientEventSpy.secondCall, {
|
|
3785
|
+
name: 'client.alert.removed',
|
|
3786
|
+
payload: undefined,
|
|
3787
|
+
options: {
|
|
3788
|
+
meetingId: 'meetingId',
|
|
3789
|
+
correlationId: 'newCorrelationId',
|
|
3790
|
+
triggeredTime: now.toISOString(),
|
|
3791
|
+
},
|
|
3792
|
+
});
|
|
3793
|
+
assert.calledWith(submitClientEventSpy.thirdCall, {
|
|
3794
|
+
name: 'client.call.aborted',
|
|
3795
|
+
payload: undefined,
|
|
3796
|
+
options: {
|
|
3797
|
+
meetingId: 'meetingId',
|
|
3798
|
+
correlationId: 'newCorrelationId',
|
|
3799
|
+
triggeredTime: now.toISOString(),
|
|
3800
|
+
},
|
|
3801
|
+
});
|
|
3802
|
+
submitClientEventSpy.resetHistory();
|
|
3803
|
+
|
|
3804
|
+
cd.submitDelayedClientEvents();
|
|
3805
|
+
|
|
3806
|
+
// should not call submitClientEvent again if delayedClientEvents was cleared
|
|
3807
|
+
assert.notCalled(submitClientEventSpy);
|
|
3808
|
+
});
|
|
3123
3809
|
});
|
|
3124
3810
|
});
|
|
3125
3811
|
});
|