| 
				
			 | 
			
			
				@@ -10,19 +10,17 @@ function run() { 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				     startRecording(); 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				     const conf = release ? `release` : `debug`; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				12
			 | 
			
			
				     exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`); 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-  } catch (err) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+  } finally { 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				     stopRecording(); 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				16
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				17
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				18
			 | 
			
				18
			 | 
			
			
				 function startRecording() { 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				
			 | 
			
			
				-  const json = JSON.parse(exec.execSyncRead(`applesimutils --list --byName "iPhone SE"`)); 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				-  const deviceId = json[0].udid; 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				
			 | 
			
			
				-  exec.execAsync(`xcrun simctl bootstatus ${deviceId} && xcrun simctl io booted recordVideo --type=mp4 video.mp4`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+  const screenId = exec.execSyncRead(`ffmpeg -f avfoundation -list_devices true -i "" 2>&1 | grep "Capture screen 0" | sed -e "s/.*\\[//" -e "s/\\].*//"`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+  exec.execAsync(`ffmpeg -f avfoundation -i "${screenId}:none" out.avi`); 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				21
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				22
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				24
			 | 
			
				23
			 | 
			
			
				 function stopRecording() { 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-  const pid = exec.execSyncRead(`pgrep simctl`); 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-  exec.execSync(`kill -sigint ${pid}`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+  exec.execSync(`killall ffmpeg`); 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				25
			 | 
			
			
				   exec.execSync(`npm run release`); 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				26
			 | 
			
			
				 } 
			 |