Skip to content

Commit

Permalink
WIP: Initialise the Test Environment
Browse files Browse the repository at this point in the history
  • Loading branch information
mattallan committed Jul 14, 2020
1 parent b6b2bbe commit f0ec47d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ matrix:
include:
- name: "Coding standard check"
- name: "E2E tests"
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1
script:
- composer require wp-cli/i18n-command
- npm install jest --global
Expand Down
17 changes: 15 additions & 2 deletions tests/e2e/docker/initialize.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash

# Remove all pages - Docker wait-for-build uses a page with "ready" title to determine the environment is setup. We need to remove this file
wp post delete $(wp post list --post_type='page' --format=ids)

echo "Updating permalink structure"
wp rewrite structure '/%postname%/'

echo "Initializing WooCommerce E2E"
wp plugin install woocommerce --activate
wp theme install storefront --activate
wp user create customer [email protected] --user_pass=password --role=customer --path=/var/www/html
wp plugin activate woocommerce-gateway-paypal-express-checkout

echo "Adding basic WooCommerce settings..."
wp option set woocommerce_store_address "60 29th Street"
Expand All @@ -19,4 +22,14 @@ wp option set woocommerce_product_type "both"
wp option set woocommerce_allow_tracking "no"

echo "Importing WooCommerce shop pages..."
wp wc --user=admin tool run install_pages
wp wc --user=admin tool run install_pages

echo "Installing and activating the WordPress Importer plugin"
wp plugin install wordpress-importer --activate
echo "Importing the WooCommerce sample data..."
wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip

wp user create customer [email protected] --user_pass=password --role=customer
# Create the page which is used to determine if the test environment has been setup
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.'
echo "Success! E2E test environment has been setup"
6 changes: 3 additions & 3 deletions tests/e2e/setup/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ beforeAll( async () => {
capturePageEventsForTearDown();
enablePageDialogAccept();
observeConsoleLogging();
await trashExistingPosts();
await importSampleProducts();
// await trashExistingPosts();
// await importSampleProducts();
await setupBrowser();
} );

Expand All @@ -253,4 +253,4 @@ afterEach( async () => {

afterAll( () => {
removePageEvents();
} );
} );

0 comments on commit f0ec47d

Please sign in to comment.