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 a5c5b31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
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"
4 changes: 2 additions & 2 deletions tests/e2e/setup/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ beforeAll( async () => {
enablePageDialogAccept();
observeConsoleLogging();
await trashExistingPosts();
await importSampleProducts();
// await importSampleProducts();
await setupBrowser();
} );

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

afterAll( () => {
removePageEvents();
} );
} );
2 changes: 1 addition & 1 deletion tests/e2e/specs/example.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import config from 'config';
*/
import { CustomerFlow, uiUnblocked } from '../utils';

const TIMEOUT = 5000;
const TIMEOUT = 20000;

describe( 'Example Checkout Test', () => {
it( 'Adds a simple product to the cart and loads checkout page', async () => {
Expand Down

0 comments on commit a5c5b31

Please sign in to comment.