@@ -119,8 +119,8 @@ function createTargetServer(requests) {
119119 const url = new URL ( req . url , 'http://target.local' ) ;
120120 if ( url . pathname === '/' ) {
121121 res . writeHead ( 200 , { 'Content-Type' : 'text/html; charset=utf-8' } ) ;
122- res . end ( `<!doctype html><html><head><title>E2E Home</title></head><body>
123- <main><h1>E2E Home</h1><a id="next" href="/next">Next page</a></main>
122+ res . end ( `<!doctype html><html><head><title>E2E Home</title><link rel="stylesheet" href="/site.css">< /head><body>
123+ <main id="style-probe" class="root-stylesheet-probe" ><h1>E2E Home</h1><a id="next" href="/next">Next page</a></main>
124124 <script>
125125 window.__ua = navigator.userAgent;
126126 window.__platform = navigator.platform;
@@ -179,6 +179,11 @@ function createTargetServer(requests) {
179179 </body></html>` ) ;
180180 return ;
181181 }
182+ if ( url . pathname === '/site.css' ) {
183+ res . writeHead ( 200 , { 'Content-Type' : 'text/css; charset=utf-8' , 'Cache-Control' : 'no-store' } ) ;
184+ res . end ( `.root-stylesheet-probe{border-top:7px solid rgb(12, 34, 56); padding-left:13px}` ) ;
185+ return ;
186+ }
182187 if ( url . pathname === '/gtm.js' ) {
183188 res . writeHead ( 200 , { 'Content-Type' : 'text/javascript; charset=utf-8' , 'Cache-Control' : 'no-store' } ) ;
184189 res . end ( `window.__gtmFixture = {
@@ -570,6 +575,11 @@ test('browser traffic uses internal SOCKS5 mode and covers proxied runtime integ
570575 phase2Location : window . __phase2Location ,
571576 phase2DynamicFunction : window . __phase2DynamicFunction ,
572577 phase2EvalLocation : window . __phase2EvalLocation ,
578+ styleProbe : ( ( ) => {
579+ const el = document . getElementById ( 'style-probe' ) ;
580+ const cs = el && getComputedStyle ( el ) ;
581+ return cs && { borderTopWidth : cs . borderTopWidth , borderTopColor : cs . borderTopColor , paddingLeft : cs . paddingLeft } ;
582+ } ) ( ) ,
573583 } ) ) ;
574584 assert . equal ( home . title , 'E2E Home' ) ;
575585 assert . match ( home . hash , / ^ # k = / ) ;
@@ -591,6 +601,8 @@ test('browser traffic uses internal SOCKS5 mode and covers proxied runtime integ
591601 assert . deepEqual ( home . phase2Location , { href : `http://${ targetHost } :${ targetPort } /` , windowHref : `http://${ targetHost } :${ targetPort } /` } ) ;
592602 assert . equal ( home . phase2DynamicFunction , `http://${ targetHost } :${ targetPort } /` ) ;
593603 assert . equal ( home . phase2EvalLocation , `http://${ targetHost } :${ targetPort } /` ) ;
604+ assert . deepEqual ( home . styleProbe , { borderTopWidth : '7px' , borderTopColor : 'rgb(12, 34, 56)' , paddingLeft : '13px' } ) ;
605+ assert . ok ( requests . some ( r => r . url === '/site.css' && r . userAgent === TARGET_UA ) , `target requests: ${ JSON . stringify ( requests ) } ` ) ;
594606 assert . ok ( requests . some ( r => r . url === '/' && r . userAgent === TARGET_UA ) , `target requests: ${ JSON . stringify ( requests ) } ` ) ;
595607 await page . waitForFunction ( ( ) => window . __rewriteAdvanced && window . __rewriteAdvanced . wsMessage === 'echo:rewrite-script' , { timeout : 30000 } ) ;
596608 const rewriteAdvanced = await page . evaluate ( ( ) => window . __rewriteAdvanced ) ;
0 commit comments