* Expand travis matrix to cover diffrent WP versions

* skip tests on older wp versions

* duplicate tests

* add wp version to phpunit tests

* skip all products in 5.2

* fix tests

* tweak command to account for e2e-util version

* tag snapshots

* Revert "tag snapshots"

This reverts commit b55ba2e522c5a248590039a3bb224f81da2653c5.

* use hook instead of HOC

* add todo to code

* fix borked conflict

* remove dubplicate single product test

* revert assets/js/blocks/product-search/edit.js to master
This commit is contained in:
Seghir Nadir 2020-06-16 13:18:34 +01:00 committed by GitHub
parent b0ef232271
commit de10d09afd
9 changed files with 62 additions and 4 deletions

View File

@ -76,7 +76,7 @@ jobs:
- npm run lint:ci
env:
- WOOCOMMERCE_BLOCKS_PHASE=3
- name: E2E Tests
- name: E2E Tests (WP 5.2)
script:
- npm ci
- npm run test:e2e:up
@ -84,6 +84,39 @@ jobs:
- npm run build:e2e-test
- npm run test:e2e
env:
- WP_VERSION=5.2
- WOOCOMMERCE_BLOCKS_PHASE=3
- name: E2E Tests (WP 5.3)
script:
- npm ci
- npm run test:e2e:up
- composer install
- npm run build:e2e-test
- npm run test:e2e
env:
- WP_VERSION=5.3
- WOOCOMMERCE_BLOCKS_PHASE=3
- name: E2E Tests (WP 5.4)
script:
- npm ci
- npm run test:e2e:up
- composer install
- npm run build:e2e-test
- npm run test:e2e
env:
- WP_VERSION=5.4
- WOOCOMMERCE_BLOCKS_PHASE=3
- name: E2E Tests (WP 5.4 with Gutenberg plugin)
script:
- npm ci
- npm run test:e2e:up
- composer install
- npm run build:e2e-test
- npm install @wordpress/e2e-test-utils@latest
- npm run test:e2e
env:
- WP_VERSION=5.4
- GUTENBERG_LATEST=true
- WOOCOMMERCE_BLOCKS_PHASE=3
- stage: deploy
if: (NOT type IN (pull_request)) AND (branch = main)

View File

@ -53,6 +53,11 @@ wp plugin install https://github.com/WP-API/Basic-Auth/archive/master.zip --acti
wp plugin install woocommerce --activate
wp plugin activate woocommerce-gutenberg-products-block
wp theme install storefront --activate
declare -p GUTENBERG_LATEST
if [ "${GUTENBERG_LATEST-}" == 'true' ]; then
wp plugin install gutenberg --activate
fi
wp user create customer customer@woocommercecoree2etestsuite.com --user_pass=password --role=customer --path=/var/www/html
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.'

View File

@ -69,6 +69,7 @@ services:
WORDPRESS_PORT:
WORDPRESS_EMAIL:
DOMAIN_NAME:
GUTENBERG_LATEST:
volumes:
- ./:/var/www/html/wp-content/plugins/woocommerce-gutenberg-products-block
- wordpress:/var/www/html

View File

@ -91,7 +91,7 @@
"@wordpress/components": "8.5.0",
"@wordpress/data-controls": "1.6.0",
"@wordpress/dependency-extraction-webpack-plugin": "2.1.0",
"@wordpress/e2e-test-utils": "^4.3.1",
"@wordpress/e2e-test-utils": "4.3.1",
"@wordpress/editor": "9.10.0",
"@wordpress/element": "2.10.0",
"@wordpress/eslint-plugin": "3.3.0",

View File

@ -15,6 +15,13 @@ const block = {
class: '.wc-block-all-products',
};
/**
* @todo: write helpers to simplify version and feature gating tests.
*/
if ( process.env.WP_VERSION < 5.3 )
// eslint-disable-next-line jest/no-focused-tests
test.only( 'skipping all other things', () => {} );
describe( `${ block.name } Block`, () => {
beforeAll( async () => {
await switchUserToAdmin();

View File

@ -15,6 +15,10 @@ const block = {
class: '.wc-block-cart',
};
if ( process.env.WP_VERSION < 5.3 || process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
// eslint-disable-next-line jest/no-focused-tests
test.only( `skipping ${ block.name } tests`, () => {} );
describe( `${ block.name } Block`, () => {
beforeAll( async () => {
await switchUserToAdmin();

View File

@ -15,6 +15,10 @@ const block = {
class: '.wc-block-checkout',
};
if ( process.env.WP_VERSION < 5.3 || process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
// eslint-disable-next-line jest/no-focused-tests
test.only( `skipping ${ block.name } tests`, () => {} );
describe( `${ block.name } Block`, () => {
beforeAll( async () => {
await switchUserToAdmin();

View File

@ -9,6 +9,10 @@ import {
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
if ( process.env.WP_VERSION < 5.3 || process.env.WOOCOMMERCE_BLOCKS_PHASE < 3 )
// eslint-disable-next-line jest/no-focused-tests
test.only( 'skipping all other things', () => {} );
const block = {
name: 'Single Product',
slug: 'woocommerce/single-product',