Revert "k6 perf tests: Fix parsing of COT/HPOS environment variable" (#41265)
This commit is contained in:
commit
0b2ef557ae
|
@ -147,6 +147,8 @@ jobs:
|
|||
|
||||
- name: Load docker images and start containers.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
ENABLE_HPOS: 0
|
||||
run: |
|
||||
pnpm env:dev --filter=woocommerce
|
||||
pnpm env:performance-init --filter=woocommerce
|
||||
|
@ -262,4 +264,4 @@ jobs:
|
|||
-f pr_number=$PR_NUMBER \
|
||||
-f commit_sha=$COMMIT_SHA \
|
||||
-f s3_root=public \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
--repo woocommerce/woocommerce-test-reports
|
|
@ -1,4 +0,0 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Set default HPOS setting in k6 perf tests to enabled.
|
|
@ -80,9 +80,9 @@ admin_acc_login | set to true if site needs to use my account for admin login |
|
|||
customer_username | username for customer user | yes `__ENV.C_USER`
|
||||
customer_password | password for customer user | yes `__ENV.C_PW`
|
||||
customer_user_id | user id for customer user | yes `__ENV.C_UID`
|
||||
hpos_enabled | Default is `true`. Set to false if HPOS is disabled in the test site. | yes `__ENV.HPOS`
|
||||
cot_status | set to true if site is using order tables | yes `__ENV.COT`
|
||||
admin_orders_base_url | url part for order urls when posts table is used | no
|
||||
hpos_admin_orders_base_url | url part for order urls when orders table is used | no
|
||||
cot_admin_orders_base_url | url part for order urls when orders table is used | no
|
||||
addresses_customer_billing_* | billing address details for existing customer user | no
|
||||
addresses_guest_billing_* | billing address details for guest customer user | no
|
||||
payment_method | payment method (currently only `cod` supported) | no
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
HPOS="${HPOS:-true}"
|
||||
ENABLE_HPOS="${ENABLE_HPOS:-0}"
|
||||
|
||||
echo "Initializing WooCommerce E2E"
|
||||
|
||||
|
@ -32,17 +32,9 @@ wp-env run tests-cli wp import wp-content/plugins/woocommerce/sample-data/sample
|
|||
# install Storefront
|
||||
wp-env run tests-cli wp theme install storefront --activate
|
||||
|
||||
if [ $HPOS = true ]; then
|
||||
echo "Enabling HPOS..."
|
||||
wp-env run tests-cli wp option set woocommerce_custom_orders_table_enabled 'yes'
|
||||
if [ $ENABLE_HPOS == 1 ]; then
|
||||
echo -e 'Enable High-Performance Order Tables\n'
|
||||
wp-env run tests-cli wp plugin install https://gist.github.com/vedanshujain/564afec8f5e9235a1257994ed39b1449/archive/b031465052fc3e04b17624acbeeb2569ef4d5301.zip --activate
|
||||
fi
|
||||
|
||||
if [ $HPOS = false ]; then
|
||||
echo "Disabling HPOS..."
|
||||
wp-env run tests-cli wp option set woocommerce_custom_orders_table_enabled 'no'
|
||||
fi
|
||||
|
||||
# Print HPOS state
|
||||
wp-env run tests-cli wp option get woocommerce_custom_orders_table_enabled
|
||||
|
||||
echo "Success! Your E2E Test Environment is now ready."
|
||||
|
|
|
@ -4,17 +4,17 @@ export const base_host = __ENV.HOST || 'localhost:8086';
|
|||
|
||||
export const admin_username = __ENV.A_USER || 'admin';
|
||||
export const admin_password = __ENV.A_PW || 'password';
|
||||
export const admin_acc_login = __ENV.A_ACC_LOGIN === 'true';
|
||||
export const admin_acc_login = __ENV.A_ACC_LOGIN || false;
|
||||
|
||||
export const customer_username =
|
||||
__ENV.C_USER || 'customer@woocommercecoree2etestsuite.com';
|
||||
export const customer_password = __ENV.C_PW || 'password';
|
||||
export const customer_user_id = __ENV.C_UID || '2';
|
||||
|
||||
export const hpos_enabled = __ENV.HPOS !== 'false';
|
||||
export const cot_status = __ENV.COT || false;
|
||||
|
||||
export const admin_orders_base_url = 'edit.php?post_type=shop_order';
|
||||
export const hpos_admin_orders_base_url = 'admin.php?page=wc-orders';
|
||||
export const cot_admin_orders_base_url = 'admin.php?page=wc-orders';
|
||||
|
||||
export const addresses_customer_billing_first_name = 'John';
|
||||
export const addresses_customer_billing_last_name = 'Doe';
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
*/
|
||||
import {
|
||||
base_url,
|
||||
hpos_enabled,
|
||||
cot_status,
|
||||
addresses_guest_billing_first_name,
|
||||
addresses_guest_billing_last_name,
|
||||
addresses_guest_billing_company,
|
||||
|
@ -43,8 +43,9 @@ import {
|
|||
commonNonStandardHeaders,
|
||||
} from '../../headers.js';
|
||||
|
||||
// Change URL if HPOS is enabled and being used
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_new_order_base;
|
||||
let admin_new_order_assert;
|
||||
let admin_created_order_assert;
|
||||
let admin_open_order_base;
|
||||
let admin_open_order_assert;
|
||||
|
@ -54,15 +55,17 @@ let admin_update_order_id;
|
|||
let admin_update_order_params;
|
||||
let admin_update_order_assert;
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_new_order_base = 'admin.php?page=wc-orders&action=new';
|
||||
admin_update_order_base = 'admin.php?page=wc-orders&action=edit';
|
||||
admin_new_order_assert = 'post_status" type="hidden" value="pending';
|
||||
admin_open_order_assert = 'post_status" type="hidden" value="pending';
|
||||
admin_created_order_assert = 'Order updated.';
|
||||
admin_update_order_assert = 'changed from Pending payment to Completed';
|
||||
} else {
|
||||
admin_new_order_base = 'post-new.php?post_type=shop_order';
|
||||
admin_update_order_base = 'post.php';
|
||||
admin_new_order_assert = 'Add new order</h1>';
|
||||
admin_open_order_assert = 'Edit order</h1>';
|
||||
admin_created_order_assert = 'Order updated.';
|
||||
admin_update_order_assert = 'Order updated.';
|
||||
|
@ -113,7 +116,7 @@ export function addOrder( includeTests = {} ) {
|
|||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Add new order' header": ( response ) =>
|
||||
response.body.includes( 'Add new order' ),
|
||||
response.body.includes( `${ admin_new_order_assert }` ),
|
||||
} );
|
||||
|
||||
// Correlate nonce values for use in subsequent requests.
|
||||
|
@ -332,7 +335,7 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
const hposOrderParams = new URLSearchParams( [
|
||||
const cotOrderParams = new URLSearchParams( [
|
||||
[ '_ajax_nonce-add-meta', `${ ajax_nonce_add_meta }` ],
|
||||
[ '_billing_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_billing_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
|
@ -386,9 +389,9 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = hposOrderParams.toString();
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order = admin_update_order_base;
|
||||
admin_update_order_params = orderParams.toString();
|
||||
|
@ -424,7 +427,7 @@ export function addOrder( includeTests = {} ) {
|
|||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_open_order_base = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
} else {
|
||||
admin_open_order_base = `${ admin_update_order_base }?post=${ post_id }`;
|
||||
|
@ -523,7 +526,7 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
const hposOrderParams = new URLSearchParams( [
|
||||
const cotOrderParams = new URLSearchParams( [
|
||||
[ '_ajax_nonce-add-meta', `${ ajax_nonce_add_meta }` ],
|
||||
[ '_billing_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_billing_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
|
@ -577,9 +580,9 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order_id = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = hposOrderParams.toString();
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order_params = orderParams.toString();
|
||||
admin_update_order_id = `${ admin_open_order_base }`;
|
||||
|
@ -682,7 +685,7 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
const hposOrderParams = new URLSearchParams( [
|
||||
const cotOrderParams = new URLSearchParams( [
|
||||
[ '_ajax_nonce-add-meta', `${ ajax_nonce_add_meta }` ],
|
||||
[ '_billing_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_billing_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
|
@ -736,9 +739,9 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = hposOrderParams.toString();
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order = admin_update_order_base;
|
||||
admin_update_order_params = orderParams.toString();
|
||||
|
@ -772,7 +775,7 @@ export function addOrder( includeTests = {} ) {
|
|||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_open_order_base = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
} else {
|
||||
admin_open_order_base = `${ admin_update_order_base }?post=${ post_id }`;
|
||||
|
@ -869,7 +872,7 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
const hposOrderParams = new URLSearchParams( [
|
||||
const cotOrderParams = new URLSearchParams( [
|
||||
[ '_ajax_nonce-add-meta', `${ ajax_nonce_add_meta }` ],
|
||||
[ '_billing_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_billing_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
|
@ -923,9 +926,9 @@ export function addOrder( includeTests = {} ) {
|
|||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( hpos_enabled ) {
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order_id = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = hposOrderParams.toString();
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order_params = orderParams.toString();
|
||||
admin_update_order_id = `${ admin_open_order_base }`;
|
||||
|
|
|
@ -12,9 +12,9 @@ import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.1.0/index.js';
|
|||
*/
|
||||
import {
|
||||
base_url,
|
||||
hpos_enabled,
|
||||
cot_status,
|
||||
admin_orders_base_url,
|
||||
hpos_admin_orders_base_url,
|
||||
cot_admin_orders_base_url,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
customer_user_id,
|
||||
|
@ -31,11 +31,11 @@ const month = date.toJSON().slice( 5, 7 );
|
|||
const year = date.toJSON().slice( 0, 4 );
|
||||
const currentDate = `${ year }${ month }`;
|
||||
|
||||
// Change URL if HPOS is enabled and being used
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_filter_month_assert;
|
||||
if ( hpos_enabled ) {
|
||||
admin_orders_base = hpos_admin_orders_base_url;
|
||||
if ( cot_status === true ) {
|
||||
admin_orders_base = cot_admin_orders_base_url;
|
||||
admin_filter_month_assert = `selected='selected' value="${ currentDate }">`;
|
||||
} else {
|
||||
admin_orders_base = `${ admin_orders_base_url }&post_status=all`;
|
||||
|
|
|
@ -14,9 +14,9 @@ import {
|
|||
*/
|
||||
import {
|
||||
base_url,
|
||||
hpos_enabled,
|
||||
cot_status,
|
||||
admin_orders_base_url,
|
||||
hpos_admin_orders_base_url,
|
||||
cot_admin_orders_base_url,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
} from '../../config.js';
|
||||
|
@ -34,10 +34,10 @@ import {
|
|||
let heartbeat_nonce;
|
||||
let jar;
|
||||
|
||||
// Change URL if HPOS is enabled and being used
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
if ( hpos_enabled ) {
|
||||
admin_orders_base = hpos_admin_orders_base_url;
|
||||
if ( cot_status === true ) {
|
||||
admin_orders_base = cot_admin_orders_base_url;
|
||||
} else {
|
||||
admin_orders_base = admin_orders_base_url;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.1.0/index.js';
|
|||
*/
|
||||
import {
|
||||
base_url,
|
||||
hpos_enabled,
|
||||
cot_status,
|
||||
admin_orders_base_url,
|
||||
hpos_admin_orders_base_url,
|
||||
cot_admin_orders_base_url,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
product_search_term,
|
||||
|
@ -28,11 +28,11 @@ import {
|
|||
commonNonStandardHeaders,
|
||||
} from '../../headers.js';
|
||||
|
||||
// Change URL if HPOS is enabled and being used
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_search_assert;
|
||||
if ( hpos_enabled ) {
|
||||
admin_orders_base = hpos_admin_orders_base_url;
|
||||
if ( cot_status === true ) {
|
||||
admin_orders_base = cot_admin_orders_base_url;
|
||||
admin_search_assert = 'tbody id="the-list"';
|
||||
} else {
|
||||
admin_orders_base = `${ admin_orders_base_url }&post_status=all`;
|
||||
|
|
|
@ -15,9 +15,9 @@ import {
|
|||
*/
|
||||
import {
|
||||
base_url,
|
||||
hpos_enabled,
|
||||
cot_status,
|
||||
admin_orders_base_url,
|
||||
hpos_admin_orders_base_url,
|
||||
cot_admin_orders_base_url,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
} from '../../config.js';
|
||||
|
@ -33,11 +33,11 @@ import {
|
|||
commonNonStandardHeaders,
|
||||
} from '../../headers.js';
|
||||
|
||||
// Change URL if HPOS is enabled and being used
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_orders_completed;
|
||||
if ( hpos_enabled ) {
|
||||
admin_orders_base = hpos_admin_orders_base_url;
|
||||
if ( cot_status === true ) {
|
||||
admin_orders_base = cot_admin_orders_base_url;
|
||||
admin_orders_completed = 'status=wc-completed';
|
||||
} else {
|
||||
admin_orders_base = admin_orders_base_url;
|
||||
|
|
Loading…
Reference in New Issue