File tree Expand file tree Collapse file tree
packages/playwright-recorder/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,19 +162,27 @@ export async function recordPlaywright(
162162 headless : config . headless ,
163163 } ) ;
164164
165- if ( process . env . RECORD_REPLAY_VERBOSE ) {
166- // TODO: Always keep logs, and make them available if the recording failed.
167- const stderr = browserServer . process ( ) . stderr ;
168- stderr ?. addListener ( "data" , data => {
169- console . debug ( `[RUNTIME] ${ data } ` ) ;
170- } ) ;
171- }
165+ const stderr = browserServer . process ( ) . stderr ;
166+ stderr ?. addListener ( "data" , data => {
167+ console . debug ( `[RUNTIME] ${ data } ` ) ;
168+ } ) ;
172169
173170 const browser = await chromium . connect ( browserServer . wsEndpoint ( ) ) ;
174171 const context = await browser . newContext ( {
175172 ignoreHTTPSErrors : true ,
176173 } ) ;
177174 const page = await context . newPage ( ) ;
175+
176+ page . on ( "console" , msg => {
177+ console . log ( `[PAGE] ${ msg . type ( ) } : ${ msg . text ( ) } ` ) ;
178+ } ) ;
179+ page . on ( "pageerror" , error => {
180+ console . error ( `[PAGE ERROR] ${ error } ` ) ;
181+ } ) ;
182+ page . on ( "crash" , ( ) => {
183+ console . error ( `[PAGE CRASH]` ) ;
184+ } ) ;
185+
178186 try {
179187 return await script ( page , expect ) ;
180188 } finally {
You can’t perform that action at this time.
0 commit comments