|
| 1 | +name: E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + update-workflows: |
| 7 | + description: 'Weather generate new snapshots' |
| 8 | + type: boolean |
| 9 | + default: false |
| 10 | + wp-rc-version: |
| 11 | + description: 'WordPress version for Release Candidate (i.e. 6.3-RC3)' |
| 12 | + wc-rc-version: |
| 13 | + description: 'WooCommerce version for Release Candidate (i.e. 8.0.0-rc.1)' |
| 14 | + test-suite: |
| 15 | + description: 'Test suite to run' |
| 16 | + required: true |
| 17 | + default: 'critical' |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - critical |
| 21 | + - onboarding |
| 22 | + - all |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + name: Build package |
| 31 | + uses: inpsyde/reusable-workflows/.github/workflows/build-plugin-archive.yml@a9af34f34e95cbe18703198c7e972e97ebcd7473 |
| 32 | + with: |
| 33 | + PHP_VERSION: 7.4 |
| 34 | + NODE_VERSION: 22 |
| 35 | + PLUGIN_MAIN_FILE: ./woocommerce-paypal-payments.php |
| 36 | + PLUGIN_VERSION: 3.0.0 |
| 37 | + PLUGIN_FOLDER_NAME: woocommerce-paypal-payments |
| 38 | + ARCHIVE_NAME: woocommerce-paypal-payments |
| 39 | + COMPILE_ASSETS_ARGS: '-vv --env=root' |
| 40 | + |
| 41 | + E2ETests: |
| 42 | + name: E2E Tests |
| 43 | + needs: build |
| 44 | + runs-on: ubuntu-latest |
| 45 | + env: |
| 46 | + FORCE_COLOR: 2 |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v2 |
| 49 | + |
| 50 | + - name: Download artifact |
| 51 | + uses: actions/download-artifact@v4 |
| 52 | + with: |
| 53 | + name: woocommerce-paypal-payments |
| 54 | + path: ./tests/qa/resources/files |
| 55 | + |
| 56 | + - name: Create and upload zip file |
| 57 | + working-directory: ./tests/qa/resources/files |
| 58 | + run: | |
| 59 | + zip -r ./woocommerce-paypal-payments.zip ./woocommerce-paypal-payments |
| 60 | + rm -rf woocommerce-paypal-payments |
| 61 | +
|
| 62 | + - name: Configure npm for GitHub Packages |
| 63 | + working-directory: ./tests/qa |
| 64 | + run: | |
| 65 | + # Create clean .npmrc |
| 66 | + echo "@inpsyde:registry=https://npm.pkg.github.com" > .npmrc |
| 67 | + echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_SYDE }}" >> .npmrc |
| 68 | +
|
| 69 | + - name: Install Environment |
| 70 | + working-directory: ./tests/qa |
| 71 | + run: npm run setup:env |
| 72 | + env: |
| 73 | + COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_SYDE }}' |
| 74 | + |
| 75 | + - name: Install WP release candidate (optional) |
| 76 | + if: github.event.inputs.wp-rc-version != '' |
| 77 | + working-directory: ./tests/qa |
| 78 | + env: |
| 79 | + INPUT_WP_RC_VERSION: ${{ github.event.inputs.wp-rc-version }} |
| 80 | + run: | |
| 81 | + npm run -- wp-env run tests-cli -- wp core update --version="${INPUT_WP_RC_VERSION}" |
| 82 | + npm run -- wp-env run tests-cli -- wp core update-db |
| 83 | +
|
| 84 | + - name: Install WC release candidate (optional) |
| 85 | + if: github.event.inputs.wc-rc-version != '' |
| 86 | + working-directory: ./tests/qa |
| 87 | + env: |
| 88 | + INPUT_WC_RC_VERSION: ${{ github.event.inputs.wc-rc-version }} |
| 89 | + run: | |
| 90 | + npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version="${INPUT_WC_RC_VERSION}" |
| 91 | + npm run -- wp-env run tests-cli -- wp wc update |
| 92 | +
|
| 93 | + - name: Install Tests |
| 94 | + working-directory: ./tests/qa |
| 95 | + run: npm run setup:tests |
| 96 | + |
| 97 | + - name: Create .env file |
| 98 | + working-directory: ./tests/qa |
| 99 | + run: | |
| 100 | + echo "${{ secrets.QA_ENV_FILE }}" > .env |
| 101 | +
|
| 102 | + - name: Run E2E tests |
| 103 | + working-directory: ./tests/qa |
| 104 | + run: | |
| 105 | + if [ "${{ github.event.inputs.update_snapshots }}" == "true" ]; then |
| 106 | + npm run tests:${{ github.event.inputs.test-suite }} -- --update-snapshots |
| 107 | + else |
| 108 | + npm run tests:${{ github.event.inputs.test-suite }} |
| 109 | + fi |
| 110 | +
|
| 111 | + - name: Archive updated snapshots |
| 112 | + if: github.event.inputs.update_snapshots == 'true' |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: snapshots |
| 116 | + path: tests/qa/snapshots |
| 117 | + if-no-files-found: warn |
| 118 | + retention-days: 5 |
| 119 | + |
| 120 | + - name: Archive Playwright Report |
| 121 | + if: ${{ always() }} |
| 122 | + uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: playwright-test-results |
| 125 | + path: tests/qa/playwright-report |
| 126 | + if-no-files-found: ignore |
| 127 | + retention-days: 5 |
| 128 | + |
| 129 | + - name: Archive Test Results |
| 130 | + if: ${{ always() }} |
| 131 | + uses: actions/upload-artifact@v4 |
| 132 | + with: |
| 133 | + name: test-results |
| 134 | + path: tests/qa/test-results/ |
| 135 | + if-no-files-found: ignore |
| 136 | + retention-days: 5 |
0 commit comments