mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-09 14:07:56 -05:00
Jd/rlfix (#115)
Rocket league harness updates for menu changes and adding artifact manager.
This commit is contained in:
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
Changes are grouped by the date they are merged to the main branch of the repository and are ordered from newest to oldest. Dates use the ISO 8601 extended calendar date format, i.e. YYYY-MM-DD.
|
||||
|
||||
## 2024-12-13
|
||||
|
||||
- Update to Rocket League harness for artifact management and new menu navigation.
|
||||
|
||||
## 2024-12-04
|
||||
|
||||
- Update some timings in RDR2 harness.
|
||||
|
||||
@@ -6,6 +6,8 @@ from subprocess import Popen
|
||||
import pyautogui as gui
|
||||
import pydirectinput as user
|
||||
import sys
|
||||
import getpass
|
||||
from pathlib import Path
|
||||
from rocket_league_utils import get_resolution, copy_replay, find_rocketleague_executable, get_args
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
@@ -17,14 +19,19 @@ from harness_utils.output import (
|
||||
seconds_to_milliseconds,
|
||||
DEFAULT_LOGGING_FORMAT,
|
||||
DEFAULT_DATE_FORMAT)
|
||||
from harness_utils.misc import press_n_times
|
||||
from harness_utils.process import terminate_processes
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.artifacts import ArtifactManager, ArtifactType
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
USERNAME = getpass.getuser()
|
||||
CONFIG_PATH = Path(f"C:\\Users\\{USERNAME}\\Documents\\My Games\\Rocket League\\TAGame\\Config\\TASystemSettings.ini")
|
||||
PROCESS_NAME = "rocketleague.exe"
|
||||
EXECUTABLE_PATH = find_rocketleague_executable()
|
||||
GAME_ID = "9773aa1aa54f4f7b80e44bef04986cea%3A530145df28a24424923f5828cc9031a1%3ASugar?action=launch&silent=true"
|
||||
am = ArtifactManager(LOG_DIRECTORY)
|
||||
|
||||
setup_log_directory(LOG_DIRECTORY)
|
||||
|
||||
@@ -116,8 +123,8 @@ def run_benchmark():
|
||||
user.press("enter")
|
||||
time.sleep(1)
|
||||
|
||||
#Entering the replay screen and starting the replay:
|
||||
if kerasService.wait_for_word(word="replays", timeout=60, interval=0.5) is None:
|
||||
#Entering the match history screen and starting the replay:
|
||||
if kerasService.wait_for_word(word="history", timeout=60, interval=0.5) is None:
|
||||
logging.error("Didn't navigate to the replays. Check menu options for any anomalies.")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -126,12 +133,19 @@ def run_benchmark():
|
||||
time.sleep(0.2)
|
||||
user.press("enter")
|
||||
time.sleep(1)
|
||||
user.press("down")
|
||||
|
||||
result = kerasService.look_for_word("saved", attempts=10, interval=1)
|
||||
if not result:
|
||||
logging.info("Couldn't find the saved replays tab. Check settings and try again.")
|
||||
sys.exit(1)
|
||||
|
||||
gui.moveTo(result["x"], result["y"])
|
||||
time.sleep(0.2)
|
||||
user.press("up")
|
||||
gui.mouseDown()
|
||||
time.sleep(0.2)
|
||||
gui.mouseUp()
|
||||
time.sleep(2)
|
||||
user.press("enter")
|
||||
time.sleep(1)
|
||||
|
||||
setup_end_time = time.time()
|
||||
elapsed_setup_time = round(setup_end_time - setup_start_time, 2)
|
||||
@@ -169,9 +183,38 @@ def run_benchmark():
|
||||
elapsed_test_time = round((test_end_time - test_start_time), 2)
|
||||
logging.info("Benchmark took %f seconds", elapsed_test_time)
|
||||
|
||||
user.press("esc")
|
||||
time.sleep(0.4)
|
||||
press_n_times("down", 3, 0.5)
|
||||
time.sleep(0.2)
|
||||
user.press("enter")
|
||||
time.sleep(0.4)
|
||||
|
||||
result = kerasService.look_for_word("video", attempts=10, interval=1)
|
||||
if not result:
|
||||
logging.info("Couldn't find the video tab. Did the settings menu open?")
|
||||
sys.exit(1)
|
||||
|
||||
gui.moveTo(result["x"], result["y"])
|
||||
time.sleep(0.2)
|
||||
gui.mouseDown()
|
||||
time.sleep(0.2)
|
||||
gui.mouseUp()
|
||||
time.sleep(1)
|
||||
result = kerasService.look_for_word("basic", attempts=10, interval=1)
|
||||
if not result:
|
||||
logging.info("Couldn't find the basic settings header. Did Keras click correctly?")
|
||||
sys.exit(1)
|
||||
else:
|
||||
logging.info("Seen the video settings, capturing the data.")
|
||||
am.take_screenshot("video.png", ArtifactType.CONFIG_IMAGE, "Screenshot of the display settings")
|
||||
|
||||
am.copy_file(CONFIG_PATH, ArtifactType.CONFIG_TEXT, "TASystemSettings.ini")
|
||||
|
||||
logging.info("Run completed. Closing game.")
|
||||
time.sleep(2)
|
||||
terminate_processes(PROCESS_NAME)
|
||||
am.create_manifest()
|
||||
return test_start_time, test_end_time
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user