Consolidate check for 'Add new order' header text to handle both HPOS on and off configs.

This commit is contained in:
Rodel Calasagsag 2024-08-31 17:27:57 +08:00
parent 17876c23aa
commit 1cefb8d289
1 changed files with 1 additions and 4 deletions

View File

@ -45,7 +45,6 @@ import {
// Change URL if HPOS is enabled and being used // Change URL if HPOS is enabled and being used
let admin_new_order_base; let admin_new_order_base;
let admin_new_order_assert;
let admin_created_order_assert; let admin_created_order_assert;
let admin_open_order_base; let admin_open_order_base;
let admin_open_order_assert; let admin_open_order_assert;
@ -58,14 +57,12 @@ let admin_update_order_assert;
if ( hpos_status === true ) { if ( hpos_status === true ) {
admin_new_order_base = 'admin.php?page=wc-orders&action=new'; admin_new_order_base = 'admin.php?page=wc-orders&action=new';
admin_update_order_base = 'admin.php?page=wc-orders&action=edit'; 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_open_order_assert = 'post_status" type="hidden" value="pending';
admin_created_order_assert = 'Order updated.'; admin_created_order_assert = 'Order updated.';
admin_update_order_assert = 'changed from Pending payment to Completed'; admin_update_order_assert = 'changed from Pending payment to Completed';
} else { } else {
admin_new_order_base = 'post-new.php?post_type=shop_order'; admin_new_order_base = 'post-new.php?post_type=shop_order';
admin_update_order_base = 'post.php'; admin_update_order_base = 'post.php';
admin_new_order_assert = 'Add new order</h1>';
admin_open_order_assert = 'Edit order</h1>'; admin_open_order_assert = 'Edit order</h1>';
admin_created_order_assert = 'Order updated.'; admin_created_order_assert = 'Order updated.';
admin_update_order_assert = 'Order updated.'; admin_update_order_assert = 'Order updated.';
@ -116,7 +113,7 @@ export function addOrder( includeTests = {} ) {
check( response, { check( response, {
'is status 200': ( r ) => r.status === 200, 'is status 200': ( r ) => r.status === 200,
"body contains: 'Add new order' header": ( response ) => "body contains: 'Add new order' header": ( response ) =>
response.body.includes( `${ admin_new_order_assert }` ), response.body.includes( 'Add new order' ),
} ); } );
// Correlate nonce values for use in subsequent requests. // Correlate nonce values for use in subsequent requests.