@@ -30,7 +30,7 @@ const dummyQueue = [
3030describe ( "Session tests " , ( ) => {
3131 it ( "Checks if session start, extension and ending works with a dummy queue" , ( ) => {
3232 hp . haltAndClearStorage ( ( ) => {
33- // initialize countly
33+ // initialize countly
3434 initMain ( ) ;
3535 // begin session
3636 Countly . begin_session ( ) ;
@@ -50,7 +50,7 @@ describe("Session tests ", () => {
5050 } ) ;
5151 it ( "Checks if session start, extension and ending works" , ( ) => {
5252 hp . haltAndClearStorage ( ( ) => {
53- // initialize countly
53+ // initialize countly
5454 initMain ( ) ;
5555 // begin session
5656 Countly . begin_session ( ) ;
@@ -97,9 +97,7 @@ describe("Browser session tests, auto", () => {
9797describe ( "Browser session tests, manual 1" , ( ) => {
9898 it ( "Single sessions test with manual sessions" , ( ) => {
9999 cy . visit ( "./cypress/fixtures/session_test_manual_1.html?use_session_cookie=true" ) ;
100- cy . contains ( "Start" ) . click ( ) . wait ( waitTime ) ;
101- cy . contains ( "Event" ) . click ( ) . wait ( 300 ) ;
102- cy . contains ( "End" ) . click ( ) . wait ( 300 ) ;
100+ cy . wait ( waitTime + 1000 ) ;
103101 cy . visit ( "./cypress/fixtures/base.html" ) ;
104102 cy . fetch_local_request_queue ( app_key ) . then ( ( rq ) => {
105103 cy . log ( rq ) ;
@@ -109,10 +107,10 @@ describe("Browser session tests, manual 1", () => {
109107 cy . check_session ( rq [ 0 ] , undefined , undefined , app_key ) ;
110108 // third object of the queue should be about session extension, also input the expected duration
111109 cy . check_session ( rq [ 2 ] , 5 , undefined , app_key ) ;
112- // fourth object of the queue should be about event sent
113- cy . check_event ( JSON . parse ( rq [ 3 ] . events ) [ 0 ] , eventObj , undefined , false ) ;
114110 // fifth object of the queue should be about session extension, also input the expected duration
115- cy . check_session ( rq [ 4 ] , 1 , undefined , app_key ) ;
111+ cy . check_session ( rq [ 3 ] , 1 , undefined , app_key ) ;
112+ // fourth object of the queue should be about event sent
113+ cy . check_event ( JSON . parse ( rq [ 4 ] . events ) [ 0 ] , eventObj , undefined , false ) ;
116114 } ) ;
117115 } ) ;
118116} ) ;
@@ -160,12 +158,7 @@ describe("Browser session tests, auto, no cookie", () => {
160158describe ( "Browser session tests, manual 1, no cookie" , ( ) => {
161159 it ( "Single bounce test with manual sessions with no cookies" , ( ) => {
162160 cy . visit ( "./cypress/fixtures/session_test_manual_1.html" ) ;
163- cy . contains ( "Start" ) . click ( ) ;
164- cy . wait ( waitTime ) ;
165- cy . contains ( "Event" ) . click ( ) ;
166- cy . wait ( 300 ) ;
167- cy . contains ( "End" ) . click ( ) ;
168- cy . wait ( 300 ) ;
161+ cy . wait ( waitTime + 1000 ) ;
169162 cy . visit ( "./cypress/fixtures/base.html" ) ;
170163 cy . fetch_local_request_queue ( app_key ) . then ( ( rq ) => {
171164 cy . log ( rq ) ;
@@ -175,10 +168,10 @@ describe("Browser session tests, manual 1, no cookie", () => {
175168 cy . check_session ( rq [ 0 ] , undefined , undefined , app_key ) ;
176169 // third object of the queue should be about session extension, also input the expected duration
177170 cy . check_session ( rq [ 2 ] , 5 , undefined , app_key ) ;
178- // fourth object of the queue should be about event sent
179- cy . check_event ( JSON . parse ( rq [ 3 ] . events ) [ 0 ] , eventObj , undefined , false ) ;
180171 // fifth object of the queue should be about session extension, also input the expected duration
181- cy . check_session ( rq [ 4 ] , 1 , true , app_key ) ;
172+ cy . check_session ( rq [ 3 ] , 1 , true , app_key ) ;
173+ // fourth object of the queue should be about event sent
174+ cy . check_event ( JSON . parse ( rq [ 4 ] . events ) [ 0 ] , eventObj , undefined , false ) ;
182175 } ) ;
183176 } ) ;
184177} ) ;
@@ -205,7 +198,7 @@ describe("Browser session tests, manual 2, no cookie", () => {
205198describe ( "Check request related functions" , ( ) => {
206199 it ( "Check if prepareRequest forms a proper request object" , ( ) => {
207200 hp . haltAndClearStorage ( ( ) => {
208- // initialize countly
201+ // initialize countly
209202 initMain ( ) ;
210203 let reqObject = { } ;
211204 Countly . _internals . prepareRequest ( reqObject ) ;
@@ -215,7 +208,7 @@ describe("Check request related functions", () => {
215208 } ) ;
216209 it ( "Check if prepareRequest forms a proper request object from a bad one " , ( ) => {
217210 hp . haltAndClearStorage ( ( ) => {
218- // initialize countly
211+ // initialize countly
219212 initMain ( ) ;
220213 let reqObject = { app_key : null , device_id : null } ;
221214 Countly . _internals . prepareRequest ( reqObject ) ;
@@ -225,7 +218,7 @@ describe("Check request related functions", () => {
225218 } ) ;
226219 it ( "Check if prepareRequest forms a proper request object and not erase an extra value " , ( ) => {
227220 hp . haltAndClearStorage ( ( ) => {
228- // initialize countly
221+ // initialize countly
229222 initMain ( ) ;
230223 let reqObject = { extraKey : "value" } ;
231224 Countly . _internals . prepareRequest ( reqObject ) ;
0 commit comments