diff --git a/.gitignore b/.gitignore index ee55848..729127f 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,4 @@ robot_results/* test_output/* test_results/* tests/robot/output/* -tests/robot/results/log.html -tests/robot/results/output.xml -tests/robot/results/playwright-log.txt -tests/robot/results/report.html +tests/robot/results/* diff --git a/tests/robot/__init__.robot b/tests/robot/__init__.robot index 9f3e5d2..c73d60c 100644 --- a/tests/robot/__init__.robot +++ b/tests/robot/__init__.robot @@ -9,6 +9,7 @@ Resource ${CURDIR}/resources/common.resource Suite Setup Run Keywords ... Start Aniworld Server +... AND Create Anonymous Session ... AND Wait For Server ... AND Initialize Browser diff --git a/tests/robot/resources/common.resource b/tests/robot/resources/common.resource index 705cfb4..192f501 100644 --- a/tests/robot/resources/common.resource +++ b/tests/robot/resources/common.resource @@ -26,14 +26,12 @@ ${SERVER_PROCESS} ${EMPTY} # --------------------------------------------------------------------------- Start Aniworld Server [Documentation] Start the FastAPI uvicorn server as a background process. - ${result}= Run Process conda run -n AniWorld python -m uvicorn src.server.fastapi_app:app - ... --host ${SERVER_HOST} --port ${SERVER_PORT} - ... --no-access-log + ${handle}= Start Process bash /home/lukas/Volume/repo/Aniworld/tests/robot/start_server.sh ... cwd=/home/lukas/Volume/repo/Aniworld ... stdout=${CURDIR}/../fixtures/server_stdout.log ... stderr=${CURDIR}/../fixtures/server_stderr.log - Set Suite Variable ${SERVER_PROCESS} ${result} - Sleep 3s + Set Suite Variable ${SERVER_PROCESS} ${handle} + Sleep 5s Stop Aniworld Server [Documentation] Terminate the uvicorn server process and clean up log files. @@ -49,8 +47,8 @@ Wait For Server ${resp}= Run Keyword And Ignore Error ... GET On Session anon /health expected_status=any IF '${resp}[0]' == 'PASS' - ${status_code}= Set Variable ${resp}[1].status_code - IF ${status_code} == 200 or ${status_code} == 503 + ${status_code}= Evaluate $resp[1].status_code + IF $status_code == 200 or $status_code == 503 RETURN END END diff --git a/tests/robot/start_server.sh b/tests/robot/start_server.sh new file mode 100644 index 0000000..9a3a63f --- /dev/null +++ b/tests/robot/start_server.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Wrapper script to start the Aniworld FastAPI server for Robot Framework tests +cd /home/lukas/Volume/repo/Aniworld +exec /home/lukas/miniconda3/envs/AniWorld/bin/python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8765 --no-access-log