2023-03-21 12:03:26 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/ * *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Copyright  ( c )  Microsoft  Corporation . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Licensed  under  the  Apache  License ,  Version  2.0  ( the  "License" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  you  may  not  use  this  file  except  in  compliance  with  the  License . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  You  may  obtain  a  copy  of  the  License  at 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  http : //www.apache.org/licenses/LICENSE-2.0
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Unless  required  by  applicable  law  or  agreed  to  in  writing ,  software 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  distributed  under  the  License  is  distributed  on  an  "AS IS"  BASIS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  WITHOUT  WARRANTIES  OR  CONDITIONS  OF  ANY  KIND ,  either  express  or  implied . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  See  the  License  for  the  specific  language  governing  permissions  and 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  limitations  under  the  License . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 11:28:28 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  {  test ,  expect ,  retries  }  from  './ui-mode-fixtures' ;  
						 
					
						
							
								
									
										
										
										
											2023-03-21 12:03:26 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 11:28:28 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test . describe . configure ( {  mode :  'parallel' ,  retries  } ) ;  
						 
					
						
							
								
									
										
										
										
											2023-03-21 12:03:26 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-21 18:20:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test ( 'should print load errors' ,  async  ( {  runUITest  } )  = >  {  
						 
					
						
							
								
									
										
										
										
											2023-03-29 13:57:19 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-21 12:03:26 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    'a.test.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'syntax error' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Toggle output' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . getByTestId ( 'output' ) ) . toContainText ( ` Unexpected reserved word 'await' ` ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-03-21 18:20:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test ( 'should work after theme switch' ,  async  ( {  runUITest ,  writeFiles  } )  = >  {  
						 
					
						
							
								
									
										
										
										
											2023-03-29 13:57:19 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-21 18:20:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'a.test.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'syntax error' ,  async  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'Hello world 1' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Toggle output' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . getByTestId ( 'output' ) ) . toContainText ( ` Hello world 1 ` ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Toggle color mode' ) . click ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-02 21:59:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  await  writeFiles ( { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-21 18:20:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'a.test.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'syntax error' ,  async  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'Hello world 2' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . getByTestId ( 'output' ) ) . toContainText ( ` Hello world 2 ` ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-04-07 13:50:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test ( 'should print buffers' ,  async  ( {  runUITest  } )  = >  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'a.test.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  PassThrough  }  from  'stream' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'print' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  writable  =  new  PassThrough ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        writable . pipe ( process . stdout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  red  =  Buffer . from ( 'G1szMW1IRUxMTxtbMzlt' ,  'base64' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        writable . write ( red ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Toggle output' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-28 14:18:46 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  await  expect ( page . getByTestId ( 'output' ) ) . toContainText ( 'HELLO' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-07 13:50:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-07-10 18:36:28 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test ( 'should show console messages for test' ,  async  ( {  runUITest  } ,  testInfo )  = >  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'a.spec.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'print' ,  async  ( {  page  } )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  page . evaluate ( ( )  = >  console . log ( 'page message' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'node message' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  page . evaluate ( ( )  = >  console . error ( 'page error' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . error ( 'node error' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'Colors: \x1b[31mRED\x1b[0m \x1b[32mGREEN\x1b[0m' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'Console' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'print' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . locator ( '.console-tab .console-line-message' ) ) . toHaveText ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'page message' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'node message' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'page error' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'node error' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Colors: RED GREEN' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . locator ( '.console-tab .list-view-entry .codicon' ) ) . toHaveClass ( [ 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-21 16:05:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'codicon codicon-browser status-none' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'codicon codicon-file status-none' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'codicon codicon-browser status-error' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'codicon codicon-file status-error' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'codicon codicon-file status-none' , 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-10 18:36:28 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-01 09:09:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  await  expect . soft ( page . getByText ( 'RED' ,  {  exact : true  } ) ) . toHaveCSS ( 'color' ,  'rgb(205, 49, 49)' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect . soft ( page . getByText ( 'GREEN' ,  {  exact : true  } ) ) . toHaveCSS ( 'color' ,  'rgb(0, 188, 0)' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-10 18:36:28 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-08-19 16:13:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test ( 'should format console messages in page' ,  async  ( {  runUITest  } ,  testInfo )  = >  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'a.spec.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'print' ,  async  ( {  page  } )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-22 14:29:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        await  page . evaluate ( async  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-19 16:13:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          console . log ( 'Object %O' ,  {  a : 1  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          console . log ( 'Date %o' ,  new  Date ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          console . log ( 'Regex %o' ,  /a/ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          console . log ( 'Number %f' ,  - 0 ,  'one' ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          console . log ( 'Download the %cReact DevTools%c for a better development experience: %chttps://fb.me/react-devtools' ,  'font-weight:bold;color:red;outline:blue' ,  '' ,  'color: blue; text-decoration: underline' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          console . log ( 'Array' ,  'of' ,  'values' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-22 14:29:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          await  fetch ( 'http://localhost:9889' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-19 16:13:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'Console' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'print' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . locator ( '.console-tab .console-line-message' ) ) . toHaveText ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Object {a: 1}' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    /Date.*/ , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Regex /a/' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Number 0 one 2' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Download the React DevTools for a better development experience: https://fb.me/react-devtools' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'Array of values' , 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-22 14:29:35 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'Failed to load resource: net::ERR_CONNECTION_REFUSED' , 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-19 16:13:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  label  =  page . getByText ( 'React DevTools' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( label ) . toHaveCSS ( 'color' ,  'rgb(255, 0, 0)' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( label ) . toHaveCSS ( 'font-weight' ,  '700' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // blue should not be used, should inherit color red.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( label ) . toHaveCSS ( 'outline' ,  'rgb(255, 0, 0) none 0px' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  link  =  page . getByText ( 'https://fb.me/react-devtools' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( link ) . toHaveCSS ( 'color' ,  'rgb(0, 0, 255)' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( link ) . toHaveCSS ( 'text-decoration' ,  'none solid rgb(0, 0, 255)' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-08-21 10:59:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-31 14:44:26 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test ( 'should stream console messages live' ,  async  ( {  runUITest  } )  = >  {  
						 
					
						
							
								
									
										
										
										
											2023-08-21 10:59:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'a.spec.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'print' ,  async  ( {  page  } )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  page . setContent ( '<button>Click me</button>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  button  =  page . getByRole ( 'button' ,  {  name :  'Click me'  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  button . evaluate ( node  = >  node . addEventListener ( 'click' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-31 14:44:26 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          builtinSetTimeout ( ( )  = >  {  console . log ( 'I was clicked' ) ;  } ,  1000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-21 10:59:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-22 15:46:41 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        console . log ( 'I was logged' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-21 10:59:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        await  button . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  page . locator ( '#not-there' ) . waitFor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'Console' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'print' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . locator ( '.console-tab .console-line-message' ) ) . toHaveText ( [ 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-22 15:46:41 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'I was logged' , 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-21 10:59:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    'I was clicked' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Stop' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
									
										
										
										
											2023-08-31 17:34:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test ( 'should print beforeAll console messages once' ,  async  ( {  runUITest  } ,  testInfo )  = >  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  {  page  }  =  await  runUITest ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'a.spec.ts' :  ` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      import  {  test ,  expect  }  from  '@playwright/test' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test . beforeAll ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'before all log' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      test ( 'print' ,  ( { } )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( 'test log' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ` ,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByTitle ( 'Run all' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'Console' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  page . getByText ( 'print' ) . click ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . getByTestId ( 'status-line' ) ) . toHaveText ( '1/1 passed (100%)' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  await  expect ( page . locator ( '.console-tab .console-line-message' ) ) . toHaveText ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'before all log' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    'test log' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;