Skip to content

Trusted Playwright Tests #409

Trusted Playwright Tests

Trusted Playwright Tests #409

name: Trusted Playwright Tests
on:
workflow_run:
workflows: ['PR Checks']
types:
- completed
jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Playwright Tests
runs-on: ubuntu-22.04
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.x'
- name: Create .env file
run: |
echo "Creating .env file..."
cat > .env <<EOF
VUE_APP_FIREBASE_API_KEY=${{ secrets.VUE_APP_FIREBASE_API_KEY }}
VUE_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.VUE_APP_FIREBASE_AUTH_DOMAIN }}
VUE_APP_FIREBASE_PROJECT_ID=${{ secrets.VUE_APP_FIREBASE_PROJECT_ID }}
VUE_APP_FIREBASE_STORAGE_BUCKET=${{ secrets.VUE_APP_FIREBASE_STORAGE_BUCKET }}
VUE_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.VUE_APP_FIREBASE_MESSAGING_SENDER_ID }}
VUE_APP_FIREBASE_APP_ID=${{ secrets.VUE_APP_FIREBASE_APP_ID }}
VUE_APP_FIREBASE_DB_URL=${{ secrets.VUE_APP_FIREBASE_DB_URL }}
EOF
- name: Debug .env file
run: cat .env
- name: Install Docker Compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
- name: Build and start services
run: docker-compose up -d --build
- name: Wait for container to become available
run: |
npx wait-on http://localhost:8080
sleep 10
- name: Check Docker logs
run: docker-compose logs
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: |
npx playwright install --with-deps
npx playwright install webkit
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Stop services
run: docker-compose down