diff --git a/.github/workflows/e2e-testing.yml b/.github/workflows/e2e-testing.yml index c08c36da66..fa7507ee1a 100644 --- a/.github/workflows/e2e-testing.yml +++ b/.github/workflows/e2e-testing.yml @@ -18,11 +18,14 @@ jobs: - name: Build frontend run: MITOPEN_HOSTNAME=nginx:8063 yarn build - - name: Run services and E2E tests - run: | - docker compose -f docker-compose-e2e-tests.yml build - docker compose -f docker-compose-e2e-tests.yml up nginx web db --detach --wait - docker compose -f docker-compose-e2e-tests.yml cp e2e_testing/fixtures/002_carousel.sql db:/002_carousel.sql - docker compose -f docker-compose-e2e-tests.yml exec -u postgres db psql postgres postgres -f /002_carousel.sql - docker compose -f docker-compose-e2e-tests.yml run e2e-tests - docker compose -f docker-compose-e2e-tests.yml down + - name: Build services + run: docker compose -f docker-compose-e2e-tests.yml build + + - name: Start services + run: docker compose -f docker-compose-e2e-tests.yml up nginx web db --detach --wait + + - name: Apply test data + run: ./e2e_testing/scripts/apply-fixtures.sh + + - name: Run E2E tests + run: docker compose -f docker-compose-e2e-tests.yml run e2e-tests diff --git a/e2e_testing/scripts/apply-fixtures.sh b/e2e_testing/scripts/apply-fixtures.sh new file mode 100755 index 0000000000..4db46c18c1 --- /dev/null +++ b/e2e_testing/scripts/apply-fixtures.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +directory="e2e_testing/fixtures" + +for path in "$directory"/*; do + if [ -f "$path" ]; then + file=$(basename $path) + echo "Applying: $file" + docker compose -f docker-compose-e2e-tests.yml cp $path db:/$file + docker compose -f docker-compose-e2e-tests.yml exec -u postgres db psql postgres postgres -f /$file + fi +done