mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	tools: Move screenshot captured message to Python.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							88c297dffe
						
					
				
				
					commit
					80e432b466
				
			@@ -29,6 +29,7 @@ from typing import Any, Dict, Optional
 | 
				
			|||||||
import requests
 | 
					import requests
 | 
				
			||||||
import ujson
 | 
					import ujson
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from scripts.lib.zulip_tools import BOLDRED, ENDC
 | 
				
			||||||
from tools.lib.test_script import prepare_puppeteer_run
 | 
					from tools.lib.test_script import prepare_puppeteer_run
 | 
				
			||||||
from zerver.models import UserProfile, Message, get_user_by_delivery_email, get_realm
 | 
					from zerver.models import UserProfile, Message, get_user_by_delivery_email, get_realm
 | 
				
			||||||
from zerver.lib.actions import (
 | 
					from zerver.lib.actions import (
 | 
				
			||||||
@@ -143,6 +144,7 @@ def generate_screenshot_from_config(integration_name: str, screenshot_config: Sc
 | 
				
			|||||||
    message_sent = send_bot_payload_message(bot, integration, fixture_path, options.custom_headers)
 | 
					    message_sent = send_bot_payload_message(bot, integration, fixture_path, options.custom_headers)
 | 
				
			||||||
    if message_sent:
 | 
					    if message_sent:
 | 
				
			||||||
        capture_last_message_screenshot(bot, image_path)
 | 
					        capture_last_message_screenshot(bot, image_path)
 | 
				
			||||||
 | 
					        print(f'Screenshot captured to: {BOLDRED}{image_path}{ENDC}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
parser = argparse.ArgumentParser()
 | 
					parser = argparse.ArgumentParser()
 | 
				
			||||||
parser.add_argument('integration', type=str, help='Name of the integration')
 | 
					parser.add_argument('integration', type=str, help='Name of the integration')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,6 @@ async function run() {
 | 
				
			|||||||
        const imageDir = path.dirname(imagePath);
 | 
					        const imageDir = path.dirname(imagePath);
 | 
				
			||||||
        mkdirp.sync(imageDir);
 | 
					        mkdirp.sync(imageDir);
 | 
				
			||||||
        await page.screenshot({ path: imagePath, clip: clip });
 | 
					        await page.screenshot({ path: imagePath, clip: clip });
 | 
				
			||||||
        console.log(`Screenshot captured to: \x1B[1;31m${imagePath}\n`);
 | 
					 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
        console.log(e);
 | 
					        console.log(e);
 | 
				
			||||||
        process.exit(1);
 | 
					        process.exit(1);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user