Skip to content

WIP: Setup E2E testing using @woocommerce/e2e-environment #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { esLintConfig: baseConfig } = require( '@woocommerce/e2e-environment' );

module.exports = {
...baseConfig,
root: true,
parser: 'babel-eslint',
extends: [
...baseConfig.extends,
'wpcalypso/react',
'plugin:jsx-a11y/recommended',
],
plugins: [
...baseConfig.plugins,
'jsx-a11y',
],
env: {
...baseConfig.env,
browser: true,
node: true,
},
globals: {
...baseConfig.globals,
wp: true,
wpApiSettings: true,
wcSettings: true,
},
};
21 changes: 20 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
language: php
os: linux
dist: xenial
sudo: false

notifications:
email: false

services:
- docker

php:
- 7.0

matrix:
fast_finish: true
include:
- name: "Coding standard check"
- name: "E2E tests"
script:
- npm install jest --global
- npm run docker:up
- npm run test:e2e
after_script:
- npm run docker:down

branches:
only:
- master

before_install:
- nvm install lts/erbium
- nvm install 10

install:
- npm install
- composer install

script:
Expand Down
13 changes: 13 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { babelConfig: e2eBabelConfig } = require( '@woocommerce/e2e-environment' );

module.exports = function( api ) {
api.cache( true );

return {
...e2eBabelConfig,
presets: [
...e2eBabelConfig.presets,
'@wordpress/babel-preset-default',
],
};
};
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.3'

services:

wordpress-www:
volumes:
# This path is relative to the first config file
# which is in node_modules/@woocommerce/e2e/env
- "../../../:/var/www/html/wp-content/plugins/woocommerce-gateway-paypal-express-checkout"

wordpress-cli:
volumes:
- "../../../:/var/www/html/wp-content/plugins/woocommerce-gateway-paypal-express-checkout"
1 change: 1 addition & 0 deletions includes/class-wc-gateway-ppec-cart-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ public function enqueue_scripts() {
'components' => 'buttons,funding-eligibility',
'commit' => 'checkout' === $page ? 'true' : 'false',
'currency' => get_woocommerce_currency(),
'buyer-country' => 'US',
);

$script_args = apply_filters( 'woocommerce_paypal_express_checkout_sdk_script_args', $script_args, $settings, $client );
Expand Down
Loading