1+ /* eslint-disable require-jsdoc */
2+ var Countly = require ( "../../Countly.js" ) ;
3+ var hp = require ( "../support/helper" ) ;
4+
5+ const c1 = [ 'sessions' , 'events' , 'views' , 'users' , 'scrolls' , 'clicks' ] ;
6+ const c2 = [ 'events' , 'users' , 'location' ] ;
7+
8+ describe ( "-" , ( ) => {
9+ it ( "-" , ( ) => {
10+ hp . haltAndClearStorage ( ( ) => {
11+ Countly . init ( {
12+ app_key : "YOUR_APP_KEY1" ,
13+ url : "https://your.domain.count.ly" ,
14+ namespace : "namespace1" ,
15+ clear_stored_id : true ,
16+ device_id : "test-device-id1" ,
17+ require_consent : true ,
18+ enable_orientation_tracking : false ,
19+ } ) ;
20+ Countly . add_consent ( c1 ) ;
21+ Countly . user_details ( { organization : "Test Organization1" , custom : { "Test User1" : "Test User1" } } ) ;
22+ Countly . track_sessions ( ) ;
23+ Countly . track_pageview ( ) ;
24+ Countly . track_clicks ( ) ;
25+ Countly . track_scrolls ( ) ;
26+ Countly . add_event ( {
27+ key : "test_event1" ,
28+ count : 1 ,
29+ segmentation : { test : "test1" } ,
30+ } ) ;
31+
32+ Countly . q . push ( [ "init" , {
33+ app_key : "YOUR_APP_KEY2" , //must have different APP key
34+ url : "https://your.domain.count.ly" ,
35+ namespace : "namespace2" ,
36+ clear_stored_id : true ,
37+ device_id : "test-device-id2" ,
38+ require_consent : true ,
39+ enable_orientation_tracking : false ,
40+ } ] )
41+ Countly . q . push ( [ "YOUR_APP_KEY2" , "add_consent" , c2 ] ) ;
42+ Countly . q . push ( [ "YOUR_APP_KEY2" , "user_details" , { organization : "Test Organization2" , custom : { "Test User2" : "Test User2" } } ] ) ;
43+ Countly . q . push ( [ "YOUR_APP_KEY2" , "track_sessions" ] ) ;
44+ Countly . q . push ( [ "YOUR_APP_KEY2" , "track_pageview" , undefined , undefined , { test : "test2" } ] ) ;
45+ Countly . q . push ( [ "YOUR_APP_KEY2" , "track_clicks" ] ) ;
46+ Countly . q . push ( [ "YOUR_APP_KEY2" , "track_scrolls" ] ) ;
47+ Countly . q . push ( [ "YOUR_APP_KEY2" , "add_event" , {
48+ key : "test_event2" ,
49+ count : 1 ,
50+ segmentation : { test : "test2" } ,
51+ } ] ) ;
52+
53+ cy . wait ( 1000 ) . then ( ( ) => {
54+ var queues = Countly . _internals . getLocalQueues ( ) ;
55+ var requests = Countly . _internals . testingGetRequests ( ) ;
56+ cy . log ( queues ) ;
57+ cy . log ( requests ) ;
58+ } ) ;
59+ } ) ;
60+ } ) ;
61+ } ) ;
0 commit comments