name: E2E tests on: push: branches: [trunk] pull_request: jobs: JSE2EWithGutenberg: strategy: fail-fast: false matrix: part: [1, 2, 3, 4, 5] name: JavaScript E2E Tests (WP latest with Gutenberg plugin) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Cache node_modules id: cache-node-modules uses: actions/cache@v3 env: cache-name: cache-node-modules with: path: node_modules key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - name: Setup node version and npm cache uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' cache: 'npm' - name: Install Node Dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --no-optional - name: Build Assets run: FORCE_REDUCED_MOTION=true npm run build:e2e-test - name: blocks.ini setup run: | echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini - name: Get Composer Cache Directory id: composer-cache run: | echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-composer- - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: '8.0' coverage: none tools: composer - name: Composer install run: | composer install - name: E2E Tests (WP latest with Gutenberg plugin) env: WOOCOMMERCE_BLOCKS_PHASE: 3 GUTENBERG_EDITOR_CONTEXT: 'gutenberg' run: | node ./bin/wp-env-with-gutenberg.js npm run wp-env start npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - name: Upload artifacts on failure if: ${{ failure() }} uses: actions/upload-artifact@v3 with: name: e2e-with-gutenberg-test-report-${{matrix.part}} path: reports/e2e - name: Archive flaky tests report uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 if: always() with: name: flaky-tests-report-${{ matrix.part }} path: flaky-tests if-no-files-found: ignore JSE2ETests: name: JavaScript E2E Tests (latest) strategy: fail-fast: false matrix: part: [1, 2, 3, 4, 5] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Cache node_modules id: cache-node-modules uses: actions/cache@v3 env: cache-name: cache-node-modules with: path: node_modules key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - name: Setup node version and npm cache uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' cache: 'npm' - name: Install Node Dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --no-optional - name: Build Assets run: FORCE_REDUCED_MOTION=true npm run build:e2e-test - name: blocks.ini setup run: | echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini - name: Get Composer Cache Directory id: composer-cache run: | echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-composer- - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: '8.0' coverage: none tools: composer - name: Composer install run: | composer install - name: E2E Tests (WP latest) env: WOOCOMMERCE_BLOCKS_PHASE: 3 run: | npm run wp-env start npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --listTests > ~/.jest-e2e-tests npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e/config wp-scripts test-e2e --config tests/e2e/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - name: Upload artifacts on failure if: ${{ failure() }} uses: actions/upload-artifact@v3 with: name: e2e-test-report-${{matrix.part}} path: reports/e2e - name: Archive flaky tests report uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 if: always() with: name: flaky-tests-report-${{ matrix.part }} path: flaky-tests if-no-files-found: ignore