countly-sdk-web 22.2.2 → 22.2.3

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.
Files changed (91) hide show
  1. package/.eslintignore +17 -17
  2. package/.eslintrc.js +215 -215
  3. package/.github/dependabot.yml +20 -20
  4. package/.github/workflows/codeql-analysis.yml +71 -71
  5. package/.github/workflows/documentation.yml +24 -0
  6. package/.github/workflows/node.js.yml +25 -41
  7. package/CHANGELOG.md +241 -237
  8. package/LICENSE +19 -19
  9. package/README.md +86 -122
  10. package/SECURITY.md +3 -3
  11. package/bower.json +29 -29
  12. package/cypress/.eslintrc.js +22 -22
  13. package/cypress/fixtures/base.html +8 -0
  14. package/cypress/fixtures/scroll_test.html +60 -0
  15. package/cypress/fixtures/scroll_test_2.html +48 -0
  16. package/cypress/fixtures/scroll_test_3.html +72 -0
  17. package/cypress/fixtures/session_test_auto.html +51 -0
  18. package/cypress/fixtures/session_test_manual_1.html +58 -0
  19. package/cypress/fixtures/session_test_manual_2.html +54 -0
  20. package/cypress/fixtures/user_agent.html +20 -0
  21. package/cypress/integration/consents.js +165 -165
  22. package/cypress/integration/device_id.js +1085 -830
  23. package/cypress/integration/events.js +65 -65
  24. package/cypress/integration/heatmaps.js +52 -0
  25. package/cypress/integration/internal_limits.js +153 -153
  26. package/cypress/integration/reponse_validation.js +170 -170
  27. package/cypress/integration/sessions.js +196 -60
  28. package/cypress/integration/user_agent.js +63 -0
  29. package/cypress/integration/user_details.js +40 -40
  30. package/cypress/integration/utm.js +236 -236
  31. package/cypress/integration/views.js +62 -62
  32. package/cypress/plugins/index.js +22 -22
  33. package/cypress/support/commands.js +322 -298
  34. package/cypress/support/helper.js +59 -59
  35. package/cypress/support/index.js +2 -2
  36. package/cypress/support/integration_helper.js +17 -0
  37. package/cypress.json +3 -1
  38. package/examples/example_apm.html +51 -51
  39. package/examples/example_fb.html +50 -50
  40. package/examples/example_formdata.html +47 -47
  41. package/examples/example_ga_adapter.html +173 -173
  42. package/examples/example_gdpr.html +82 -82
  43. package/examples/example_internal_limits.html +184 -184
  44. package/examples/example_multiple_instances.html +52 -52
  45. package/examples/example_rating_widgets.html +80 -80
  46. package/examples/example_remote_config.html +38 -38
  47. package/examples/example_sync.html +36 -36
  48. package/examples/examples_feedback_widgets.html +81 -81
  49. package/examples/mpa/boomerang/boomerang-1.0.0.js +22871 -22871
  50. package/examples/mpa/boomerang/countly_boomerang.js +138 -138
  51. package/examples/mpa/index.html +816 -816
  52. package/examples/react/README.md +35 -35
  53. package/examples/react/package.json +37 -37
  54. package/examples/react/public/index.html +19 -19
  55. package/examples/react/public/manifest.json +25 -25
  56. package/examples/react/public/robots.txt +3 -3
  57. package/examples/react/src/App-WithEffect.js +33 -33
  58. package/examples/react/src/App-WithRouter.js +46 -46
  59. package/examples/react/src/App.test.js +9 -9
  60. package/examples/react/src/Components/Contact.js +28 -28
  61. package/examples/react/src/Components/Header.js +88 -88
  62. package/examples/react/src/Components/Home.js +23 -23
  63. package/examples/react/src/Components/Users.js +43 -43
  64. package/examples/react/src/Components/styles.css +25 -25
  65. package/examples/react/src/ErrorBoundary.js +28 -28
  66. package/examples/react/src/Location-WithEffect.js +27 -27
  67. package/examples/react/src/Location-WithRouter.js +23 -23
  68. package/examples/react/src/index.css +5 -5
  69. package/examples/react/src/index.js +68 -68
  70. package/examples/react/src/serviceWorker.js +141 -141
  71. package/examples/react/src/setupTests.js +5 -5
  72. package/examples/symbolication/.babelrc +11 -11
  73. package/examples/symbolication/.editorconfig +8 -8
  74. package/examples/symbolication/.yo-rc.json +53 -53
  75. package/examples/symbolication/README.md +33 -33
  76. package/examples/symbolication/package.json +22 -22
  77. package/examples/symbolication/src/index.js +47 -47
  78. package/examples/symbolication/static/index.html +21 -21
  79. package/examples/symbolication/webpack.config.js +27 -27
  80. package/generateDocs.sh +80 -79
  81. package/inch.json +6 -6
  82. package/jsdoc_conf.json +4 -2
  83. package/lib/countly.js +4625 -4416
  84. package/lib/countly.min.js +126 -117
  85. package/package.json +57 -57
  86. package/plugin/boomerang/boomerang.min.js +10 -10
  87. package/plugin/boomerang/countly_boomerang.js +150 -150
  88. package/plugin/ga_adapter/doc.md +73 -73
  89. package/plugin/ga_adapter/ga_adapter.js +451 -451
  90. package/webpack.config.js +12 -12
  91. package/countly-sdk-web-22.2.2.tgz +0 -0
