E2E Tests - All #25992
This file contains hidden or 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: E2E Tests - All | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| push: | |
| branches: | |
| - develop | |
| - trunk | |
| workflow_dispatch: | |
| env: | |
| E2E_GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }} | |
| WCP_DEV_TOOLS_REPO: ${{ secrets.WCP_DEV_TOOLS_REPO }} | |
| WCP_DEV_TOOLS_BRANCH: 'trunk' | |
| TRANSACT_PLATFORM_SERVER_REPO: ${{ secrets.TRANSACT_PLATFORM_SERVER_REPO }} | |
| WC_SUBSCRIPTIONS_REPO: ${{ secrets.WC_SUBSCRIPTIONS_REPO }} | |
| E2E_JP_SITE_ID: ${{ secrets.E2E_JP_SITE_ID }} | |
| E2E_JP_BLOG_TOKEN: ${{ secrets.E2E_JP_BLOG_TOKEN }} | |
| E2E_JP_USER_TOKEN: ${{ secrets.E2E_JP_USER_TOKEN }} | |
| WC_E2E_SCREENSHOTS: 1 | |
| E2E_SLACK_CHANNEL_ID: ${{ secrets.E2E_SLACK_CHANNEL_ID }} | |
| E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }} | |
| E2E_USE_LOCAL_SERVER: false | |
| E2E_RESULT_FILEPATH: 'tests/e2e/results.json' | |
| WC_MIN_SUPPORTED_VERSION: '7.6.0' | |
| NODE_ENV: 'test' | |
| FORCE_E2E_DEPS_SETUP: true | |
| jobs: | |
| generate-matrix: | |
| name: "Generate the test matrix dynamically" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.generate_matrix.outputs.matrix }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: "Generate matrix" | |
| id: generate_matrix | |
| run: | | |
| # Use dynamic script to get WooCommerce versions (L-1 policy) | |
| SCRIPT_RESULT=$( .github/scripts/generate-wc-matrix.sh ) | |
| # Extract versions and metadata from JSON | |
| L1_VERSION=$(echo "$SCRIPT_RESULT" | jq -r '.metadata.l1_version') | |
| RC_VERSION=$(echo "$SCRIPT_RESULT" | jq -r '.metadata.rc_version') | |
| BETA_VERSION=$(echo "$SCRIPT_RESULT" | jq -r '.metadata.beta_version') | |
| if [[ "$BETA_VERSION" == "null" ]]; then | |
| BETA_VERSION="" | |
| fi | |
| echo "Using L-1 version: $L1_VERSION" >&2 | |
| echo "Using RC version: $RC_VERSION" >&2 | |
| if [[ -n "$BETA_VERSION" ]]; then | |
| echo "Using beta version: $BETA_VERSION" >&2 | |
| else | |
| echo "No beta version available" >&2 | |
| fi | |
| # Create optimized matrix with selective PHP version testing | |
| # Build matrix dynamically based on WC versions | |
| # | |
| # BLOCK-BASED CHECKOUT TESTS STRATEGY: | |
| # - Run block-based checkout tests on current stable and newer WC versions where blocks support is mature | |
| # - WC 7.7.0: NO block-based checkout tests (too old, limited support) | |
| # - WC L-1: YES block-based checkout tests (recent version with full block support) | |
| # - WC latest: YES block-based checkout tests (current stable, full support) | |
| # - WC beta: YES block-based checkout tests (newer version, test latest features) | |
| # - WC RC: YES blocks tests (newest version, test upcoming release) | |
| # Define common values to reduce repetition | |
| PHP_LEGACY="7.3" | |
| PHP_STABLE="8.3" | |
| PHP_LATEST="8.4" | |
| TEST_GROUPS_WCPAY="wcpay" | |
| TEST_GROUPS_SUBSCRIPTIONS="subscriptions" | |
| TEST_GROUPS_BLOCKS="blocks" | |
| TEST_BRANCHES_MERCHANT="merchant" | |
| TEST_BRANCHES_SHOPPER="shopper" | |
| # Initialize empty matrix array | |
| MATRIX_ENTRIES=() | |
| # Add WC 7.7.0 with PHP 7.3 only (legacy - NO blocks tests) | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"7.7.0\",\"php\":\"$PHP_LEGACY\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| # Add L-1 version with PHP 8.3 only (INCLUDE blocks tests - recent version with full support) | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$L1_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$L1_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$L1_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$L1_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$L1_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_BLOCKS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| # Add latest with PHP 8.3 (INCLUDE blocks tests - current stable, full support) | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"latest\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"latest\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"latest\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"latest\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"latest\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_BLOCKS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| # Add beta with PHP 8.3 (INCLUDE blocks tests - newer version) | |
| if [[ -n "$BETA_VERSION" ]]; then | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$BETA_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$BETA_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$BETA_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$BETA_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$BETA_VERSION\",\"php\":\"$PHP_STABLE\",\"test_groups\":\"$TEST_GROUPS_BLOCKS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| fi | |
| # Add rc with PHP 8.4 only (only if RC version is available) | |
| if [[ -n "$RC_VERSION" && "$RC_VERSION" != "null" ]]; then | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$RC_VERSION\",\"php\":\"$PHP_LATEST\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$RC_VERSION\",\"php\":\"$PHP_LATEST\",\"test_groups\":\"$TEST_GROUPS_WCPAY\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$RC_VERSION\",\"php\":\"$PHP_LATEST\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_MERCHANT\"}") | |
| MATRIX_ENTRIES+=("{\"woocommerce\":\"$RC_VERSION\",\"php\":\"$PHP_LATEST\",\"test_groups\":\"$TEST_GROUPS_SUBSCRIPTIONS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") | |
| else | |
| echo "No RC version available, skipping RC matrix entries" >&2 | |
| fi | |
| # Convert array to JSON | |
| MATRIX_INCLUDE=$(printf '%s\n' "${MATRIX_ENTRIES[@]}" | jq -s . -c) | |
| echo "matrix={\"include\":$MATRIX_INCLUDE}" >> $GITHUB_OUTPUT | |
| # Run WCPay and Subscriptions tests across WooCommerce and PHP matrix | |
| wcpay-matrix-tests: | |
| runs-on: ubuntu-latest | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| name: "WC - ${{ matrix.woocommerce }} | PHP - ${{ matrix.php }} | ${{ matrix.test_groups }} - ${{ matrix.test_branches }}" | |
| env: | |
| E2E_WP_VERSION: 'latest' | |
| E2E_WC_VERSION: ${{ matrix.woocommerce }} | |
| E2E_PHP_VERSION: ${{ matrix.php }} | |
| E2E_GROUP: ${{ matrix.test_groups }} | |
| E2E_BRANCH: ${{ matrix.test_branches }} | |
| SKIP_WC_SUBSCRIPTIONS_TESTS: ${{ matrix.test_groups == 'blocks' && '1' || '' }} | |
| SKIP_WC_ACTION_SCHEDULER_TESTS: ${{ matrix.test_groups == 'blocks' && '1' || '' }} | |
| SKIP_WC_BLOCKS_TESTS: ${{ matrix.test_groups != 'blocks' && '1' || '' }} | |
| steps: | |
| - name: Checkout WCPay repository | |
| uses: actions/checkout@v4 | |
| - name: Setup E2E environment | |
| uses: ./.github/actions/e2e/env-setup | |
| - name: Install Playwright | |
| shell: bash | |
| run: npx playwright install chromium | |
| - name: Run tests, upload screenshots & logs | |
| uses: ./.github/actions/e2e/run-log-tests | |
| # Run tests against WP Nightly & WC latest | |
| # This section tests new WordPress features with latest WC | |
| # Blocks tests are included here since we're testing against WP nightly + WC latest | |
| wp-nightly-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test_groups: [ 'wcpay', 'subscriptions', 'blocks' ] | |
| test_branches: [ 'merchant', 'shopper' ] | |
| exclude: | |
| # Exclude blocks-merchant combination - no merchant blocks tests exist | |
| - test_groups: 'blocks' | |
| test_branches: 'merchant' | |
| name: WP - nightly | WC - latest | ${{ matrix.test_groups }} - ${{ matrix.test_branches }} | |
| env: | |
| E2E_WP_VERSION: 'nightly' | |
| E2E_WC_VERSION: 'latest' | |
| E2E_GROUP: ${{ matrix.test_groups }} | |
| E2E_BRANCH: ${{ matrix.test_branches }} | |
| steps: | |
| - name: Checkout WCPay repository | |
| uses: actions/checkout@v4 | |
| - name: Setup E2E environment | |
| uses: ./.github/actions/e2e/env-setup | |
| - name: Install Playwright | |
| shell: bash | |
| run: npx playwright install chromium | |
| - name: Run tests, upload screenshots & logs | |
| uses: ./.github/actions/e2e/run-log-tests |