From 2ec6099423f421a6563863510a7d527a16da090c Mon Sep 17 00:00:00 2001 From: J-Doiron <139803019+J-Doiron@users.noreply.github.com> Date: Wed, 12 Feb 2025 16:55:50 -0800 Subject: [PATCH] Added more checkpointing to the menu system --- cyberpunk2077/cyberpunk2077.py | 61 +++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/cyberpunk2077/cyberpunk2077.py b/cyberpunk2077/cyberpunk2077.py index b470f61..6db4b0c 100644 --- a/cyberpunk2077/cyberpunk2077.py +++ b/cyberpunk2077/cyberpunk2077.py @@ -19,6 +19,7 @@ from harness_utils.output import ( from harness_utils.process import terminate_processes from harness_utils.steam import exec_steam_game, get_build_id from harness_utils.artifacts import ArtifactManager, ArtifactType +from harness_utils.misc import press_n_times STEAM_GAME_ID = 1091500 SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) @@ -49,10 +50,24 @@ def navigate_to_settings(): user.press("enter") time.sleep(0.5) +def check_for_rt(): + result = kerasService.wait_for_word("reflections", interval=3, timeout=5) + if result: + press_n_times("down", 3, 0.2) + am.take_screenshot("graphics_rt.png", ArtifactType.CONFIG_IMAGE, "graphics menu rt") + if not result: + result = kerasService.wait_for_word("path", interval=3, timeout=5) + if result: + user.press("down") + am.take_screenshot("graphics_pt.png", ArtifactType.CONFIG_IMAGE, "graphics menu path tracing") def navigate_settings() -> None: """Simulate inputs to navigate the main menu""" navigate_to_settings() + result = kerasService.wait_for_word("volume", interval=3, timeout=20) + if not result: + logging.info("Did not see the volume options. Did keras navigate to the settings menu correctly?") + sys.exit(1) # entered settings user.press("3") time.sleep(0.5) @@ -61,24 +76,68 @@ def navigate_settings() -> None: user.press("3") time.sleep(0.5) + result = kerasService.wait_for_word("preset", interval=3, timeout=20) + if not result: + logging.info("Did not see preset options. Did the game navigate to the graphics menu correctly?") + sys.exit(1) # now on graphics tab am.take_screenshot("graphics_1.png", ArtifactType.CONFIG_IMAGE, "graphics menu 1") + result = kerasService.wait_for_word("DLSS", interval=3, timeout=5) + if result: + result = kerasService.wait_for_word("multi", interval=3, timeout=5) + if result: + user.press("down") + press_n_times("down", 3, 0.2) + check_for_rt() + + result = kerasService.wait_for_word("AMD", interval=3, timeout=5) + if result: + press_n_times("down", 2, 0.2) + check_for_rt() + + result = kerasService.wait_for_word("Intel", interval=3, timeout=5) + if result: + press_n_times("down", 2, 0.2) + check_for_rt() + for _ in range(7): user.press("down") time.sleep(0.5) + result = kerasService.wait_for_word("anisotropy", interval=3, timeout=20) + if not result: + logging.info("Did not see anisotropic options. Did the game navigate the graphics menu correctly?") + sys.exit(1) am.take_screenshot("graphics_2.png", ArtifactType.CONFIG_IMAGE, "graphics menu 2") for _ in range(11): user.press("down") time.sleep(0.5) + result = kerasService.wait_for_word("occlusion", interval=3, timeout=20) + if not result: + logging.info("Did not see ambient occlusion options. Did the game navigate to the graphics menu correctly?") + sys.exit(1) am.take_screenshot("graphics_3.png", ArtifactType.CONFIG_IMAGE, "graphics menu 3") + for _ in range(3): + user.press("down") + time.sleep(0.5) + + result = kerasService.wait_for_word("level", interval=3, timeout=20) + if not result: + logging.info("Did not see LOD options. Did the game navigate to the graphics menu correctly?") + sys.exit(1) + am.take_screenshot("graphics_4.png", ArtifactType.CONFIG_IMAGE, "graphics menu 4") + user.press("3") time.sleep(0.5) + result = kerasService.wait_for_word("resolution", interval=3, timeout=20) + if not result: + logging.info("Did not see preset options. Did the game navigate to the graphics menu correctly?") + sys.exit(1) # now on video tab am.take_screenshot("video.png", ArtifactType.CONFIG_IMAGE, "video menu") @@ -95,7 +154,7 @@ def run_benchmark(): setup_start_time = time.time() start_game() - time.sleep(10) + time.sleep(20) result = kerasService.wait_for_word("new", interval=3, timeout=60) if not result: