Skip to content

Commit

Permalink
OPHYK-212 Wait for servers to respond before running Playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rce committed Dec 10, 2024
1 parent d546d3b commit ee95051
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/ci/run-playwright-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 "$@"

0 comments on commit ee95051

Please sign in to comment.