diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml index 1b91a2f977e..1098880547a 100644 --- a/.github/workflows/e2e-pull-request.yml +++ b/.github/workflows/e2e-pull-request.yml @@ -67,6 +67,7 @@ jobs: PHP_STABLE="8.3" TEST_GROUPS_WCPAY="wcpay" TEST_GROUPS_SUBSCRIPTIONS="subscriptions" + TEST_GROUPS_BLOCKS="blocks" TEST_BRANCHES_MERCHANT="merchant" TEST_BRANCHES_SHOPPER="shopper" @@ -78,12 +79,14 @@ jobs: 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 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\"}") # Convert array to JSON MATRIX_INCLUDE=$(printf '%s\n' "${MATRIX_ENTRIES[@]}" | jq -s . -c) @@ -105,6 +108,8 @@ jobs: 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' || '' }} steps: - name: Checkout WCPay repository diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 943755cc822..2bca8a94f78 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -62,6 +62,14 @@ jobs: # 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" @@ -69,36 +77,40 @@ jobs: 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) + # 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 + # 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 only + # 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 only (only if beta version is available) + # 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) @@ -107,6 +119,7 @@ jobs: 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\"}") + MATRIX_ENTRIES+=("{\"woocommerce\":\"$RC_VERSION\",\"php\":\"$PHP_LATEST\",\"test_groups\":\"$TEST_GROUPS_BLOCKS\",\"test_branches\":\"$TEST_BRANCHES_SHOPPER\"}") else echo "No RC version available, skipping RC matrix entries" >&2 fi @@ -130,7 +143,9 @@ jobs: E2E_PHP_VERSION: ${{ matrix.php }} E2E_GROUP: ${{ matrix.test_groups }} E2E_BRANCH: ${{ matrix.test_branches }} - SKIP_WC_BLOCKS_TESTS: 1 # skip running blocks tests + 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 @@ -146,38 +161,18 @@ jobs: - name: Run tests, upload screenshots & logs uses: ./.github/actions/e2e/run-log-tests - # Run tests against WC Checkout blocks & WC latest - # [TODO] Unskip blocks tests after investigating constant failures. - # blocks-tests: - # runs-on: ubuntu-latest - # name: WC - latest | blocks - shopper - # env: - # E2E_WP_VERSION: 'latest' - # E2E_WC_VERSION: 'latest' - # E2E_GROUP: 'blocks' - # E2E_BRANCH: 'shopper' - # SKIP_WC_SUBSCRIPTIONS_TESTS: 1 #skip installing & running subscriptions tests - # SKIP_WC_ACTION_SCHEDULER_TESTS: 1 #skip installing & running action scheduler tests - - # steps: - # - name: Checkout WCPay repository - # uses: actions/checkout@v4 - - # - name: Setup E2E environment - # uses: ./.github/actions/e2e/env-setup - - # - 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' ] # [TODO] Unskip blocks tests after investigating constant failures. + test_groups: [ 'wcpay', 'subscriptions', 'blocks' ] test_branches: [ 'merchant', 'shopper' ] name: WP - nightly | WC - latest | ${{ matrix.test_groups }} - ${{ matrix.test_branches }} diff --git a/tests/e2e/playwright.config.ts b/tests/e2e/playwright.config.ts index e6a5030e44a..9d4d2ba87bb 100644 --- a/tests/e2e/playwright.config.ts +++ b/tests/e2e/playwright.config.ts @@ -11,7 +11,7 @@ config( { path: path.resolve( __dirname, '../e2e/config', 'local.env' ) } ); const { BASE_URL, NODE_ENV, E2E_GROUP, E2E_BRANCH } = process.env; -const validGroups = [ 'wcpay', 'subscriptions' ]; +const validGroups = [ 'wcpay', 'subscriptions', 'blocks' ]; const validBranches = [ 'merchant', 'shopper' ]; const buildTestDir = ( group: string, branch: string ) => { @@ -21,6 +21,14 @@ const buildTestDir = ( group: string, branch: string ) => { return baseDir; } + // Special handling for blocks tests - they are located in wcpay/shopper directory + if ( group === 'blocks' ) { + if ( ! branch || ! validBranches.includes( branch ) ) { + return `${ baseDir }\/wcpay`; + } + return `${ baseDir }\/wcpay\/${ branch }`; + } + if ( ! branch || ! validBranches.includes( branch ) ) { return `${ baseDir }\/${ group }`; } @@ -31,6 +39,11 @@ const buildTestDir = ( group: string, branch: string ) => { const getTestMatch = ( group: string, branch: string ) => { const testDir = buildTestDir( group, branch ); + // Special handling for blocks tests - filter for wc-blocks test files + if ( group === 'blocks' ) { + return new RegExp( `${ testDir }\/.*wc-blocks.*\.spec\.ts` ); + } + return new RegExp( `${ testDir }\/.*\.spec\.ts` ); };