Skip to content

32.Run E2E Tests

32.Run E2E Tests #20

name: 32.Run E2E Tests
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: hmarr/debug-action@f7318c783045ac39ed9bb497e22ce835fdafbfe6
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Setup NPM Packages
uses: ./.github/actions/setup-npm
- name: Run App build
run: npm run build
- name: Install Docker Compose v2
# See https://docs.docker.com/compose/install/linux/
run: |
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
docker compose version
- name: Setup Localdev Environment
run: |
mkdir -p ./localdev/mnt/mongodb
mkdir -p ./localdev/mnt/postgres
chmod -R +rx ./localdev/mnt/postgres
cd localdev
echo "Docker is going to be executed in: ${PWD}"
export MACHINE_HOST_IP=$(hostname -I | awk '{print $1}')
~/.docker/cli-plugins/docker-compose -f localdev/docker-compose.yml -f localdev/docker-compose-ci.yml up -d
docker-compose logs postgres
node_modules/.bin/wait-on http://localhost:8080/health/ready --timeout 120000
cp .env.example .env
- name: Run App
run: |
npm start &
node_modules/.bin/wait-on http://localhost:3000 --timeout 120000
- name: Test DB Availability
run: |
response=$(curl -s http://localhost:3000/api/private-cloud/products)
echo "Response: $response"
# - name: Cypress run
# run: |
# npx cypress run
- name: Post Localdev Environment
run: |
~/.docker/cli-plugins/docker-compose -f localdev/docker-compose.yml -f localdev/docker-compose-ci.yml down
sudo rm -rf ./localdev/mnt