/ docker / start-e2e.sh
start-e2e.sh
 1  #!/bin/bash
 2  set -eu
 3  
 4  UI=false
 5  PROD_BUILD=false
 6  
 7  cleanup() {
 8      docker compose -f docker-compose.yml rm -fsv
 9  }
10  trap cleanup EXIT
11  
12  touch .env
13  
14  if [[ "$OSTYPE" == "darwin"* ]]; then
15    export HOST_HOSTNAME="host.docker.internal"
16  else
17    export HOST_HOSTNAME="172.17.0.1"
18  fi
19  
20  if [[ $* == *--start-playwright-ui* ]]; then
21      UI=true
22  fi
23  
24  if [[ $* == *--prod-build* ]]; then
25      PROD_BUILD=true
26  fi
27  
28  ARCH=$(uname -m)
29  case "$ARCH" in
30    x86_64 | amd64)
31      ARCH="amd64"
32      ;;
33    aarch64 | arm64 | armv8*)
34      ARCH="arm64"
35      ;;
36    *)
37      echo "Unsupported architecture: $ARCH"
38      exit 1
39      ;;
40  esac
41  export ARCH
42  
43  export LOCAL_UID=$(id -u)
44  export LOCAL_GID=$(id -g)
45  
46  # source .env file
47  set -a
48  [ -f .env ] && source .env
49  set +a
50  
51  # Check for Wave service access
52  source ./docker/detect-wave.sh
53  
54  if [ $PROD_BUILD = true ]; then
55    docker compose build && APP_USE_LOCAL_TESTNET_WALLET_STORE=true docker compose -f docker-compose.yml -f docker-compose.e2e.yml up --renew-anon-volumes --detach
56  else
57    docker compose build && APP_USE_LOCAL_TESTNET_WALLET_STORE=true docker compose -f docker-compose.yml up --renew-anon-volumes --detach
58  fi
59  
60  rm -rf ./test-data/project-states.json
61  
62  printf "ā³ Waiting for the app to start..."
63  
64  until curl -I -s http://localhost:5173/api/health | grep -q "200"; do
65      printf "."
66      sleep 1
67  done
68  
69  printf "\nāœ… The app is ready!\n"
70  
71  if [ $UI = true ]; then
72    printf "\nšŸš€ Starting the Playwright UI...\n"
73    npx playwright test --ui-port 0 &
74    docker compose logs app --follow
75  else
76    printf "\nšŸš€ Running tests..."
77    npx playwright test
78  fi