zitadel/console/cypress.sh

45 lines
1.4 KiB
Bash
Raw Normal View History

2022-07-08 15:48:22 +02:00
#!/usr/bin/env bash
ACTION=$1
ENVFILE=$2
shift
shift
2022-07-20 13:08:35 +02:00
export projectRoot=".."
2022-07-08 15:48:22 +02:00
2022-07-25 15:24:16 +02:00
if [ -z ${ENVFILE:x} ]; then
echo "Not sourcing any env file"
else
set -a; source $ENVFILE; set +a
fi
2022-07-08 15:48:22 +02:00
NPX=""
if ! command -v cypress &> /dev/null; then
NPX="npx"
fi
2022-07-28 15:26:16 +02:00
###############################
function zitadel-health-check {
###############################
# this is needed to ensure zitadel has finished its startup
i=1
until [ $i -gt 10 ]; do
HEALTHSTATUS=$(curl zitadel:8080/healthz | tail -n1)
if [ $HEALTHSTATUS == '{"status":"ok"}' ]; then
echo "ZITADEL is up and running"
break
else echo "ZITADEL is starting"
sleep 1
fi
i=$[$i+1];
done
}
zitadel-health-check
2022-07-08 15:48:22 +02:00
$NPX cypress $ACTION \
2022-07-09 11:11:25 +02:00
--port "${E2E_CYPRESSPORT}" \
2022-08-03 17:45:49 +02:00
--env org="${ZITADEL_E2E_ORG}",org_owner_password="${ZITADEL_E2E_ORGOWNERPW}",org_owner_viewer_password="${ZITADEL_E2E_ORGOWNERVIEWERPW}",org_project_creator_password="${ZITADEL_E2E_ORGPROJECTCREATORPW}",login_policy_user_password="${ZITADEL_E2E_LOGINPOLICYUSERPW}",password_complexity_user_password="${ZITADEL_E2E_PASSWORDCOMPLEXITYUSERPW}",baseUrl="${ZITADEL_E2E_BASEURL}",serviceAccountKeyPath="${ZITADEL_E2E_MACHINEKEYPATH}",otherZitadelIdpInstance="${ZITADEL_E2E_OTHERZITADELIDPINSTANCE}",zitadelProjectResourceId="${ZITADEL_E2E_ZITADELPROJECTRESOURCEID}",noInitMFAAndPWRequired=${ZITADEL_E2E_NOINITMFAANDPWREQUIRED} \ "$@"