@@ -24,9 +24,9 @@ import type { Log } from '../../packages/trace/src/har';
2424import { parseHar } from '../config/utils' ;
2525const { createHttp2Server } = require ( '../../packages/playwright-core/lib/utils' ) ;
2626
27- async function pageWithHar ( contextFactory : ( options ?: BrowserContextOptions ) => Promise < BrowserContext > , testInfo : any , options : { outputPath ?: string , proxy ?: BrowserContextOptions [ 'proxy' ] } & Partial < Pick < BrowserContextOptions [ 'recordHar' ] , 'content' | 'omitContent' | 'mode' > > = { } ) {
27+ async function pageWithHar ( contextFactory : ( options ?: BrowserContextOptions ) => Promise < BrowserContext > , testInfo : any , options : { outputPath ?: string } & Partial < Pick < BrowserContextOptions [ 'recordHar' ] , 'content' | 'omitContent' | 'mode' > > = { } ) {
2828 const harPath = testInfo . outputPath ( options . outputPath || 'test.har' ) ;
29- const context = await contextFactory ( { recordHar : { path : harPath , ...options } , ignoreHTTPSErrors : true , proxy : options . proxy } ) ;
29+ const context = await contextFactory ( { recordHar : { path : harPath , ...options } , ignoreHTTPSErrors : true } ) ;
3030 const page = await context . newPage ( ) ;
3131 return {
3232 page,
@@ -861,38 +861,6 @@ it('should respect minimal mode for API Requests', async ({ contextFactory, serv
861861 expect ( entry . response . bodySize ) . toBe ( - 1 ) ;
862862} ) ;
863863
864- it ( 'should include timings when using http proxy' , async ( { contextFactory, server, proxyServer } , testInfo ) => {
865- proxyServer . forwardTo ( server . PORT , { allowConnectRequests : true } ) ;
866- const { page, getLog } = await pageWithHar ( contextFactory , testInfo , { proxy : { server : `localhost:${ proxyServer . PORT } ` } } ) ;
867- const response = await page . request . get ( server . EMPTY_PAGE ) ;
868- expect ( proxyServer . connectHosts ) . toEqual ( [ `localhost:${ server . PORT } ` ] ) ;
869- await expect ( response ) . toBeOK ( ) ;
870- const log = await getLog ( ) ;
871- expect ( log . entries [ 0 ] . timings . connect ) . toBeGreaterThan ( 0 ) ;
872- } ) ;
873-
874- it ( 'should include timings when using socks proxy' , async ( { contextFactory, server, socksPort } , testInfo ) => {
875- const { page, getLog } = await pageWithHar ( contextFactory , testInfo , { proxy : { server : `socks5://localhost:${ socksPort } ` } } ) ;
876- const response = await page . request . get ( server . EMPTY_PAGE ) ;
877- expect ( await response . text ( ) ) . toContain ( 'Served by the SOCKS proxy' ) ;
878- await expect ( response ) . toBeOK ( ) ;
879- const log = await getLog ( ) ;
880- expect ( log . entries [ 0 ] . timings . connect ) . toBeGreaterThan ( 0 ) ;
881- } ) ;
882-
883- it ( 'should not have connect and dns timings when socket is reused' , async ( { contextFactory, server } , testInfo ) => {
884- const { page, getLog } = await pageWithHar ( contextFactory , testInfo ) ;
885- await page . request . get ( server . EMPTY_PAGE ) ;
886- await page . request . get ( server . EMPTY_PAGE ) ;
887-
888- const log = await getLog ( ) ;
889- expect ( log . entries ) . toHaveLength ( 2 ) ;
890- const request2 = log . entries [ 1 ] ;
891- expect . soft ( request2 . timings . connect ) . toBe ( - 1 ) ;
892- expect . soft ( request2 . timings . dns ) . toBe ( - 1 ) ;
893- expect . soft ( request2 . timings . blocked ) . toBeGreaterThan ( 0 ) ;
894- } ) ;
895-
896864it ( 'should include redirects from API request' , async ( { contextFactory, server } , testInfo ) => {
897865 server . setRedirect ( '/redirect-me' , '/simple.json' ) ;
898866 const { page, getLog } = await pageWithHar ( contextFactory , testInfo ) ;
0 commit comments