MCPcopy Create free account
hub / github.com/ComfyWorkflows/ComfyUI-Launcher / run_tests

Function run_tests

server/tests.py:49–204  ·  view source on GitHub ↗
(server_url)

Source from the content-addressed store, hash-verified

47
48
49def run_tests(server_url):
50 print(f"run_tests 1. entered fn w/ server_url: {server_url}")
51 passed_tests = []
52 failed_tests = []
53
54 templates_dir = './server/templates'
55 test_workflows_dir = './server/test-workflows'
56 test_default_dir = './server/test-default'
57
58 # test_workflows_json = load_json_files(test_workflows_dir)
59 # templates_json = load_json_files(templates_dir)
60 test_default_json = load_json_files(test_default_dir)
61 # print(f"run_tests 2b. test_workflows_json length: {len(test_workflows_json)}.")
62 # print(f"run_tests 2a. templates_json length: {len(templates_json)}.")
63 print(f"run_tests 2a. test_default_json length: {len(test_default_json)}.")
64
65 # all_json = test_workflows_json + templates_json
66
67 for file_path, json_obj in test_default_json: #all_json
68 NAME = str(uuid.uuid4())
69 print(f"🚀🚀🚀 run_tests 3. ENTERED for loop for file_path: {file_path} and generated name: {NAME}")
70 replaced_json_obj = replace_filepaths(json_obj)
71 print(f"run_tests 3WW. successfylly replaced filepaths fr.")
72
73 ## Fetch to /import_project
74 # response = requests.post(f"{server_url}/import_project", json=json_obj)
75 import_project_payload = {
76 "name": NAME,
77 "import_json": replaced_json_obj #json_obj
78 }
79 import_project_headers = {
80 "Content-Type": "application/json"
81 }
82
83 response = requests.request("POST", f"{server_url}/api/import_project", json=import_project_payload, headers=import_project_headers)
84 project_id = response.json()['id']
85 print(f"run_tests 4. got response from /import_project: {response}. and got project_id: {project_id}")
86
87 # Fetch to /projects/<id>/start
88 response = requests.post(f"{server_url}/api/projects/{project_id}/start")
89 port = response.json()['port']
90 print(f"run_tests 5. got response from /projects/{project_id}/start: {response}. and got port: {port}")
91
92 # Use selenium
93 # URL of the Selenium Grid hub
94 # hub_url = "http://localhost:4444/wd/hub"
95
96 # Set Chrome options
97
98 # driver = webdriver.Chrome(options=chrome_options)
99 # Initialize the WebDriver with remote connection to the Selenium Grid hub
100 # driver = webdriver.Remote(command_executor=hub_url, options=chrome_options)
101
102
103 chrome_options = Options()
104 # chrome_options.add_argument('--headless') # Run Chrome in headless mode
105 chrome_options.add_argument("--no-sandbox") # linux only
106 chrome_options.add_argument("--headless=new") # for Chrome >= 109

Callers 1

mainFunction · 0.85

Calls 2

load_json_filesFunction · 0.85
replace_filepathsFunction · 0.85

Tested by

no test coverage detected