@@ -1,830 +1,1085 @@
1
- /* eslint-disable cypress/no-unnecessary-waiting */
2
- /* eslint-disable require-jsdoc */
3
- /**
4
- * +--------------------------------------------------+------------------------------------+----------------------+
5
- * | SDK state at the end of the previous app session | Provided configuration during init | Action taken by SDK |
6
- * +--------------------------------------------------+------------------------------------+----------------------+
7
- * | Custom | SDK used a | Temp ID | Custom | Temporary | URL | Flag | flag |
8
- * | device ID | generated | mode was | device ID | device ID | | not | |
9
- * | was set | ID | enabled | provided | enabled | | set | set |
10
- * +--------------------------------------------------+------------------------------------+----------------------+
11
- * | First init | - | - | - | 1 | - |
12
- * +--------------------------------------------------+------------------------------------+----------------------+
13
- * | First init | x | - | - | 2 | - |
14
- * +--------------------------------------------------+------------------------------------+----------------------+
15
- * | First init | - | x | - | 3 | - |
16
- * +--------------------------------------------------+------------------------------------+----------------------+
17
- * | First init | - | - | x | 4 | - |
18
- * +--------------------------------------------------+------------------------------------+----------------------+
19
- * | First init | x | x | - | 5 | - |
20
- * +--------------------------------------------------+------------------------------------+----------------------+
21
- * | First init | x | - | x | 6 | - |
22
- * +--------------------------------------------------+------------------------------------+----------------------+
23
- * | First init | - | x | x | 7 | - |
24
- * +--------------------------------------------------+------------------------------------+----------------------+
25
- * | First init | x | x | x | 8 | - |
26
- * +--------------------------------------------------+------------------------------------+----------------------+
27
- * | x | - | - | - | - | - | 17 | 33 |
28
- * +--------------------------------------------------+------------------------------------+----------------------+
29
- * | x | - | - | x | - | - | 18 | 34 |
30
- * +--------------------------------------------------+------------------------------------+----------------------+
31
- * | x | - | - | - | x | - | 19 | 35 |
32
- * +--------------------------------------------------+------------------------------------+----------------------+
33
- * | x | - | - | - | - | x | 20 | 36 |
34
- * +--------------------------------------------------+------------------------------------+----------------------+
35
- * | x | - | - | x | x | - | 21 | 37 |
36
- * +--------------------------------------------------+------------------------------------+----------------------+
37
- * | x | - | - | x | - | x | 22 | 38 |
38
- * +--------------------------------------------------+------------------------------------+----------------------+
39
- * | x | - | - | - | x | x | 23 | 39 |
40
- * +--------------------------------------------------+------------------------------------+----------------------+
41
- * | x | - | - | x | x | x | 24 | 40 |
42
- * +--------------------------------------------------+------------------------------------+----------------------+
43
- * | - | - | x | - | - | - | 25 | 41 |
44
- * +--------------------------------------------------+------------------------------------+----------------------+
45
- * | - | - | x | x | - | - | 26 | 42 |
46
- * +--------------------------------------------------+------------------------------------+----------------------+
47
- * | - | - | x | - | x | - | 27 | 43 |
48
- * +--------------------------------------------------+------------------------------------+----------------------+
49
- * | - | - | x | - | - | x | 28 | 44 |
50
- * +--------------------------------------------------+------------------------------------+----------------------+
51
- * | - | - | x | x | x | - | 29 | 45 |
52
- * +--------------------------------------------------+------------------------------------+----------------------+
53
- * | - | - | x | x | - | x | 30 | 46 |
54
- * +--------------------------------------------------+------------------------------------+----------------------+
55
- * | - | - | x | - | x | x | 31 | 47 |
56
- * +--------------------------------------------------+------------------------------------+----------------------+
57
- * | - | - | x | x | x | x | 32 | 48 |
58
- * +--------------------------------------------------+------------------------------------+----------------------+
59
- * | Change ID and offline mode tests |
60
- * +--------------------------------------------------+------------------------------------+----------------------+
61
- * | First init | - | - | - | 9-10 | - |
62
- * +--------------------------------------------------+------------------------------------+----------------------+
63
- * | First init | x | - | - | 11-12 | - |
64
- * +--------------------------------------------------+------------------------------------+----------------------+
65
- * | First init | - | x | - | 13-14 | - |
66
- * +--------------------------------------------------+------------------------------------+----------------------+
67
- * | First init | - | - | x | 15-16 | - |
68
- * +--------------------------------------------------+------------------------------------+----------------------+
69
- */
70
-
71
- var Countly = require("../../lib/countly");
72
- var hp = require("../support/helper");
73
-
74
- function initMain(deviceId, offline, searchQuery, clear) {
75
- Countly.init({
76
- app_key: "YOUR_APP_KEY",
77
- url: "https://try.count.ly",
78
- device_id: deviceId,
79
- tests: true,
80
- debug: true,
81
- clear_stored_id: clear,
82
- getSearchQuery: function() {
83
- return searchQuery;
84
- },
85
- offline_mode: offline
86
- });
87
- }
88
- function validateSdkGeneratedId(providedDeviceId) {
89
- expect(providedDeviceId).to.exist;
90
- expect(providedDeviceId.length).to.eq(36);
91
- expect(Countly._internals.isUUID(providedDeviceId)).to.be.ok;
92
- }
93
- function validateInternalDeviceIdType(expectedType) {
94
- expect(expectedType).to.eq(Countly._internals.getInternalDeviceIdType());
95
- }
96
- function checkRequestsForT(queue, expectedInternalType) {
97
- for (var i = 0; i < queue.length; i++) {
98
- expect(queue[i].t).to.exist;
99
- expect(queue[i].t).to.eq(Countly._internals.getInternalDeviceIdType());
100
- expect(queue[i].t).to.eq(expectedInternalType);
101
- }
102
- }
103
-
104
-
105
- /**
106
- *device ID type:
107
- *0 - device ID was set by the developer during init
108
- *1 - device ID was auto generated by Countly
109
- *2 - device ID was temporarily given by Countly
110
- *3 - device ID was provided from location.search
111
- */
112
- var DeviceIdTypeInternalEnumsTest = {
113
- DEVELOPER_SUPPLIED: 0,
114
- SDK_GENERATED: 1,
115
- TEMPORARY_ID: 2,
116
- URL_PROVIDED: 3,
117
- };
118
- describe("Device Id tests during first init", ()=>{
119
- // sdk is initialized w/o custom device id, w/o offline mode, w/o utm device id
120
-
121
- // we provide no device id information sdk should generate the id
122
- it("1-SDK is initialized without custom device id, without offline mode, without utm device id", ()=>{
123
- hp.haltAndClearStorage(() => {
124
- initMain(undefined, false, undefined);
125
- expect(Countly.get_device_id_type()).to.eq(Countly.DeviceIdType.SDK_GENERATED);
126
- validateSdkGeneratedId(Countly.get_device_id());
127
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
128
- Countly.begin_session();
129
- cy.fetch_local_request_queue().then((eq) => {
130
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
131
- });
132
- });
133
- });
134
- // we provide device id information sdk should use it
135
- it("2-SDK is initialized with custom device id, without offline mode, without utm device id", ()=>{
136
- hp.haltAndClearStorage(() => {
137
- initMain("gerwutztreimer", false, undefined);
138
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
139
- expect(Countly.get_device_id()).to.eq("gerwutztreimer");
140
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
141
- Countly.begin_session();
142
- cy.fetch_local_request_queue().then((eq) => {
143
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
144
- });
145
- });
146
- });
147
- // we provide no device id information sdk should generate the id
148
- it("3-SDK is initialized without custom device id, with offline mode, without utm device id", ()=>{
149
- hp.haltAndClearStorage(() => {
150
- initMain(undefined, true, undefined);
151
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
152
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
153
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
154
- Countly.begin_session();
155
- cy.fetch_local_request_queue().then((eq) => {
156
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
157
- });
158
- });
159
- });
160
- it("4-SDK is initialized without custom device id, without offline mode, with utm device id", ()=>{
161
- hp.haltAndClearStorage(() => {
162
- initMain(undefined, false, "?cly_device_id=abab");
163
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
164
- expect(Countly.get_device_id()).to.eq("abab");
165
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
166
- Countly.begin_session();
167
- cy.fetch_local_request_queue().then((eq) => {
168
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
169
- });
170
- });
171
- });
172
- it("5-SDK is initialized with custom device id, with offline mode, without utm device id", ()=>{
173
- hp.haltAndClearStorage(() => {
174
- initMain("customID", true, undefined);
175
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
176
- expect(Countly.get_device_id()).to.eq("customID");
177
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
178
- Countly.begin_session();
179
- cy.fetch_local_request_queue().then((eq) => {
180
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
181
- });
182
- });
183
- });
184
- it("6-SDK is initialized with custom device id, without offline mode, with utm device id", ()=>{
185
- hp.haltAndClearStorage(() => {
186
- initMain("customID2", false, "?cly_device_id=someID");
187
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
188
- expect(Countly.get_device_id()).to.eq("someID");
189
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
190
- Countly.begin_session();
191
- cy.fetch_local_request_queue().then((eq) => {
192
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
193
- });
194
- });
195
- });
196
- it("7-SDK is initialized without custom device id, with offline mode, with utm device id", ()=>{
197
- hp.haltAndClearStorage(() => {
198
- initMain(undefined, true, "?cly_device_id=someID");
199
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
200
- expect(Countly.get_device_id()).to.eq("someID");
201
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
202
- Countly.begin_session();
203
- cy.fetch_local_request_queue().then((eq) => {
204
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
205
- });
206
- });
207
- });
208
- it("8-SDK is initialized with custom device id, with offline mode, with utm device id", ()=>{
209
- hp.haltAndClearStorage(() => {
210
- initMain("customID3", true, "?cly_device_id=someID2");
211
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
212
- expect(Countly.get_device_id()).to.eq("someID2");
213
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
214
- Countly.begin_session();
215
- cy.fetch_local_request_queue().then((eq) => {
216
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
217
- });
218
- });
219
- });
220
-
221
- // Here tests focus the device id change and offline mode
222
- // first pair
223
- it("9-SDK is initialized with no device id, not offline mode, not utm device id", ()=>{
224
- hp.haltAndClearStorage(() => {
225
- initMain(undefined, false, undefined);
226
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
227
- validateSdkGeneratedId(Countly.get_device_id());
228
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
229
- Countly.change_id("newID");
230
- Countly.begin_session();
231
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
232
- expect(Countly.get_device_id()).to.eq("newID");
233
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
234
- cy.fetch_local_request_queue().then((eq) => {
235
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
236
- });
237
- });
238
- });
239
- it("10-SDK is initialized with no device id, not offline mode, not utm device id, but then offline", ()=>{
240
- hp.haltAndClearStorage(() => {
241
- initMain(undefined, false, undefined);
242
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
243
- validateSdkGeneratedId(Countly.get_device_id());
244
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
245
- Countly.enable_offline_mode();
246
- Countly.change_id("newID");
247
- Countly.begin_session();
248
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
249
- expect(Countly.get_device_id()).to.eq("newID");
250
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
251
- cy.fetch_local_request_queue().then((eq) => {
252
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
253
- });
254
- });
255
- });
256
- // second pair
257
- it("11-SDK is initialized with user defined device id, not offline mode, not utm device id", ()=>{
258
- hp.haltAndClearStorage(() => {
259
- initMain("userID", false, undefined);
260
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
261
- expect(Countly.get_device_id()).to.eq("userID");
262
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
263
- Countly.change_id("newID");
264
- Countly.begin_session();
265
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
266
- expect(Countly.get_device_id()).to.eq("newID");
267
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
268
- cy.fetch_local_request_queue().then((eq) => {
269
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
270
- });
271
- });
272
- });
273
- it("12-SDK is initialized with user defined device id, not offline mode, not utm device id, but then offline", ()=>{
274
- hp.haltAndClearStorage(() => {
275
- initMain("userID", false, undefined);
276
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
277
- expect(Countly.get_device_id()).to.eq("userID");
278
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
279
- Countly.enable_offline_mode();
280
- Countly.change_id("newID");
281
- Countly.begin_session();
282
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
283
- expect(Countly.get_device_id()).to.eq("newID");
284
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
285
- cy.fetch_local_request_queue().then((eq) => {
286
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
287
- });
288
- });
289
- });
290
- // third pair
291
- it("13-SDK is initialized with no device id, not offline mode, with utm device id", ()=>{
292
- hp.haltAndClearStorage(() => {
293
- initMain(undefined, false, "?cly_device_id=abab");
294
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
295
- expect(Countly.get_device_id()).to.eq("abab");
296
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
297
- Countly.change_id("newID");
298
- Countly.begin_session();
299
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
300
- expect(Countly.get_device_id()).to.eq("newID");
301
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
302
- cy.fetch_local_request_queue().then((eq) => {
303
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
304
- });
305
- });
306
- });
307
- it("14-SDK is initialized with no device id, not offline mode, with utm device id, but then offline", ()=>{
308
- hp.haltAndClearStorage(() => {
309
- initMain(undefined, false, "?cly_device_id=abab");
310
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
311
- expect(Countly.get_device_id()).to.eq("abab");
312
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
313
- Countly.enable_offline_mode();
314
- Countly.change_id("newID");
315
- Countly.begin_session();
316
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
317
- expect(Countly.get_device_id()).to.eq("newID");
318
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
319
- cy.fetch_local_request_queue().then((eq) => {
320
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
321
- });
322
- });
323
- });
324
- // fourth pair
325
- it("15-SDK is initialized with no device id, with offline mode, no utm device id", ()=>{
326
- hp.haltAndClearStorage(() => {
327
- initMain(undefined, true, undefined);
328
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
329
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
330
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
331
- Countly.change_id("newID");
332
- Countly.begin_session();
333
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
334
- expect(Countly.get_device_id()).to.eq("newID");
335
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
336
- cy.fetch_local_request_queue().then((eq) => {
337
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
338
- });
339
- });
340
- });
341
- it("16-SDK is initialized with no device id, with offline mode, no utm device id, but then offline", ()=>{
342
- hp.haltAndClearStorage(() => {
343
- initMain(undefined, true, undefined);
344
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
345
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
346
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
347
- Countly.enable_offline_mode();
348
- Countly.change_id("newID");
349
- Countly.begin_session();
350
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
351
- expect(Countly.get_device_id()).to.eq("newID");
352
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
353
- cy.fetch_local_request_queue().then((eq) => {
354
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
355
- });
356
- });
357
- });
358
-
359
- // Auto generated or developer set device ID was present in the local storage before initialization
360
- it("17-Stored ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
361
- hp.haltAndClearStorage(() => {
362
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID")
363
- .setLocalStorage("YOUR_APP_KEY/cly_id_type", 3)
364
- .then(()=>{
365
- initMain(undefined, false, undefined);
366
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
367
- expect(Countly.get_device_id()).to.eq("storedID");
368
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
369
- Countly.begin_session();
370
- cy.fetch_local_request_queue().then((eq) => {
371
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
372
- });
373
- });
374
- });
375
- });
376
- it("18-Stored ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
377
- hp.haltAndClearStorage(() => {
378
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
379
- initMain("counterID", false, undefined);
380
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
381
- expect(Countly.get_device_id()).to.eq("storedID");
382
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
383
- Countly.begin_session();
384
- cy.fetch_local_request_queue().then((eq) => {
385
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
386
- });
387
- });
388
- });
389
- });
390
- it("19-Stored ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
391
- hp.haltAndClearStorage(() => {
392
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
393
- initMain(undefined, true, undefined);
394
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
395
- expect(Countly.get_device_id()).to.eq("storedID");
396
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
397
- Countly.begin_session();
398
- cy.fetch_local_request_queue().then((eq) => {
399
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
400
- });
401
- });
402
- });
403
- });
404
- it("20-Stored ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
405
- hp.haltAndClearStorage(() => {
406
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
407
- initMain(undefined, false, "?cly_device_id=abab");
408
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
409
- expect(Countly.get_device_id()).to.eq("storedID");
410
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
411
- Countly.begin_session();
412
- cy.fetch_local_request_queue().then((eq) => {
413
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
414
- });
415
- });
416
- });
417
- });
418
- it("21-Stored ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
419
- hp.haltAndClearStorage(() => {
420
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
421
- initMain("counterID", true, undefined);
422
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
423
- expect(Countly.get_device_id()).to.eq("storedID");
424
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
425
- Countly.begin_session();
426
- cy.fetch_local_request_queue().then((eq) => {
427
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
428
- });
429
- });
430
- });
431
- });
432
- it("22-Stored ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
433
- hp.haltAndClearStorage(() => {
434
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
435
- initMain("counterID", false, "?cly_device_id=abab");
436
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
437
- expect(Countly.get_device_id()).to.eq("storedID");
438
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
439
- Countly.begin_session();
440
- cy.fetch_local_request_queue().then((eq) => {
441
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
442
- });
443
- });
444
- });
445
- });
446
- it("23-Stored ID precedence, SDK is initialized no device id, offline mode, utm device id", ()=>{
447
- hp.haltAndClearStorage(() => {
448
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
449
- initMain(undefined, true, "?cly_device_id=abab");
450
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
451
- expect(Countly.get_device_id()).to.eq("storedID");
452
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
453
- Countly.begin_session();
454
- cy.fetch_local_request_queue().then((eq) => {
455
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
456
- });
457
- });
458
- });
459
- });
460
- it("24-Stored ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
461
- hp.haltAndClearStorage(() => {
462
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
463
- initMain("counterID", true, "?cly_device_id=abab");
464
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
465
- expect(Countly.get_device_id()).to.eq("storedID");
466
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
467
- Countly.begin_session();
468
- cy.fetch_local_request_queue().then((eq) => {
469
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
470
- });
471
- });
472
- });
473
- });
474
-
475
- // Temporary ID was present in the local storage before initialization
476
- it("25-Stored temp ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
477
- hp.haltAndClearStorage(() => {
478
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
479
- initMain(undefined, false, undefined);
480
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
481
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
482
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
483
- Countly.begin_session();
484
- cy.fetch_local_request_queue().then((eq) => {
485
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
486
- });
487
- });
488
- });
489
- });
490
- it("26-Stored temp ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
491
- hp.haltAndClearStorage(() => {
492
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
493
- initMain("counterID", false, undefined);
494
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
495
- expect(Countly.get_device_id()).to.eq("counterID");
496
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
497
- Countly.begin_session();
498
- cy.fetch_local_request_queue().then((eq) => {
499
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
500
- });
501
- });
502
- });
503
- });
504
- it("27-Stored temp ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
505
- hp.haltAndClearStorage(() => {
506
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
507
- initMain(undefined, true, undefined);
508
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
509
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
510
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
511
- Countly.begin_session();
512
- cy.fetch_local_request_queue().then((eq) => {
513
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
514
- });
515
- });
516
- });
517
- });
518
- it("28-Stored temp ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
519
- hp.haltAndClearStorage(() => {
520
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
521
- initMain(undefined, false, "?cly_device_id=abab");
522
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
523
- expect(Countly.get_device_id()).to.eq("abab");
524
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
525
- Countly.begin_session();
526
- cy.fetch_local_request_queue().then((eq) => {
527
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
528
- });
529
- });
530
- });
531
- });
532
- it("29-Stored temp ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
533
- hp.haltAndClearStorage(() => {
534
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
535
- .setLocalStorage("YOUR_APP_KEY/cly_id_type", 0)
536
- .then(()=>{
537
- initMain("counterID", true, undefined);
538
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
539
- expect(Countly.get_device_id()).to.eq("counterID");
540
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
541
- Countly.begin_session();
542
- cy.fetch_local_request_queue().then((eq) => {
543
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
544
- });
545
- });
546
- });
547
- });
548
- it("30-Stored temp ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
549
- hp.haltAndClearStorage(() => {
550
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
551
- .setLocalStorage("YOUR_APP_KEY/cly_id_type", 2)
552
- .then(()=>{
553
- initMain("counterID", false, "?cly_device_id=abab");
554
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
555
- expect(Countly.get_device_id()).to.eq("abab");
556
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
557
- Countly.begin_session();
558
- cy.fetch_local_request_queue().then((eq) => {
559
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
560
- });
561
- });
562
- });
563
- });
564
- it("31-Stored temp ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
565
- hp.haltAndClearStorage(() => {
566
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
567
- .setLocalStorage("YOUR_APP_KEY/cly_id_type", 2)
568
- .then(()=>{
569
- initMain(undefined, true, "?cly_device_id=abab");
570
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
571
- expect(Countly.get_device_id()).to.eq("abab");
572
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
573
- Countly.begin_session();
574
- cy.fetch_local_request_queue().then((eq) => {
575
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
576
- });
577
- });
578
- });
579
- });
580
- it("32-Stored temp ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
581
- hp.haltAndClearStorage(() => {
582
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
583
- .setLocalStorage("YOUR_APP_KEY/cly_id_type", 2)
584
- .then(()=>{
585
- initMain("counterID", true, "?cly_device_id=abab");
586
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
587
- expect(Countly.get_device_id()).to.eq("abab");
588
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
589
- Countly.begin_session();
590
- cy.fetch_local_request_queue().then((eq) => {
591
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
592
- });
593
- });
594
- });
595
- });
596
-
597
- // Same tests with clear device ID flag set to true
598
- // Auto generated or developer set device ID was present in the local storage before initialization
599
- it("33-Cleared ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
600
- hp.haltAndClearStorage(() => {
601
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
602
- initMain(undefined, false, undefined, true);
603
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
604
- validateSdkGeneratedId(Countly.get_device_id());
605
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
606
- Countly.begin_session();
607
- cy.fetch_local_request_queue().then((eq) => {
608
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
609
- });
610
- });
611
- });
612
- });
613
- it("34-Cleared ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
614
- hp.haltAndClearStorage(() => {
615
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
616
- initMain("counterID", false, undefined, true);
617
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
618
- expect(Countly.get_device_id()).to.eq("counterID");
619
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
620
- Countly.begin_session();
621
- cy.fetch_local_request_queue().then((eq) => {
622
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
623
- });
624
- });
625
- });
626
- });
627
- it("35-Cleared ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
628
- hp.haltAndClearStorage(() => {
629
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
630
- initMain(undefined, true, undefined, true);
631
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
632
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
633
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
634
- Countly.begin_session();
635
- cy.fetch_local_request_queue().then((eq) => {
636
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
637
- });
638
- });
639
- });
640
- });
641
- it("36-Cleared ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
642
- hp.haltAndClearStorage(() => {
643
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
644
- initMain(undefined, false, "?cly_device_id=abab", true);
645
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
646
- expect(Countly.get_device_id()).to.eq("abab");
647
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
648
- Countly.begin_session();
649
- cy.fetch_local_request_queue().then((eq) => {
650
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
651
- });
652
- });
653
- });
654
- });
655
- it("37-Cleared ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
656
- hp.haltAndClearStorage(() => {
657
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
658
- initMain("counterID", true, undefined, true);
659
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
660
- expect(Countly.get_device_id()).to.eq("counterID");
661
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
662
- Countly.begin_session();
663
- cy.fetch_local_request_queue().then((eq) => {
664
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
665
- });
666
- });
667
- });
668
- });
669
- it("38-Cleared ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
670
- hp.haltAndClearStorage(() => {
671
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
672
- initMain("counterID", false, "?cly_device_id=abab", true);
673
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
674
- expect(Countly.get_device_id()).to.eq("abab");
675
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
676
- Countly.begin_session();
677
- cy.fetch_local_request_queue().then((eq) => {
678
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
679
- });
680
- });
681
- });
682
- });
683
- it("39-Cleared ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
684
- hp.haltAndClearStorage(() => {
685
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
686
- initMain(undefined, true, "?cly_device_id=abab", true);
687
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
688
- expect(Countly.get_device_id()).to.eq("abab");
689
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
690
- Countly.begin_session();
691
- cy.fetch_local_request_queue().then((eq) => {
692
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
693
- });
694
- });
695
- });
696
- });
697
- it("40-Cleared ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
698
- hp.haltAndClearStorage(() => {
699
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "storedID").then(()=>{
700
- initMain("counterID", true, "?cly_device_id=abab", true);
701
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
702
- expect(Countly.get_device_id()).to.eq("abab");
703
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
704
- Countly.begin_session();
705
- cy.fetch_local_request_queue().then((eq) => {
706
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
707
- });
708
- });
709
- });
710
- });
711
-
712
- // Temporary ID was present in the local storage before initialization
713
- it("41-Cleared temp ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
714
- hp.haltAndClearStorage(() => {
715
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
716
- initMain(undefined, false, undefined, true);
717
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
718
- validateSdkGeneratedId(Countly.get_device_id());
719
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
720
- Countly.begin_session();
721
- cy.fetch_local_request_queue().then((eq) => {
722
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
723
- });
724
- });
725
- });
726
- });
727
- it("42-Cleared temp ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
728
- hp.haltAndClearStorage(() => {
729
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
730
- initMain("counterID", false, undefined, true);
731
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
732
- expect(Countly.get_device_id()).to.eq("counterID");
733
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
734
- Countly.begin_session();
735
- cy.fetch_local_request_queue().then((eq) => {
736
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
737
- });
738
- });
739
- });
740
- });
741
- it("43-Cleared temp ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
742
- hp.haltAndClearStorage(() => {
743
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
744
- initMain(undefined, true, undefined, true);
745
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
746
- expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
747
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
748
- Countly.begin_session();
749
- cy.fetch_local_request_queue().then((eq) => {
750
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
751
- });
752
- });
753
- });
754
- });
755
- it("44-Cleared temp ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
756
- hp.haltAndClearStorage(() => {
757
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id").then(()=>{
758
- initMain(undefined, false, "?cly_device_id=abab", true);
759
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
760
- expect(Countly.get_device_id()).to.eq("abab");
761
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
762
- Countly.begin_session();
763
- cy.fetch_local_request_queue().then((eq) => {
764
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
765
- });
766
- });
767
- });
768
- });
769
- it("45-Cleared temp ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
770
- hp.haltAndClearStorage(() => {
771
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
772
- .then(()=>{
773
- initMain("counterID", true, undefined, true);
774
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
775
- expect(Countly.get_device_id()).to.eq("counterID");
776
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
777
- Countly.begin_session();
778
- cy.fetch_local_request_queue().then((eq) => {
779
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
780
- });
781
- });
782
- });
783
- });
784
- it("46-Cleared temp ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
785
- hp.haltAndClearStorage(() => {
786
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
787
- .then(()=>{
788
- initMain("counterID", false, "?cly_device_id=abab", true);
789
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
790
- expect(Countly.get_device_id()).to.eq("abab");
791
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
792
- Countly.begin_session();
793
- cy.fetch_local_request_queue().then((eq) => {
794
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
795
- });
796
- });
797
- });
798
- });
799
- it("47-Cleared temp ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
800
- hp.haltAndClearStorage(() => {
801
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
802
- .then(()=>{
803
- initMain(undefined, true, "?cly_device_id=abab", true);
804
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
805
- expect(Countly.get_device_id()).to.eq("abab");
806
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
807
- Countly.begin_session();
808
- cy.fetch_local_request_queue().then((eq) => {
809
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
810
- });
811
- });
812
- });
813
- });
814
- it("48-Cleared temp ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
815
- hp.haltAndClearStorage(() => {
816
- cy.setLocalStorage("YOUR_APP_KEY/cly_id", "[CLY]_temp_id")
817
- .then(()=>{
818
- initMain("counterID", true, "?cly_device_id=abab", true);
819
- expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
820
- expect(Countly.get_device_id()).to.eq("abab");
821
- validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
822
- Countly.begin_session();
823
- cy.fetch_local_request_queue().then((eq) => {
824
- checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
825
- });
826
- });
827
- });
828
- });
829
- });
830
-
1
+ /* eslint-disable cypress/no-unnecessary-waiting */
2
+ /* eslint-disable require-jsdoc */
3
+ /**
4
+ * +--------------------------------------------------+------------------------------------+----------------------+
5
+ * | SDK state at the end of the previous app session | Provided configuration during init | Action taken by SDK |
6
+ * +--------------------------------------------------+------------------------------------+----------------------+
7
+ * | Custom | SDK used a | Temp ID | Custom | Temporary | URL | Flag | flag |
8
+ * | device ID | generated | mode was | device ID | device ID | | not | |
9
+ * | was set | ID | enabled | provided | enabled | | set | set |
10
+ * +--------------------------------------------------+------------------------------------+----------------------+
11
+ * | First init | - | - | - | 1 | - |
12
+ * +--------------------------------------------------+------------------------------------+----------------------+
13
+ * | First init | x | - | - | 2 | - |
14
+ * +--------------------------------------------------+------------------------------------+----------------------+
15
+ * | First init | - | x | - | 3 | - |
16
+ * +--------------------------------------------------+------------------------------------+----------------------+
17
+ * | First init | - | - | x | 4 | - |
18
+ * +--------------------------------------------------+------------------------------------+----------------------+
19
+ * | First init | x | x | - | 5 | - |
20
+ * +--------------------------------------------------+------------------------------------+----------------------+
21
+ * | First init | x | - | x | 6 | - |
22
+ * +--------------------------------------------------+------------------------------------+----------------------+
23
+ * | First init | - | x | x | 7 | - |
24
+ * +--------------------------------------------------+------------------------------------+----------------------+
25
+ * | First init | x | x | x | 8 | - |
26
+ * +--------------------------------------------------+------------------------------------+----------------------+
27
+ * | x | - | - | - | - | - | 17 | 33 |
28
+ * +--------------------------------------------------+------------------------------------+----------------------+
29
+ * | x | - | - | x | - | - | 18 | 34 |
30
+ * +--------------------------------------------------+------------------------------------+----------------------+
31
+ * | x | - | - | - | x | - | 19 | 35 |
32
+ * +--------------------------------------------------+------------------------------------+----------------------+
33
+ * | x | - | - | - | - | x | 20 | 36 |
34
+ * +--------------------------------------------------+------------------------------------+----------------------+
35
+ * | x | - | - | x | x | - | 21 | 37 |
36
+ * +--------------------------------------------------+------------------------------------+----------------------+
37
+ * | x | - | - | x | - | x | 22 | 38 |
38
+ * +--------------------------------------------------+------------------------------------+----------------------+
39
+ * | x | - | - | - | x | x | 23 | 39 |
40
+ * +--------------------------------------------------+------------------------------------+----------------------+
41
+ * | x | - | - | x | x | x | 24 | 40 |
42
+ * +--------------------------------------------------+------------------------------------+----------------------+
43
+ * | - | - | x | - | - | - | 25 | 41 |
44
+ * +--------------------------------------------------+------------------------------------+----------------------+
45
+ * | - | - | x | x | - | - | 26 | 42 |
46
+ * +--------------------------------------------------+------------------------------------+----------------------+
47
+ * | - | - | x | - | x | - | 27 | 43 |
48
+ * +--------------------------------------------------+------------------------------------+----------------------+
49
+ * | - | - | x | - | - | x | 28 | 44 |
50
+ * +--------------------------------------------------+------------------------------------+----------------------+
51
+ * | - | - | x | x | x | - | 29 | 45 |
52
+ * +--------------------------------------------------+------------------------------------+----------------------+
53
+ * | - | - | x | x | - | x | 30 | 46 |
54
+ * +--------------------------------------------------+------------------------------------+----------------------+
55
+ * | - | - | x | - | x | x | 31 | 47 |
56
+ * +--------------------------------------------------+------------------------------------+----------------------+
57
+ * | - | - | x | x | x | x | 32 | 48 |
58
+ * +--------------------------------------------------+------------------------------------+----------------------+
59
+ * | - | x | - | - | - | - | 49 | 57 |
60
+ * +--------------------------------------------------+------------------------------------+----------------------+
61
+ * | - | x | - | x | - | - | 50 | 58 |
62
+ * +--------------------------------------------------+------------------------------------+----------------------+
63
+ * | - | x | - | - | x | - | 51 | 59 |
64
+ * +--------------------------------------------------+------------------------------------+----------------------+
65
+ * | - | x | - | - | - | x | 52 | 60 |
66
+ * +--------------------------------------------------+------------------------------------+----------------------+
67
+ * | - | x | - | x | x | - | 53 | 61 |
68
+ * +--------------------------------------------------+------------------------------------+----------------------+
69
+ * | - | x | - | x | - | x | 54 | 62 |
70
+ * +--------------------------------------------------+------------------------------------+----------------------+
71
+ * | - | x | - | - | x | x | 55 | 63 |
72
+ * +--------------------------------------------------+------------------------------------+----------------------+
73
+ * | - | x | - | x | x | x | 56 | 64 |
74
+ * +--------------------------------------------------+------------------------------------+----------------------+
75
+ * | Change ID and offline mode tests |
76
+ * +--------------------------------------------------+------------------------------------+----------------------+
77
+ * | First init | - | - | - | 9-10 | - |
78
+ * +--------------------------------------------------+------------------------------------+----------------------+
79
+ * | First init | x | - | - | 11-12 | - |
80
+ * +--------------------------------------------------+------------------------------------+----------------------+
81
+ * | First init | - | x | - | 13-14 | - |
82
+ * +--------------------------------------------------+------------------------------------+----------------------+
83
+ * | First init | - | - | x | 15-16 | - |
84
+ * +--------------------------------------------------+------------------------------------+----------------------+
85
+ */
86
+
87
+ var Countly = require("../../lib/countly");
88
+ var hp = require("../support/helper");
89
+
90
+ function initMain(deviceId, offline, searchQuery, clear) {
91
+ Countly.init({
92
+ app_key: "YOUR_APP_KEY",
93
+ url: "https://try.count.ly",
94
+ device_id: deviceId,
95
+ test_mode: true,
96
+ debug: true,
97
+ clear_stored_id: clear,
98
+ getSearchQuery: function() {
99
+ return searchQuery;
100
+ },
101
+ offline_mode: offline
102
+ });
103
+ }
104
+ function validateSdkGeneratedId(providedDeviceId) {
105
+ expect(providedDeviceId).to.exist;
106
+ expect(providedDeviceId.length).to.eq(36);
107
+ expect(Countly._internals.isUUID(providedDeviceId)).to.be.ok;
108
+ }
109
+ function validateInternalDeviceIdType(expectedType) {
110
+ expect(expectedType).to.eq(Countly._internals.getInternalDeviceIdType());
111
+ }
112
+ function checkRequestsForT(queue, expectedInternalType) {
113
+ for (var i = 0; i < queue.length; i++) {
114
+ expect(queue[i].t).to.exist;
115
+ expect(queue[i].t).to.eq(Countly._internals.getInternalDeviceIdType());
116
+ expect(queue[i].t).to.eq(expectedInternalType);
117
+ }
118
+ }
119
+
120
+
121
+ /**
122
+ *device ID type:
123
+ *0 - device ID was set by the developer during init
124
+ *1 - device ID was auto generated by Countly
125
+ *2 - device ID was temporarily given by Countly
126
+ *3 - device ID was provided from location.search
127
+ */
128
+ var DeviceIdTypeInternalEnumsTest = {
129
+ DEVELOPER_SUPPLIED: 0,
130
+ SDK_GENERATED: 1,
131
+ TEMPORARY_ID: 2,
132
+ URL_PROVIDED: 3,
133
+ };
134
+ describe("Device Id tests during first init", ()=>{
135
+ // sdk is initialized w/o custom device id, w/o offline mode, w/o utm device id
136
+
137
+ // we provide no device id information sdk should generate the id
138
+ it("1-SDK is initialized without custom device id, without offline mode, without utm device id", ()=>{
139
+ hp.haltAndClearStorage(() => {
140
+ initMain(undefined, false, undefined);
141
+ expect(Countly.get_device_id_type()).to.eq(Countly.DeviceIdType.SDK_GENERATED);
142
+ validateSdkGeneratedId(Countly.get_device_id());
143
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
144
+ Countly.begin_session();
145
+ cy.fetch_local_request_queue().then((eq) => {
146
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
147
+ });
148
+ });
149
+ });
150
+ // we provide device id information sdk should use it
151
+ it("2-SDK is initialized with custom device id, without offline mode, without utm device id", ()=>{
152
+ hp.haltAndClearStorage(() => {
153
+ initMain("gerwutztreimer", false, undefined);
154
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
155
+ expect(Countly.get_device_id()).to.eq("gerwutztreimer");
156
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
157
+ Countly.begin_session();
158
+ cy.fetch_local_request_queue().then((eq) => {
159
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
160
+ });
161
+ });
162
+ });
163
+ // we provide no device id information sdk should generate the id
164
+ it("3-SDK is initialized without custom device id, with offline mode, without utm device id", ()=>{
165
+ hp.haltAndClearStorage(() => {
166
+ initMain(undefined, true, undefined);
167
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
168
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
169
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
170
+ Countly.begin_session();
171
+ cy.fetch_local_request_queue().then((eq) => {
172
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
173
+ });
174
+ });
175
+ });
176
+ it("4-SDK is initialized without custom device id, without offline mode, with utm device id", ()=>{
177
+ hp.haltAndClearStorage(() => {
178
+ initMain(undefined, false, "?cly_device_id=abab");
179
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
180
+ expect(Countly.get_device_id()).to.eq("abab");
181
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
182
+ Countly.begin_session();
183
+ cy.fetch_local_request_queue().then((eq) => {
184
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
185
+ });
186
+ });
187
+ });
188
+ it("5-SDK is initialized with custom device id, with offline mode, without utm device id", ()=>{
189
+ hp.haltAndClearStorage(() => {
190
+ initMain("customID", true, undefined);
191
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
192
+ expect(Countly.get_device_id()).to.eq("customID");
193
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
194
+ Countly.begin_session();
195
+ cy.fetch_local_request_queue().then((eq) => {
196
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
197
+ });
198
+ });
199
+ });
200
+ it("6-SDK is initialized with custom device id, without offline mode, with utm device id", ()=>{
201
+ hp.haltAndClearStorage(() => {
202
+ initMain("customID2", false, "?cly_device_id=someID");
203
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
204
+ expect(Countly.get_device_id()).to.eq("someID");
205
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
206
+ Countly.begin_session();
207
+ cy.fetch_local_request_queue().then((eq) => {
208
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
209
+ });
210
+ });
211
+ });
212
+ it("7-SDK is initialized without custom device id, with offline mode, with utm device id", ()=>{
213
+ hp.haltAndClearStorage(() => {
214
+ initMain(undefined, true, "?cly_device_id=someID");
215
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
216
+ expect(Countly.get_device_id()).to.eq("someID");
217
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
218
+ Countly.begin_session();
219
+ cy.fetch_local_request_queue().then((eq) => {
220
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
221
+ });
222
+ });
223
+ });
224
+ it("8-SDK is initialized with custom device id, with offline mode, with utm device id", ()=>{
225
+ hp.haltAndClearStorage(() => {
226
+ initMain("customID3", true, "?cly_device_id=someID2");
227
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
228
+ expect(Countly.get_device_id()).to.eq("someID2");
229
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
230
+ Countly.begin_session();
231
+ cy.fetch_local_request_queue().then((eq) => {
232
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
233
+ });
234
+ });
235
+ });
236
+
237
+ // Here tests focus the device id change and offline mode
238
+ // first pair
239
+ it("9-SDK is initialized with no device id, not offline mode, not utm device id", ()=>{
240
+ hp.haltAndClearStorage(() => {
241
+ initMain(undefined, false, undefined);
242
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
243
+ validateSdkGeneratedId(Countly.get_device_id());
244
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
245
+ Countly.change_id("newID");
246
+ Countly.begin_session();
247
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
248
+ expect(Countly.get_device_id()).to.eq("newID");
249
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
250
+ cy.fetch_local_request_queue().then((eq) => {
251
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
252
+ });
253
+ });
254
+ });
255
+ it("10-SDK is initialized with no device id, not offline mode, not utm device id, but then offline", ()=>{
256
+ hp.haltAndClearStorage(() => {
257
+ initMain(undefined, false, undefined);
258
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
259
+ validateSdkGeneratedId(Countly.get_device_id());
260
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
261
+ Countly.enable_offline_mode();
262
+ Countly.change_id("newID");
263
+ Countly.begin_session();
264
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
265
+ expect(Countly.get_device_id()).to.eq("newID");
266
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
267
+ cy.fetch_local_request_queue().then((eq) => {
268
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
269
+ });
270
+ });
271
+ });
272
+ // second pair
273
+ it("11-SDK is initialized with user defined device id, not offline mode, not utm device id", ()=>{
274
+ hp.haltAndClearStorage(() => {
275
+ initMain("userID", false, undefined);
276
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
277
+ expect(Countly.get_device_id()).to.eq("userID");
278
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
279
+ Countly.change_id("newID");
280
+ Countly.begin_session();
281
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
282
+ expect(Countly.get_device_id()).to.eq("newID");
283
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
284
+ cy.fetch_local_request_queue().then((eq) => {
285
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
286
+ });
287
+ });
288
+ });
289
+ it("12-SDK is initialized with user defined device id, not offline mode, not utm device id, but then offline", ()=>{
290
+ hp.haltAndClearStorage(() => {
291
+ initMain("userID", false, undefined);
292
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
293
+ expect(Countly.get_device_id()).to.eq("userID");
294
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
295
+ Countly.enable_offline_mode();
296
+ Countly.change_id("newID");
297
+ Countly.begin_session();
298
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
299
+ expect(Countly.get_device_id()).to.eq("newID");
300
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
301
+ cy.fetch_local_request_queue().then((eq) => {
302
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
303
+ });
304
+ });
305
+ });
306
+ // third pair
307
+ it("13-SDK is initialized with no device id, not offline mode, with utm device id", ()=>{
308
+ hp.haltAndClearStorage(() => {
309
+ initMain(undefined, false, "?cly_device_id=abab");
310
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
311
+ expect(Countly.get_device_id()).to.eq("abab");
312
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
313
+ Countly.change_id("newID");
314
+ Countly.begin_session();
315
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
316
+ expect(Countly.get_device_id()).to.eq("newID");
317
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
318
+ cy.fetch_local_request_queue().then((eq) => {
319
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
320
+ });
321
+ });
322
+ });
323
+ it("14-SDK is initialized with no device id, not offline mode, with utm device id, but then offline", ()=>{
324
+ hp.haltAndClearStorage(() => {
325
+ initMain(undefined, false, "?cly_device_id=abab");
326
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
327
+ expect(Countly.get_device_id()).to.eq("abab");
328
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
329
+ Countly.enable_offline_mode();
330
+ Countly.change_id("newID");
331
+ Countly.begin_session();
332
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
333
+ expect(Countly.get_device_id()).to.eq("newID");
334
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
335
+ cy.fetch_local_request_queue().then((eq) => {
336
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
337
+ });
338
+ });
339
+ });
340
+ // fourth pair
341
+ it("15-SDK is initialized with no device id, with offline mode, no utm device id", ()=>{
342
+ hp.haltAndClearStorage(() => {
343
+ initMain(undefined, true, undefined);
344
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
345
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
346
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
347
+ Countly.change_id("newID");
348
+ Countly.begin_session();
349
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
350
+ expect(Countly.get_device_id()).to.eq("newID");
351
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
352
+ cy.fetch_local_request_queue().then((eq) => {
353
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
354
+ });
355
+ });
356
+ });
357
+ it("16-SDK is initialized with no device id, with offline mode, no utm device id, but then offline", ()=>{
358
+ hp.haltAndClearStorage(() => {
359
+ initMain(undefined, true, undefined);
360
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
361
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
362
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
363
+ Countly.enable_offline_mode();
364
+ Countly.change_id("newID");
365
+ Countly.begin_session();
366
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
367
+ expect(Countly.get_device_id()).to.eq("newID");
368
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
369
+ cy.fetch_local_request_queue().then((eq) => {
370
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
371
+ });
372
+ });
373
+ });
374
+
375
+ // Auto generated or developer set device ID was present in the local storage before initialization
376
+ it("17-Stored ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
377
+ hp.haltAndClearStorage(() => {
378
+ initMain("storedID", false, undefined);
379
+ Countly.halt();
380
+ initMain(undefined, false, undefined);
381
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
382
+ expect(Countly.get_device_id()).to.eq("storedID");
383
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
384
+ Countly.begin_session();
385
+ cy.fetch_local_request_queue().then((eq) => {
386
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
387
+ });
388
+ });
389
+ });
390
+ it("18-Stored ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
391
+ hp.haltAndClearStorage(() => {
392
+ initMain("storedID", false, undefined);
393
+ Countly.halt();
394
+ initMain("counterID", false, undefined);
395
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
396
+ expect(Countly.get_device_id()).to.eq("storedID");
397
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
398
+ Countly.begin_session();
399
+ cy.fetch_local_request_queue().then((eq) => {
400
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
401
+ });
402
+ });
403
+ });
404
+ it("19-Stored ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
405
+ hp.haltAndClearStorage(() => {
406
+ initMain("storedID", false, undefined);
407
+ Countly.halt();
408
+ initMain(undefined, true, undefined);
409
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
410
+ expect(Countly.get_device_id()).to.eq("storedID");
411
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
412
+ Countly.begin_session();
413
+ cy.fetch_local_request_queue().then((eq) => {
414
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
415
+ });
416
+ });
417
+ });
418
+ it("20-Stored ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
419
+ hp.haltAndClearStorage(() => {
420
+ initMain("storedID", false, undefined);
421
+ Countly.halt();
422
+ initMain(undefined, false, "?cly_device_id=abab");
423
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
424
+ expect(Countly.get_device_id()).to.eq("storedID");
425
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
426
+ Countly.begin_session();
427
+ cy.fetch_local_request_queue().then((eq) => {
428
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
429
+ });
430
+ });
431
+ });
432
+ it("21-Stored ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
433
+ hp.haltAndClearStorage(() => {
434
+ initMain("storedID", false, undefined);
435
+ Countly.halt();
436
+ initMain("counterID", true, undefined);
437
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
438
+ expect(Countly.get_device_id()).to.eq("storedID");
439
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
440
+ Countly.begin_session();
441
+ cy.fetch_local_request_queue().then((eq) => {
442
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
443
+ });
444
+ });
445
+ });
446
+ it("22-Stored ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
447
+ hp.haltAndClearStorage(() => {
448
+ initMain("storedID", false, undefined);
449
+ Countly.halt();
450
+ initMain("counterID", false, "?cly_device_id=abab");
451
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
452
+ expect(Countly.get_device_id()).to.eq("storedID");
453
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
454
+ Countly.begin_session();
455
+ cy.fetch_local_request_queue().then((eq) => {
456
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
457
+ });
458
+ });
459
+ });
460
+ it("23-Stored ID precedence, SDK is initialized no device id, offline mode, utm device id", ()=>{
461
+ hp.haltAndClearStorage(() => {
462
+ initMain("storedID", false, undefined);
463
+ Countly.halt();
464
+ initMain(undefined, true, "?cly_device_id=abab");
465
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
466
+ expect(Countly.get_device_id()).to.eq("storedID");
467
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
468
+ Countly.begin_session();
469
+ cy.fetch_local_request_queue().then((eq) => {
470
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
471
+ });
472
+ });
473
+ });
474
+ it("24-Stored ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
475
+ hp.haltAndClearStorage(() => {
476
+ initMain("storedID", false, undefined);
477
+ Countly.halt();
478
+ initMain("counterID", true, "?cly_device_id=abab");
479
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
480
+ expect(Countly.get_device_id()).to.eq("storedID");
481
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
482
+ Countly.begin_session();
483
+ cy.fetch_local_request_queue().then((eq) => {
484
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
485
+ });
486
+ });
487
+ });
488
+
489
+ // Temporary ID was present in the local storage before initialization
490
+ it("25-Stored temp ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
491
+ hp.haltAndClearStorage(() => {
492
+ initMain("[CLY]_temp_id", false, undefined);
493
+ Countly.halt();
494
+ initMain(undefined, false, undefined);
495
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
496
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
497
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
498
+ Countly.begin_session();
499
+ cy.fetch_local_request_queue().then((eq) => {
500
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
501
+ });
502
+ });
503
+ });
504
+ it("26-Stored temp ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
505
+ hp.haltAndClearStorage(() => {
506
+ initMain("[CLY]_temp_id", false, undefined);
507
+ Countly.halt();
508
+ initMain("counterID", false, undefined);
509
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
510
+ expect(Countly.get_device_id()).to.eq("counterID");
511
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
512
+ Countly.begin_session();
513
+ cy.fetch_local_request_queue().then((eq) => {
514
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
515
+ });
516
+ });
517
+ });
518
+ it("27-Stored temp ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
519
+ hp.haltAndClearStorage(() => {
520
+ initMain("[CLY]_temp_id", false, undefined);
521
+ Countly.halt();
522
+ initMain(undefined, true, undefined);
523
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
524
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
525
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
526
+ Countly.begin_session();
527
+ cy.fetch_local_request_queue().then((eq) => {
528
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
529
+ });
530
+ });
531
+ });
532
+ it("28-Stored temp ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
533
+ hp.haltAndClearStorage(() => {
534
+ initMain("[CLY]_temp_id", false, undefined);
535
+ Countly.halt();
536
+ initMain(undefined, false, "?cly_device_id=abab");
537
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
538
+ expect(Countly.get_device_id()).to.eq("abab");
539
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
540
+ Countly.begin_session();
541
+ cy.fetch_local_request_queue().then((eq) => {
542
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
543
+ });
544
+ });
545
+ });
546
+ it("29-Stored temp ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
547
+ hp.haltAndClearStorage(() => {
548
+ initMain("[CLY]_temp_id", false, undefined);
549
+ Countly.halt();
550
+ initMain("counterID", true, undefined);
551
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
552
+ expect(Countly.get_device_id()).to.eq("counterID");
553
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
554
+ Countly.begin_session();
555
+ cy.fetch_local_request_queue().then((eq) => {
556
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
557
+ });
558
+ });
559
+ });
560
+ it("30-Stored temp ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
561
+ hp.haltAndClearStorage(() => {
562
+ initMain("[CLY]_temp_id", false, undefined);
563
+ Countly.halt();
564
+ initMain("counterID", false, "?cly_device_id=abab");
565
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
566
+ expect(Countly.get_device_id()).to.eq("abab");
567
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
568
+ Countly.begin_session();
569
+ cy.fetch_local_request_queue().then((eq) => {
570
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
571
+ });
572
+ });
573
+ });
574
+ it("31-Stored temp ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
575
+ hp.haltAndClearStorage(() => {
576
+ initMain("[CLY]_temp_id", false, undefined);
577
+ Countly.halt();
578
+ initMain(undefined, true, "?cly_device_id=abab");
579
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
580
+ expect(Countly.get_device_id()).to.eq("abab");
581
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
582
+ Countly.begin_session();
583
+ cy.fetch_local_request_queue().then((eq) => {
584
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
585
+ });
586
+ });
587
+ });
588
+ it("32-Stored temp ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
589
+ hp.haltAndClearStorage(() => {
590
+ initMain("[CLY]_temp_id", false, undefined);
591
+ Countly.halt();
592
+ initMain("counterID", true, "?cly_device_id=abab");
593
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
594
+ expect(Countly.get_device_id()).to.eq("abab");
595
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
596
+ Countly.begin_session();
597
+ cy.fetch_local_request_queue().then((eq) => {
598
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
599
+ });
600
+ });
601
+ });
602
+
603
+ // Same tests with clear device ID flag set to true
604
+ // Auto generated or developer set device ID was present in the local storage before initialization
605
+ it("33-Cleared ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
606
+ hp.haltAndClearStorage(() => {
607
+ initMain("storedID", false, undefined);
608
+ Countly.halt();
609
+ initMain(undefined, false, undefined, true);
610
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
611
+ validateSdkGeneratedId(Countly.get_device_id());
612
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
613
+ Countly.begin_session();
614
+ cy.fetch_local_request_queue().then((eq) => {
615
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
616
+ });
617
+ });
618
+ });
619
+ it("34-Cleared ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
620
+ hp.haltAndClearStorage(() => {
621
+ initMain("storedID", false, undefined);
622
+ Countly.halt();
623
+ initMain("counterID", false, undefined, true);
624
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
625
+ expect(Countly.get_device_id()).to.eq("counterID");
626
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
627
+ Countly.begin_session();
628
+ cy.fetch_local_request_queue().then((eq) => {
629
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
630
+ });
631
+ });
632
+ });
633
+ it("35-Cleared ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
634
+ hp.haltAndClearStorage(() => {
635
+ initMain("storedID", false, undefined);
636
+ Countly.halt();
637
+ initMain(undefined, true, undefined, true);
638
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
639
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
640
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
641
+ Countly.begin_session();
642
+ cy.fetch_local_request_queue().then((eq) => {
643
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
644
+ });
645
+ });
646
+ });
647
+ it("36-Cleared ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
648
+ hp.haltAndClearStorage(() => {
649
+ initMain("storedID", false, undefined);
650
+ Countly.halt();
651
+ initMain(undefined, false, "?cly_device_id=abab", true);
652
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
653
+ expect(Countly.get_device_id()).to.eq("abab");
654
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
655
+ Countly.begin_session();
656
+ cy.fetch_local_request_queue().then((eq) => {
657
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
658
+ });
659
+ });
660
+ });
661
+ it("37-Cleared ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
662
+ hp.haltAndClearStorage(() => {
663
+ initMain("storedID", false, undefined);
664
+ Countly.halt();
665
+ initMain("counterID", true, undefined, true);
666
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
667
+ expect(Countly.get_device_id()).to.eq("counterID");
668
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
669
+ Countly.begin_session();
670
+ cy.fetch_local_request_queue().then((eq) => {
671
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
672
+ });
673
+ });
674
+ });
675
+ it("38-Cleared ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
676
+ hp.haltAndClearStorage(() => {
677
+ initMain("storedID", false, undefined);
678
+ Countly.halt();
679
+ initMain("counterID", false, "?cly_device_id=abab", true);
680
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
681
+ expect(Countly.get_device_id()).to.eq("abab");
682
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
683
+ Countly.begin_session();
684
+ cy.fetch_local_request_queue().then((eq) => {
685
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
686
+ });
687
+ });
688
+ });
689
+ it("39-Cleared ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
690
+ hp.haltAndClearStorage(() => {
691
+ initMain("storedID", false, undefined);
692
+ Countly.halt();
693
+ initMain(undefined, true, "?cly_device_id=abab", true);
694
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
695
+ expect(Countly.get_device_id()).to.eq("abab");
696
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
697
+ Countly.begin_session();
698
+ cy.fetch_local_request_queue().then((eq) => {
699
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
700
+ });
701
+ });
702
+ });
703
+ it("40-Cleared ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
704
+ hp.haltAndClearStorage(() => {
705
+ initMain("storedID", false, undefined);
706
+ Countly.halt();
707
+ initMain("counterID", true, "?cly_device_id=abab", true);
708
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
709
+ expect(Countly.get_device_id()).to.eq("abab");
710
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
711
+ Countly.begin_session();
712
+ cy.fetch_local_request_queue().then((eq) => {
713
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
714
+ });
715
+ });
716
+ });
717
+
718
+ // Temporary ID was present in the local storage before initialization
719
+ it("41-Cleared temp ID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
720
+ hp.haltAndClearStorage(() => {
721
+ initMain("[CLY]_temp_id", false, undefined);
722
+ Countly.halt();
723
+ initMain(undefined, false, undefined, true);
724
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
725
+ validateSdkGeneratedId(Countly.get_device_id());
726
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
727
+ Countly.begin_session();
728
+ cy.fetch_local_request_queue().then((eq) => {
729
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
730
+ });
731
+ });
732
+ });
733
+ it("42-Cleared temp ID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
734
+ hp.haltAndClearStorage(() => {
735
+ initMain("[CLY]_temp_id", false, undefined);
736
+ Countly.halt();
737
+ initMain("counterID", false, undefined, true);
738
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
739
+ expect(Countly.get_device_id()).to.eq("counterID");
740
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
741
+ Countly.begin_session();
742
+ cy.fetch_local_request_queue().then((eq) => {
743
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
744
+ });
745
+ });
746
+ });
747
+ it("43-Cleared temp ID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
748
+ hp.haltAndClearStorage(() => {
749
+ initMain("[CLY]_temp_id", false, undefined);
750
+ Countly.halt();
751
+ initMain(undefined, true, undefined, true);
752
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
753
+ expect(Countly.get_device_id()).to.eq("[CLY]_temp_id");
754
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
755
+ Countly.begin_session();
756
+ cy.fetch_local_request_queue().then((eq) => {
757
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
758
+ });
759
+ });
760
+ });
761
+ it("44-Cleared temp ID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
762
+ hp.haltAndClearStorage(() => {
763
+ initMain("[CLY]_temp_id", false, undefined);
764
+ Countly.halt();
765
+ initMain(undefined, false, "?cly_device_id=abab", true);
766
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
767
+ expect(Countly.get_device_id()).to.eq("abab");
768
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
769
+ Countly.begin_session();
770
+ cy.fetch_local_request_queue().then((eq) => {
771
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
772
+ });
773
+ });
774
+ });
775
+ it("45-Cleared temp ID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
776
+ hp.haltAndClearStorage(() => {
777
+ initMain("[CLY]_temp_id", false, undefined);
778
+ Countly.halt();
779
+ initMain("counterID", true, undefined, true);
780
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
781
+ expect(Countly.get_device_id()).to.eq("counterID");
782
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
783
+ Countly.begin_session();
784
+ cy.fetch_local_request_queue().then((eq) => {
785
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
786
+ });
787
+ });
788
+ });
789
+ it("46-Cleared temp ID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
790
+ hp.haltAndClearStorage(() => {
791
+ initMain("[CLY]_temp_id", false, undefined);
792
+ Countly.halt();
793
+ initMain("counterID", false, "?cly_device_id=abab", true);
794
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
795
+ expect(Countly.get_device_id()).to.eq("abab");
796
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
797
+ Countly.begin_session();
798
+ cy.fetch_local_request_queue().then((eq) => {
799
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
800
+ });
801
+ });
802
+ });
803
+ it("47-Cleared temp ID precedence, SDK is initialized with no device id, offline mode, utm device id", ()=>{
804
+ hp.haltAndClearStorage(() => {
805
+ initMain("[CLY]_temp_id", false, undefined);
806
+ Countly.halt();
807
+ initMain(undefined, true, "?cly_device_id=abab", true);
808
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
809
+ expect(Countly.get_device_id()).to.eq("abab");
810
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
811
+ Countly.begin_session();
812
+ cy.fetch_local_request_queue().then((eq) => {
813
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
814
+ });
815
+ });
816
+ });
817
+ it("48-Cleared temp ID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
818
+ hp.haltAndClearStorage(() => {
819
+ initMain("[CLY]_temp_id", false, undefined);
820
+ Countly.halt();
821
+ initMain("counterID", true, "?cly_device_id=abab", true);
822
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
823
+ expect(Countly.get_device_id()).to.eq("abab");
824
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
825
+ Countly.begin_session();
826
+ cy.fetch_local_request_queue().then((eq) => {
827
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
828
+ });
829
+ });
830
+ });
831
+
832
+ // SDK generated ID was present prior the second init
833
+ it("49-Stored UUID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
834
+ hp.haltAndClearStorage(() => {
835
+ initMain(undefined, false, undefined);
836
+ var oldUUID = Countly.get_device_id();
837
+ Countly.halt();
838
+ initMain(undefined, false, undefined);
839
+ validateSdkGeneratedId(Countly.get_device_id());
840
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
841
+ expect(Countly.get_device_id()).to.eq(oldUUID);
842
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
843
+ Countly.begin_session();
844
+ cy.fetch_local_request_queue().then((eq) => {
845
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
846
+ });
847
+ });
848
+ });
849
+ it("50-Stored UUID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
850
+ hp.haltAndClearStorage(() => {
851
+ initMain(undefined, false, undefined);
852
+ var oldUUID = Countly.get_device_id();
853
+ Countly.halt();
854
+ initMain("counterID", false, undefined);
855
+ validateSdkGeneratedId(Countly.get_device_id());
856
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
857
+ expect(Countly.get_device_id()).to.eq(oldUUID);
858
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
859
+ Countly.begin_session();
860
+ cy.fetch_local_request_queue().then((eq) => {
861
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
862
+ });
863
+ });
864
+ });
865
+ it("51-Stored UUID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
866
+ hp.haltAndClearStorage(() => {
867
+ initMain(undefined, false, undefined);
868
+ var oldUUID = Countly.get_device_id();
869
+ Countly.halt();
870
+ initMain(undefined, true, undefined);
871
+ validateSdkGeneratedId(Countly.get_device_id());
872
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
873
+ expect(Countly.get_device_id()).to.eq(oldUUID);
874
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
875
+ Countly.begin_session();
876
+ cy.fetch_local_request_queue().then((eq) => {
877
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
878
+ });
879
+ });
880
+ });
881
+ it("52-Stored UUID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
882
+ hp.haltAndClearStorage(() => {
883
+ initMain(undefined, false, undefined);
884
+ var oldUUID = Countly.get_device_id();
885
+ Countly.halt();
886
+ initMain(undefined, false, "?cly_device_id=abab");
887
+ validateSdkGeneratedId(Countly.get_device_id());
888
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
889
+ expect(Countly.get_device_id()).to.eq(oldUUID);
890
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
891
+ Countly.begin_session();
892
+ cy.fetch_local_request_queue().then((eq) => {
893
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
894
+ });
895
+ });
896
+ });
897
+ it("53-Stored UUID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
898
+ hp.haltAndClearStorage(() => {
899
+ initMain(undefined, false, undefined);
900
+ var oldUUID = Countly.get_device_id();
901
+ Countly.halt();
902
+ initMain("counterID", true, undefined);
903
+ validateSdkGeneratedId(Countly.get_device_id());
904
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
905
+ expect(Countly.get_device_id()).to.eq(oldUUID);
906
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
907
+ Countly.begin_session();
908
+ cy.fetch_local_request_queue().then((eq) => {
909
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
910
+ });
911
+ });
912
+ });
913
+ it("54-Stored UUID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
914
+ hp.haltAndClearStorage(() => {
915
+ initMain(undefined, false, undefined);
916
+ var oldUUID = Countly.get_device_id();
917
+ Countly.halt();
918
+ initMain("counterID", false, "?cly_device_id=abab");
919
+ validateSdkGeneratedId(Countly.get_device_id());
920
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
921
+ expect(Countly.get_device_id()).to.eq(oldUUID);
922
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
923
+ Countly.begin_session();
924
+ cy.fetch_local_request_queue().then((eq) => {
925
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
926
+ });
927
+ });
928
+ });
929
+ it("55-Stored UUID precedence, SDK is initialized no device id, offline mode, utm device id", ()=>{
930
+ hp.haltAndClearStorage(() => {
931
+ initMain(undefined, false, undefined);
932
+ var oldUUID = Countly.get_device_id();
933
+ Countly.halt();
934
+ initMain(undefined, true, "?cly_device_id=abab");
935
+ validateSdkGeneratedId(Countly.get_device_id());
936
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
937
+ expect(Countly.get_device_id()).to.eq(oldUUID);
938
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
939
+ Countly.begin_session();
940
+ cy.fetch_local_request_queue().then((eq) => {
941
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
942
+ });
943
+ });
944
+ });
945
+ it("56-Stored UUID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
946
+ hp.haltAndClearStorage(() => {
947
+ initMain(undefined, false, undefined);
948
+ var oldUUID = Countly.get_device_id();
949
+ Countly.halt();
950
+ initMain("counterID", true, "?cly_device_id=abab");
951
+ validateSdkGeneratedId(Countly.get_device_id());
952
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
953
+ expect(Countly.get_device_id()).to.eq(oldUUID);
954
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
955
+ Countly.begin_session();
956
+ cy.fetch_local_request_queue().then((eq) => {
957
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
958
+ });
959
+ });
960
+ });
961
+
962
+ // SDK generated ID was present prior the second init (same tests with flag set to true)
963
+ it("57-Stored UUID precedence, SDK is initialized with no device id, not offline mode, no utm device id", ()=>{
964
+ hp.haltAndClearStorage(() => {
965
+ initMain(undefined, false, undefined);
966
+ var oldUUID = Countly.get_device_id();
967
+ Countly.halt();
968
+ initMain(undefined, false, undefined, true);
969
+ validateSdkGeneratedId(Countly.get_device_id());
970
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.SDK_GENERATED);
971
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
972
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
973
+ Countly.begin_session();
974
+ cy.fetch_local_request_queue().then((eq) => {
975
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.SDK_GENERATED);
976
+ });
977
+ });
978
+ });
979
+ it("58-Stored UUID precedence, SDK is initialized with device id, not offline mode, no utm device id", ()=>{
980
+ hp.haltAndClearStorage(() => {
981
+ initMain(undefined, false, undefined);
982
+ var oldUUID = Countly.get_device_id();
983
+ Countly.halt();
984
+ initMain("counterID", false, undefined, true);
985
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
986
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
987
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
988
+ Countly.begin_session();
989
+ cy.fetch_local_request_queue().then((eq) => {
990
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
991
+ });
992
+ });
993
+ });
994
+ it("59-Stored UUID precedence, SDK is initialized with no device id, offline mode, no utm device id", ()=>{
995
+ hp.haltAndClearStorage(() => {
996
+ initMain(undefined, false, undefined);
997
+ var oldUUID = Countly.get_device_id();
998
+ Countly.halt();
999
+ initMain(undefined, true, undefined, true);
1000
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.TEMPORARY_ID);
1001
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1002
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
1003
+ Countly.begin_session();
1004
+ cy.fetch_local_request_queue().then((eq) => {
1005
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.TEMPORARY_ID);
1006
+ });
1007
+ });
1008
+ });
1009
+ it("60-Stored UUID precedence, SDK is initialized with no device id, no offline mode, utm device id", ()=>{
1010
+ hp.haltAndClearStorage(() => {
1011
+ initMain(undefined, false, undefined);
1012
+ var oldUUID = Countly.get_device_id();
1013
+ Countly.halt();
1014
+ initMain(undefined, false, "?cly_device_id=abab", true);
1015
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
1016
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1017
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1018
+ Countly.begin_session();
1019
+ cy.fetch_local_request_queue().then((eq) => {
1020
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1021
+ });
1022
+ });
1023
+ });
1024
+ it("61-Stored UUID precedence, SDK is initialized with device id, offline mode, no utm device id", ()=>{
1025
+ hp.haltAndClearStorage(() => {
1026
+ initMain(undefined, false, undefined);
1027
+ var oldUUID = Countly.get_device_id();
1028
+ Countly.halt();
1029
+ initMain("counterID", true, undefined, true);
1030
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
1031
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1032
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
1033
+ Countly.begin_session();
1034
+ cy.fetch_local_request_queue().then((eq) => {
1035
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.DEVELOPER_SUPPLIED);
1036
+ });
1037
+ });
1038
+ });
1039
+ it("62-Stored UUID precedence, SDK is initialized with device id, no offline mode, utm device id", ()=>{
1040
+ hp.haltAndClearStorage(() => {
1041
+ initMain(undefined, false, undefined);
1042
+ var oldUUID = Countly.get_device_id();
1043
+ Countly.halt();
1044
+ initMain("counterID", false, "?cly_device_id=abab", true);
1045
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
1046
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1047
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1048
+ Countly.begin_session();
1049
+ cy.fetch_local_request_queue().then((eq) => {
1050
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1051
+ });
1052
+ });
1053
+ });
1054
+ it("63-Stored UUID precedence, SDK is initialized no device id, offline mode, utm device id", ()=>{
1055
+ hp.haltAndClearStorage(() => {
1056
+ initMain(undefined, false, undefined);
1057
+ var oldUUID = Countly.get_device_id();
1058
+ Countly.halt();
1059
+ initMain(undefined, true, "?cly_device_id=abab", true);
1060
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
1061
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1062
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1063
+ Countly.begin_session();
1064
+ cy.fetch_local_request_queue().then((eq) => {
1065
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1066
+ });
1067
+ });
1068
+ });
1069
+ it("64-Stored UUID precedence, SDK is initialized with device id, offline mode, utm device id", ()=>{
1070
+ hp.haltAndClearStorage(() => {
1071
+ initMain(undefined, false, undefined);
1072
+ var oldUUID = Countly.get_device_id();
1073
+ Countly.halt();
1074
+ initMain("counterID", true, "?cly_device_id=abab", true);
1075
+ expect(Countly.get_device_id_type()).to.equal(Countly.DeviceIdType.DEVELOPER_SUPPLIED);
1076
+ expect(Countly.get_device_id()).to.not.eq(oldUUID);
1077
+ validateInternalDeviceIdType(DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1078
+ Countly.begin_session();
1079
+ cy.fetch_local_request_queue().then((eq) => {
1080
+ checkRequestsForT(eq, DeviceIdTypeInternalEnumsTest.URL_PROVIDED);
1081
+ });
1082
+ });
1083
+ });
1084
+ });
1085
+