@@ -20,7 +20,7 @@ describe('integration', () => {
2020 expect ( isResponseOK ) . toBe ( true )
2121 } )
2222
23- it ( 'sends streamname and timestamp ' , async ( ) => {
23+ it ( 'sends streamname, timestamp, and apiVersion ' , async ( ) => {
2424 let postData
2525 await page . goto ( home )
2626 page . on ( 'request' , req => {
@@ -32,20 +32,25 @@ describe('integration', () => {
3232 }
3333 expect ( postData . stream ) . toMatch ( 'clickstream' )
3434 expect ( postData . data . timestamp ) . toBeGreaterThan ( 15e9 )
35+ expect ( postData . data . apiVersion ) . toMatch ( / v [ 0 - 9 ] + / )
3536 } , 10000 )
3637
37- it ( 'sends page context with url, title, and referrer ' , async ( ) => {
38+ it ( 'sends page context with url, title, ref, lang, ua ' , async ( ) => {
3839 let postData
3940 page . on ( 'request' , req => {
4041 if ( req . method ( ) === 'POST' ) postData = req . postData ( )
4142 } )
43+ const ua = "Iceweasel/001"
44+ await page . setUserAgent ( ua )
4245 await page . goto ( home )
4346 await page . click ( 'button#count-button' )
4447 postData = postData && JSON . parse ( postData )
4548 expect ( postData . data . context ) . toMatchObject ( {
4649 url : await page . url ( ) ,
4750 title : await page . title ( ) ,
4851 referrer : '' ,
52+ userAgent : ua ,
53+ language : expect . stringMatching ( 'en' ) ,
4954 } )
5055 // visit the other page
5156 await Promise . all ( [ page . waitForNavigation ( ) , page . click ( 'a' ) ] )
@@ -55,6 +60,8 @@ describe('integration', () => {
5560 url : await page . url ( ) ,
5661 title : await page . title ( ) ,
5762 referrer : expect . stringMatching ( SERVER_URL ) ,
63+ userAgent : ua ,
64+ language : expect . stringMatching ( 'en' ) ,
5865 } )
5966 } , 15000 )
6067
@@ -80,7 +87,7 @@ describe('integration', () => {
8087 for ( let i = 1 ; i <= 5 ; i += 1 ) {
8188 await page . click ( 'button#count-button' )
8289 postData = postData && JSON . parse ( postData )
83- expect ( postData . data . count ) . toEqual ( i )
90+ expect ( postData . data . event . count ) . toEqual ( i )
8491 }
8592 } , 12000 )
8693
0 commit comments