diff --git a/scripts/ci/run-playwright-tests.sh b/scripts/ci/run-playwright-tests.sh index 556b94d6d..95ff0b4df 100755 --- a/scripts/ci/run-playwright-tests.sh +++ b/scripts/ci/run-playwright-tests.sh @@ -22,9 +22,11 @@ function main { function start_mock_api { cd "${repo}/mock-api" && npm run mock-api & + wait_for_port 9000 } function start_ui { cd "${repo}/organisaatio-ui" && npm run start & + wait_for_port 3003 } function start_server { @@ -40,6 +42,7 @@ function start_server { -Durl-oidservice=http://localhost:9000/oidservice \ -Dcas.service.organisaatio-service=http://localhost:8080/organisaatio-service-not-available \ organisaatio-service/build/libs/organisaatio-service.jar & + wait_for_port 8080 } function install_npm_dependencies { @@ -61,4 +64,11 @@ function stop_database { docker compose down } +function wait_for_port { + local -r port="$1" + while ! nc -z localhost $port; do + sleep 1; echo "Waiting for port $port to respond" + done +} + main "$@"