Skip to content

Commit a5c5b31

Browse files
author
mattallan
committed
WIP: Initialise the Test Environment
1 parent b6b2bbe commit a5c5b31

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

tests/e2e/docker/initialize.sh

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#!/bin/bash
22

3+
# 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
4+
wp post delete $(wp post list --post_type='page' --format=ids)
5+
36
echo "Updating permalink structure"
47
wp rewrite structure '/%postname%/'
58

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

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

2124
echo "Importing WooCommerce shop pages..."
22-
wp wc --user=admin tool run install_pages
25+
wp wc --user=admin tool run install_pages
26+
27+
echo "Installing and activating the WordPress Importer plugin"
28+
wp plugin install wordpress-importer --activate
29+
echo "Importing the WooCommerce sample data..."
30+
wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip
31+
32+
wp user create customer [email protected] --user_pass=password --role=customer
33+
# Create the page which is used to determine if the test environment has been setup
34+
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.'
35+
echo "Success! E2E test environment has been setup"

tests/e2e/setup/jest-setup.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ beforeAll( async () => {
243243
enablePageDialogAccept();
244244
observeConsoleLogging();
245245
await trashExistingPosts();
246-
await importSampleProducts();
246+
// await importSampleProducts();
247247
await setupBrowser();
248248
} );
249249

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

254254
afterAll( () => {
255255
removePageEvents();
256-
} );
256+
} );

tests/e2e/specs/example.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import config from 'config';
88
*/
99
import { CustomerFlow, uiUnblocked } from '../utils';
1010

11-
const TIMEOUT = 5000;
11+
const TIMEOUT = 20000;
1212

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

0 commit comments

Comments
 (0)