|
8 | 8 | * | device ID | generated | mode was | device ID | device ID | | not | | |
9 | 9 | * | was set | ID | enabled | provided | enabled | | set | set | |
10 | 10 | * +--------------------------------------------------+------------------------------------+----------------------+ |
11 | | - * | First init | - | - | - | 1 | - | |
| 11 | + * | First init | - | - | - | 1 | 65 | |
12 | 12 | * +--------------------------------------------------+------------------------------------+----------------------+ |
13 | | - * | First init | x | - | - | 2 | - | |
| 13 | + * | First init | x | - | - | 2 | 66 | |
14 | 14 | * +--------------------------------------------------+------------------------------------+----------------------+ |
15 | | - * | First init | - | x | - | 3 | - | |
| 15 | + * | First init | - | x | - | 3 | 67 | |
16 | 16 | * +--------------------------------------------------+------------------------------------+----------------------+ |
17 | | - * | First init | - | - | x | 4 | - | |
| 17 | + * | First init | - | - | x | 4 | 68 | |
18 | 18 | * +--------------------------------------------------+------------------------------------+----------------------+ |
19 | | - * | First init | x | x | - | 5 | - | |
| 19 | + * | First init | x | x | - | 5 | 69 | |
20 | 20 | * +--------------------------------------------------+------------------------------------+----------------------+ |
21 | | - * | First init | x | - | x | 6 | - | |
| 21 | + * | First init | x | - | x | 6 | 70 | |
22 | 22 | * +--------------------------------------------------+------------------------------------+----------------------+ |
23 | | - * | First init | - | x | x | 7 | - | |
| 23 | + * | First init | - | x | x | 7 | 71 | |
24 | 24 | * +--------------------------------------------------+------------------------------------+----------------------+ |
25 | | - * | First init | x | x | x | 8 | - | |
| 25 | + * | First init | x | x | x | 8 | 72 | |
26 | 26 | * +--------------------------------------------------+------------------------------------+----------------------+ |
27 | 27 | * | x | - | - | - | - | - | 17 | 33 | |
28 | 28 | * +--------------------------------------------------+------------------------------------+----------------------+ |
@@ -720,12 +720,12 @@ describe("Device Id tests during first init", ()=>{ |
720 | 720 | initMain("[CLY]_temp_id", false, undefined); |
721 | 721 | Countly.halt(); |
722 | 722 | initMain(undefined, false, undefined, true); |
723 | | - expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED); |
724 | | - validateSdkGeneratedId(Countly.get_device_id()); |
725 | | - validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED); |
| 723 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID); |
| 724 | + expect(Countly.get_device_id()).to.eq("[CLY]_temp_id"); |
| 725 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID); |
726 | 726 | Countly.begin_session(); |
727 | 727 | cy.fetch_local_request_queue().then((eq) => { |
728 | | - checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED); |
| 728 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID); |
729 | 729 | }); |
730 | 730 | }); |
731 | 731 | }); |
@@ -1080,4 +1080,104 @@ describe("Device Id tests during first init", ()=>{ |
1080 | 1080 | }); |
1081 | 1081 | }); |
1082 | 1082 | }); |
| 1083 | + |
| 1084 | + // testing first 8 tests with clear_stored_id flag set to true |
| 1085 | + it("65-SDK is initialized without custom device id, without offline mode, without utm device id", () => { |
| 1086 | + hp.haltAndClearStorage(() => { |
| 1087 | + initMain(undefined, false, undefined, true); |
| 1088 | + expect(Countly.get_device_id_type()).to.eq(Countly.DeviceIdType.SDK_GENERATED); |
| 1089 | + validateSdkGeneratedId(Countly.get_device_id()); |
| 1090 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED); |
| 1091 | + Countly.begin_session(); |
| 1092 | + cy.fetch_local_request_queue().then((eq) => { |
| 1093 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED); |
| 1094 | + }); |
| 1095 | + }); |
| 1096 | + }); |
| 1097 | + // we provide device id information sdk should use it |
| 1098 | + it("66-SDK is initialized with custom device id, without offline mode, without utm device id", () => { |
| 1099 | + hp.haltAndClearStorage(() => { |
| 1100 | + initMain("gerwutztreimer", false, undefined, true); |
| 1101 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1102 | + expect(Countly.get_device_id()).to.eq("gerwutztreimer"); |
| 1103 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED); |
| 1104 | + Countly.begin_session(); |
| 1105 | + cy.fetch_local_request_queue().then((eq) => { |
| 1106 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED); |
| 1107 | + }); |
| 1108 | + }); |
| 1109 | + }); |
| 1110 | + // we provide no device id information sdk should generate the id |
| 1111 | + it("67-SDK is initialized without custom device id, with offline mode, without utm device id", () => { |
| 1112 | + hp.haltAndClearStorage(() => { |
| 1113 | + initMain(undefined, true, undefined, true); |
| 1114 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID); |
| 1115 | + expect(Countly.get_device_id()).to.eq("[CLY]_temp_id"); |
| 1116 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID); |
| 1117 | + Countly.begin_session(); |
| 1118 | + cy.fetch_local_request_queue().then((eq) => { |
| 1119 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID); |
| 1120 | + }); |
| 1121 | + }); |
| 1122 | + }); |
| 1123 | + it("68-SDK is initialized without custom device id, without offline mode, with utm device id", () => { |
| 1124 | + hp.haltAndClearStorage(() => { |
| 1125 | + initMain(undefined, false, "?cly_device_id=abab", true); |
| 1126 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1127 | + expect(Countly.get_device_id()).to.eq("abab"); |
| 1128 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1129 | + Countly.begin_session(); |
| 1130 | + cy.fetch_local_request_queue().then((eq) => { |
| 1131 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1132 | + }); |
| 1133 | + }); |
| 1134 | + }); |
| 1135 | + it("69-SDK is initialized with custom device id, with offline mode, without utm device id", () => { |
| 1136 | + hp.haltAndClearStorage(() => { |
| 1137 | + initMain("customID", true, undefined, true); |
| 1138 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1139 | + expect(Countly.get_device_id()).to.eq("customID"); |
| 1140 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED); |
| 1141 | + Countly.begin_session(); |
| 1142 | + cy.fetch_local_request_queue().then((eq) => { |
| 1143 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED); |
| 1144 | + }); |
| 1145 | + }); |
| 1146 | + }); |
| 1147 | + it("70-SDK is initialized with custom device id, without offline mode, with utm device id", () => { |
| 1148 | + hp.haltAndClearStorage(() => { |
| 1149 | + initMain("customID2", false, "?cly_device_id=someID", true); |
| 1150 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1151 | + expect(Countly.get_device_id()).to.eq("someID"); |
| 1152 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1153 | + Countly.begin_session(); |
| 1154 | + cy.fetch_local_request_queue().then((eq) => { |
| 1155 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1156 | + }); |
| 1157 | + }); |
| 1158 | + }); |
| 1159 | + it("71-SDK is initialized without custom device id, with offline mode, with utm device id", () => { |
| 1160 | + hp.haltAndClearStorage(() => { |
| 1161 | + initMain(undefined, true, "?cly_device_id=someID", true); |
| 1162 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1163 | + expect(Countly.get_device_id()).to.eq("someID"); |
| 1164 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1165 | + Countly.begin_session(); |
| 1166 | + cy.fetch_local_request_queue().then((eq) => { |
| 1167 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1168 | + }); |
| 1169 | + }); |
| 1170 | + }); |
| 1171 | + it("72-SDK is initialized with custom device id, with offline mode, with utm device id", () => { |
| 1172 | + hp.haltAndClearStorage(() => { |
| 1173 | + initMain("customID3", true, "?cly_device_id=someID2", true); |
| 1174 | + expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED); |
| 1175 | + expect(Countly.get_device_id()).to.eq("someID2"); |
| 1176 | + validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1177 | + Countly.begin_session(); |
| 1178 | + cy.fetch_local_request_queue().then((eq) => { |
| 1179 | + checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED); |
| 1180 | + }); |
| 1181 | + }); |
| 1182 | + }); |
1083 | 1183 | }); |
0 commit comments