This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
e2e: Add hacky workaround for product image gallery #21746
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
branches: [trunk] | |
pull_request: | |
jobs: | |
JSE2EWithGutenberg: | |
if: ${{ false }} # disable until we've fixed failing tests. | |
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@v4 | |
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 | |
- 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 | |
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-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --listTests > ~/.jest-e2e-tests | |
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e-jest/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/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.1.2 | |
with: | |
name: e2e-with-gutenberg-test-report-${{matrix.part}} | |
path: reports/e2e | |
- name: Archive flaky tests report | |
uses: actions/upload-artifact@v3.1.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 }}-modified-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-modified-build-${{ env.cache-name }}- | |
${{ runner.os }}-modified-build- | |
${{ runner.os }}-modified- | |
- name: Setup node version and npm cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install Node dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm install --no-optional --no-audit | |
- name: Build Assets | |
run: FORCE_REDUCED_MOTION=true npm run build | |
- 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: | | |
node ./bin/wp-env-with-wp-622.js | |
npm run wp-env start | |
npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --listTests > ~/.jest-e2e-tests | |
npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e-jest/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/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.1.2 | |
with: | |
name: e2e-test-report-${{matrix.part}} | |
path: reports/e2e | |
- name: Archive flaky tests report | |
uses: actions/upload-artifact@v3.1.2 # v2.2.2 | |
if: always() | |
with: | |
name: flaky-tests-report-${{ matrix.part }} | |
path: flaky-tests | |
if-no-files-found: ignore |