diff --git a/src/main/archetype/ui.tests.cypress/Dockerfile b/src/main/archetype/ui.tests.cypress/Dockerfile index 7a6d6aef7..f53976757 100644 --- a/src/main/archetype/ui.tests.cypress/Dockerfile +++ b/src/main/archetype/ui.tests.cypress/Dockerfile @@ -19,6 +19,7 @@ RUN apt -qqy update \ # Generic dependencies && apt -qqy --no-install-recommends install \ python \ + curl \ build-essential # <<< End EAAS Convention \ diff --git a/src/main/archetype/ui.tests.cypress/test-module/run.sh b/src/main/archetype/ui.tests.cypress/test-module/run.sh index 758c47f3f..0f23912e9 100755 --- a/src/main/archetype/ui.tests.cypress/test-module/run.sh +++ b/src/main/archetype/ui.tests.cypress/test-module/run.sh @@ -23,5 +23,28 @@ echo 'checking Xvfb' ps aux | grep Xvfb # disable color output when running Cypress export NO_COLOR=1 + +# setup proxy environment variables +if [ -n "${PROXY_HOST:-}" ]; then + if [ -n "${PROXY_HTTPS_PORT:-}" ]; then + export HTTP_PROXY="https://${PROXY_HOST}:${PROXY_HTTPS_PORT}" + elif [ -n "${PROXY_HTTP_PORT:-}" ]; then + export HTTP_PROXY="http://${PROXY_HOST}:${PROXY_HTTP_PORT}" + fi + if [ -n "${PROXY_CA_PATH:-}" ]; then + export NODE_EXTRA_CA_CERTS=${PROXY_CA_PATH} + fi + if [ -n "${PROXY_OBSERVABILITY_PORT:-}" ] && [ -n "${HTTP_PROXY:-}" ]; then + echo "Waiting for proxy" + curl --silent --retry ${PROXY_RETRY_ATTEMPTS:-3} --retry-connrefused --retry-delay ${PROXY_RETRY_DELAY:-10} \ + --proxy ${HTTP_PROXY} --proxy-cacert ${PROXY_CA_PATH:-""} \ + ${PROXY_HOST}:${PROXY_OBSERVABILITY_PORT} + if [ $? -ne 0 ]; then + echo "Proxy is not ready" + exit 1 + fi + fi +fi + # execute tests npm test