From a6d4929ebd24432d5bfbd0116fd9c24a27986a32 Mon Sep 17 00:00:00 2001 From: Bradley Turek Date: Sat, 25 Mar 2023 19:35:43 -0600 Subject: [PATCH] feat: add check for demo app server in verify 00 For some reason, the app server crashed before I ran verify 00. The result of that was that the `evaluate_environment` method told me that I had not installed the browser (when I in reality had). This change should stop someone else from running into the same situation. --- setup/verify_env.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup/verify_env.py b/setup/verify_env.py index 68292d0..531d22f 100755 --- a/setup/verify_env.py +++ b/setup/verify_env.py @@ -3,6 +3,7 @@ import subprocess from pathlib import Path import importlib.util +import urllib.request SETUP_DIRECTORY = Path(__file__).resolve().parent @@ -43,13 +44,27 @@ def evaluate_environment(): sys.exit(1) +def check_server_running(): + demo_app_url = "http://localhost:7272" + try: + contents = str(urllib.request.urlopen(demo_app_url).read()) + server_not_running = "Login Page" not in contents + except: + server_not_running = True + if server_not_running: + print(f"It seems like the demo app server is not running at {demo_app_url}. You'll need to start it because " + f"we'll use it soon.") + sys.exit(1) + else: + print(f"✅ The demo app server is running at {demo_app_url}, as anticipated.") def main(): check_robot_framework_package() check_browser_library_package() check_rflint_package() check_smoke_suite_location() + check_server_running() evaluate_environment() print("Setup in perfect condition!")