Skip to content

Commit

Permalink
Merge pull request #5414 from BacLuc/e2e-use-docker-image
Browse files Browse the repository at this point in the history
CI: use image in docker compose again to run e2e tests
  • Loading branch information
usu committed Jul 12, 2024
2 parents ee6aa3b + 10e2766 commit 2eff377
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/reusable-e2e-tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ jobs:
# start necessary containers
- run: docker compose up -d api frontend pdf print browserless database docker-host http-cache mail

- uses: cypress-io/[email protected]
with:
working-directory: e2e
browser: ${{ matrix.browser }}
wait-on: 'http://localhost:3000, http://localhost:3000/api, http://localhost:3000/print/health'
wait-on-timeout: 300
# pull cypress while container are starting up
- run: docker compose pull e2e

- run: sh -x wait-for-container-startup.sh

- run: docker compose --profile e2e run --rm e2e --browser ${{ matrix.browser }}

- run: sudo chown -R $USER e2e
if: always()

# store screenshots and videos on GitHub as artifacts, for downloading and debugging in case of problems
- uses: actions/upload-artifact@v4
Expand Down
22 changes: 22 additions & 0 deletions wait-for-container-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

echo "Waiting for API container to start up and migrate DB..."
until curl --output /dev/null --silent --fail http://localhost:3000/api
do
sleep 2
done
echo "API container is ready."

echo "Waiting for print container to start up..."
until curl --output /dev/null --silent --fail http://localhost:3000/print/health
do
sleep 2
done
echo "Frontend container is ready."

echo "Waiting for frontend container to start up..."
until curl --output /dev/null --silent --fail http://localhost:3000
do
sleep 2
done
echo "Frontend container is ready."

0 comments on commit 2eff377

Please sign in to comment.