feat: add acceptance tests #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Acceptance | |
on: | |
push: | |
branches: | |
- trunk | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
acceptance: | |
name: Acceptance Test Suite | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:7.0 | |
ports: | |
- '9200:9200' | |
mailpit: | |
image: axllent/mailpit:latest | |
ports: | |
- '1025:1025' | |
- '8025:8025' | |
env: | |
APP_ENV: prod | |
APP_DEBUG: '1' | |
MAILER_DSN: smtp://localhost:1025 | |
MAILPIT_BASE_URL: http://localhost:8025 | |
PLUGIN_PATH: './custom/plugins/${{ github.event.repository.name }}' | |
steps: | |
- name: Checkout SwagPayPal | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.PLUGIN_PATH }} | |
- name: Setup SwagPayPal | |
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal | |
with: | |
install-admin: true | |
install-storefront: true | |
env: prod | |
- name: Prepare environment variables | |
run: | | |
symfony console cache:clear --env="${APP_ENV}" || true | |
echo "APP_URL=${APP_URL}" >> "${PLUGIN_PATH}/tests/acceptance/.env" | |
symfony console integration:create AcceptanceTest --admin >> "${PLUGIN_PATH}/tests/acceptance/.env" | |
cat "${PLUGIN_PATH}/tests/acceptance/.env" | |
- name: Install playwright | |
working-directory: ${{ env.PLUGIN_PATH }}/tests/acceptance | |
run: | | |
npm ci | |
npx playwright install --with-deps | |
- name: Run Playwright | |
working-directory: ${{ env.PLUGIN_PATH }}/tests/acceptance | |
run: npx playwright test --reporter=${{ github.event.act && 'line' || 'github' }} --trace=on-first-retry | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: acceptance-${{ github.event.repository.name }}-${{ github.sha }} | |
path: ${{ env.PLUGIN_PATH }}/tests/acceptance/test-results/ | |
retention-days: 3 |