#!/bin/bash
if [[ -z "${CYPRESS_API_URL+x}" ]]; then
  echo "CYPRESS_API_URL not set"
  exit 1
fi
if [[ -z "${CYPRESS_RECORD_KEY+x}" ]]; then
  echo "CYPRESS_RECORD_KEY not set"
  exit 2
fi
if [[ -z "${BITBUCKET_BUILD_NUMBER+x}" ]]; then
  echo "BITBUCKET_BUILD_NUMBER not set"
  exit 2
fi

run_test_instance() {
  cd client
  build_id="myskillbox-run-${BITBUCKET_BUILD_NUMBER}"
  npx cy2 run --parallel --record  --config-file cypress.frontend.json --ci-build-id ${build_id}
}

run_test_instance
