|
| 1 | +name: QIT E2E tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + max-parallel: 10 |
| 16 | + matrix: |
| 17 | + checkout: [ 'Default', 'Legacy' ] |
| 18 | + |
| 19 | + name: ${{ matrix.checkout }} QIT E2E tests |
| 20 | + steps: |
| 21 | + - name: Checkout repo |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + # PHP |
| 25 | + - name: Setup PHP |
| 26 | + uses: shivammathur/setup-php@v2 |
| 27 | + with: |
| 28 | + php-version: 7.4 |
| 29 | + tools: composer |
| 30 | + coverage: none |
| 31 | + |
| 32 | + - name: Cache Composer deps |
| 33 | + id: composer-cache |
| 34 | + uses: actions/cache@v4 |
| 35 | + with: |
| 36 | + path: ./vendor |
| 37 | + key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }} |
| 38 | + |
| 39 | + - name: Install composer dependencies |
| 40 | + if: ${{ steps.composer-cache.outputs.cache-hit == false }} |
| 41 | + shell: bash |
| 42 | + run: composer install --no-progress |
| 43 | + |
| 44 | + # Node |
| 45 | + - name: Setup Node |
| 46 | + uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version-file: '.nvmrc' |
| 49 | + |
| 50 | + - name: Cache Node deps |
| 51 | + id: node-cache |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: | |
| 55 | + ./node_modules |
| 56 | + ~/.cache/ms-playwright |
| 57 | + key: ${{ runner.os }}-node_modules-${{ hashFiles('package-lock.json') }} |
| 58 | + |
| 59 | + - name: Install node dependencies |
| 60 | + if: ${{ steps.node-cache.outputs.cache-hit == false }} |
| 61 | + shell: bash |
| 62 | + run: npm ci |
| 63 | + |
| 64 | + # Build |
| 65 | + - name: Build plugin package |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + npm run build |
| 69 | +
|
| 70 | + # QIT CLI |
| 71 | + - name: Install QIT via composer |
| 72 | + run: composer require woocommerce/qit-cli --dev |
| 73 | + |
| 74 | + - name: Add partner for QIT |
| 75 | + run: ./vendor/bin/qit partner:add --user='${{ secrets.PARTNER_USER }}' --application_password='${{ secrets.PARTNER_SECRET }}' |
| 76 | + |
| 77 | + # E2E test environment |
| 78 | + - name: Fill in .env |
| 79 | + run: | |
| 80 | + echo 'STRIPE_PUB_KEY="${{ secrets.E2E_STRIPE_PUBLISHABLE_KEY }}"' >> .env |
| 81 | + echo 'STRIPE_SECRET_KEY="${{ secrets.E2E_STRIPE_SECRET_KEY }}"' >> .env |
| 82 | + echo 'PAYPAL_MERCHANT_ID="${{ secrets.PAYPAL_MERCHANT_ID }}"' >> .env |
| 83 | + echo 'PAYPAL_MERCHANT_EMAIL="${{ secrets.PAYPAL_MERCHANT_EMAIL }}"' >> .env |
| 84 | + echo 'PAYPAL_CLIENT_ID="${{ secrets.PAYPAL_CLIENT_ID }}"' >> .env |
| 85 | + echo 'PAYPAL_CLIENT_SECRET="${{ secrets.PAYPAL_CLIENT_SECRET }}"' >> .env |
| 86 | + echo 'PAYPAL_CUSTOMER_EMAIL="${{ secrets.PAYPAL_CUSTOMER_EMAIL }}"' >> .env |
| 87 | + echo 'PAYPAL_CUSTOMER_PASSWORD="${{ secrets.PAYPAL_CUSTOMER_PASSWORD }}"' >> .env |
| 88 | +
|
| 89 | + - name: Run ${{ matrix.checkout }} E2E tests |
| 90 | + shell: bash |
| 91 | + run: ./vendor/bin/qit run:e2e woocommerce-gateway-stripe ${{ matrix.checkout == 'Legacy' && 'legacy' || '' }} --source ./ --plugin woocommerce --plugin woocommerce-subscriptions --plugin woocommerce-paypal-payments:test:setup-tests --env_file .env |
| 92 | + |
| 93 | + - name: Set the path in an env var |
| 94 | + if: ${{ failure() }} |
| 95 | + run: echo "E2E_REPORT_PATH=$(./vendor/bin/qit e2e-report --dir_only --local)/playwright" >> $GITHUB_ENV |
| 96 | + |
| 97 | + - name: Upload ${{ matrix.checkout }} QIT E2E test results |
| 98 | + if: ${{ failure() }} |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + with: |
| 101 | + name: ${{ matrix.checkout }}-qit-e2e-test-results |
| 102 | + path: ${{ env.E2E_REPORT_PATH }} |
| 103 | + if-no-files-found: ignore |
| 104 | + retention-days: 14 |
0 commit comments