woocommerce/plugins/woocommerce-blocks/.github/workflows/php-js-e2e-tests.yml

116 lines
4.0 KiB
YAML

name: E2E tests
on:
push:
branches: [trunk]
pull_request:
jobs:
JSE2EWithGutenberg:
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node version and npm cache
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Npm install and build
run: |
npm ci --no-optional
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 "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
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: 7.4
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: |
chmod -R 767 ./ #needed for permissions issues
node ./bin/wp-env-with-gutenberg.js
npm run wp-env start
npm run wp-env clean all
npm run test:e2e
- name: Upload artifacts on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: e2e-with-gutenberg-test-report
path: reports/e2e
JSE2ETests:
name: JavaScript E2E Tests (latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node version and npm cache
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Npm install and build
run: |
npm ci --no-optional
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 "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
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: 7.4
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 clean all
npm run test:e2e
- name: Upload artifacts on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: e2e-test-report
path: reports/e2e