k6: add additional merchant and API order tests (#34707)
* Expanded k6 merchant order tests * Adding additional k6 merchant and api order requests * Added changelog * Added Changelog * Update k6 search filter test to use customer ID * Update k6 README for update to config * Removed Order Filters from k6 daily external tests until the workflow can be updated * Updated k6 requests for HPOS * Add k6 completed orders merchant request
This commit is contained in:
parent
739ce306e1
commit
7cb84e5b2d
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: add
|
||||
Comment: Additional k6 order tests
|
||||
|
||||
|
|
@ -79,6 +79,7 @@ admin_password | password for admin user | yes `__ENV.A_PW`
|
|||
admin_acc_login | set to true if site needs to use my account for admin login | yes `__ENV.A_PW`
|
||||
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`
|
||||
cot_status | set to true if site is using order tables | yes `__ENV.C_PW`
|
||||
admin_orders_base_url | url part for order urls when posts table is used | no
|
||||
cot_admin_orders_base_url | url part for order urls when orders table is used | no
|
||||
|
|
|
@ -9,6 +9,7 @@ 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 cot_status = __ENV.COT || false;
|
||||
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
/* eslint-disable no-shadow */
|
||||
/* eslint-disable import/no-unresolved */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import encoding from 'k6/encoding';
|
||||
import http from 'k6/http';
|
||||
import { check, group } from 'k6';
|
||||
import { findBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
base_url,
|
||||
admin_username,
|
||||
admin_password,
|
||||
addresses_guest_billing_first_name,
|
||||
addresses_guest_billing_last_name,
|
||||
addresses_guest_billing_country,
|
||||
addresses_guest_billing_address_1,
|
||||
addresses_guest_billing_address_2,
|
||||
addresses_guest_billing_city,
|
||||
addresses_guest_billing_state,
|
||||
addresses_guest_billing_postcode,
|
||||
addresses_guest_billing_phone,
|
||||
addresses_guest_billing_email,
|
||||
} from '../../config.js';
|
||||
|
||||
export function ordersAPI() {
|
||||
const credentials = `${ admin_username }:${ admin_password }`;
|
||||
const encodedCredentials = encoding.b64encode( credentials );
|
||||
const requestHeaders = {
|
||||
Authorization: `Basic ${ encodedCredentials }`,
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
|
||||
const createData = {
|
||||
billing: {
|
||||
first_name: `${ addresses_guest_billing_first_name }`,
|
||||
last_name: `${ addresses_guest_billing_last_name }`,
|
||||
address_1: `${ addresses_guest_billing_address_1 }`,
|
||||
address_2: `${ addresses_guest_billing_address_2 }`,
|
||||
city: `${ addresses_guest_billing_city }`,
|
||||
state: `${ addresses_guest_billing_state }`,
|
||||
postcode: `${ addresses_guest_billing_postcode }`,
|
||||
country: `${ addresses_guest_billing_country }`,
|
||||
email: `${ addresses_guest_billing_email }`,
|
||||
phone: `${ addresses_guest_billing_phone }`,
|
||||
},
|
||||
shipping: {
|
||||
first_name: `${ addresses_guest_billing_first_name }`,
|
||||
last_name: `${ addresses_guest_billing_last_name }`,
|
||||
address_1: `${ addresses_guest_billing_address_1 }`,
|
||||
address_2: `${ addresses_guest_billing_address_2 }`,
|
||||
city: `${ addresses_guest_billing_city }`,
|
||||
state: `${ addresses_guest_billing_state }`,
|
||||
postcode: `${ addresses_guest_billing_postcode }`,
|
||||
country: `${ addresses_guest_billing_country }`,
|
||||
},
|
||||
};
|
||||
|
||||
let batchData;
|
||||
const createBatchData = [];
|
||||
const updateBatchData = [];
|
||||
|
||||
const batchSize = 10;
|
||||
|
||||
const updateData = {
|
||||
status: 'completed',
|
||||
};
|
||||
let post_id;
|
||||
let post_ids;
|
||||
let response;
|
||||
|
||||
group( 'API Create Order', function () {
|
||||
response = http.post(
|
||||
`${ base_url }/wp-json/wc/v3/orders`,
|
||||
JSON.stringify( createData ),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - Create Order' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 201': ( r ) => r.status === 201,
|
||||
"body contains: 'Pending' Status": ( response ) =>
|
||||
response.body.includes( '"status":"pending"' ),
|
||||
} );
|
||||
|
||||
post_id = findBetween( response.body, '{"id":', ',' );
|
||||
} );
|
||||
|
||||
group( 'API Retrieve Order', function () {
|
||||
response = http.get(
|
||||
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - Retrieve Order' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
'body contains: Order ID': ( response ) =>
|
||||
response.body.includes( `"id":${ post_id }` ),
|
||||
} );
|
||||
} );
|
||||
|
||||
group( 'API List Orders', function () {
|
||||
response = http.get( `${ base_url }/wp-json/wc/v3/orders`, {
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - List Orders' },
|
||||
} );
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
'body contains: Order ID': ( response ) =>
|
||||
response.body.includes( '[{"id":' ),
|
||||
} );
|
||||
} );
|
||||
|
||||
group( 'API Update Order', function () {
|
||||
response = http.put(
|
||||
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
|
||||
JSON.stringify( updateData ),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - Update Order (Status)' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Completed' Status": ( response ) =>
|
||||
response.body.includes( '"status":"completed"' ),
|
||||
} );
|
||||
} );
|
||||
|
||||
group( 'API Delete Order', function () {
|
||||
response = http.del(
|
||||
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
|
||||
JSON.stringify( { force: true } ),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - Delete Order' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
'body contains: Order ID': ( response ) =>
|
||||
response.body.includes( `"id":${ post_id }` ),
|
||||
} );
|
||||
} );
|
||||
|
||||
group( 'API Batch Create Orders', function () {
|
||||
for ( let index = 0; index < batchSize; index++ ) {
|
||||
createBatchData.push( createData );
|
||||
}
|
||||
batchData = {
|
||||
create: createBatchData,
|
||||
};
|
||||
|
||||
response = http.post(
|
||||
`${ base_url }/wp-json/wc/v3/orders/batch`,
|
||||
JSON.stringify( batchData ),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'API - Batch Create Orders' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
'body contains: Create batch prefix': ( response ) =>
|
||||
response.body.includes( 'create":[{"id"' ),
|
||||
} );
|
||||
|
||||
post_ids = findBetween( response.body, '{"id":', ',"parent_id', true );
|
||||
} );
|
||||
|
||||
group( 'API Batch Update Orders', function () {
|
||||
let updateBatchItem;
|
||||
|
||||
for ( let index = 0; index < batchSize; index++ ) {
|
||||
updateBatchItem = {
|
||||
id: `${ post_ids[ index ] }`,
|
||||
status: 'completed',
|
||||
};
|
||||
updateBatchData.push( updateBatchItem );
|
||||
}
|
||||
batchData = {
|
||||
update: updateBatchData,
|
||||
};
|
||||
|
||||
response = http.post(
|
||||
`${ base_url }/wp-json/wc/v3/orders/batch`,
|
||||
JSON.stringify( batchData ),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: {
|
||||
name: 'API - Batch Update (Status) Orders',
|
||||
},
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'status is 200': ( r ) => r.status === 200,
|
||||
'body contains: Update batch prefix': ( response ) =>
|
||||
response.body.includes( 'update":[{"id"' ),
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
export default function () {
|
||||
ordersAPI();
|
||||
}
|
|
@ -0,0 +1,587 @@
|
|||
/* eslint-disable no-shadow */
|
||||
/* eslint-disable import/no-unresolved */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { sleep, check, group } from 'k6';
|
||||
import http from 'k6/http';
|
||||
import {
|
||||
randomIntBetween,
|
||||
findBetween,
|
||||
} from 'https://jslib.k6.io/k6-utils/1.1.0/index.js';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
base_url,
|
||||
cot_status,
|
||||
addresses_guest_billing_first_name,
|
||||
addresses_guest_billing_last_name,
|
||||
addresses_guest_billing_company,
|
||||
addresses_guest_billing_country,
|
||||
addresses_guest_billing_address_1,
|
||||
addresses_guest_billing_address_2,
|
||||
addresses_guest_billing_city,
|
||||
addresses_guest_billing_state,
|
||||
addresses_guest_billing_postcode,
|
||||
addresses_guest_billing_phone,
|
||||
addresses_guest_billing_email,
|
||||
payment_method,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
} from '../../config.js';
|
||||
import {
|
||||
htmlRequestHeader,
|
||||
jsonAPIRequestHeader,
|
||||
jsonRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
contentTypeRequestHeader,
|
||||
commonPostRequestHeaders,
|
||||
commonAPIGetRequestHeaders,
|
||||
commonNonStandardHeaders,
|
||||
} from '../../headers.js';
|
||||
|
||||
// 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;
|
||||
let admin_update_order_base;
|
||||
let admin_update_order_id;
|
||||
let admin_update_order_params;
|
||||
let admin_update_order_assert;
|
||||
|
||||
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 = 'Edit order </h1>';
|
||||
admin_open_order_assert = 'Edit order </h1>';
|
||||
admin_created_order_assert = 'changed from auto-draft to';
|
||||
admin_update_order_assert = 'changed from auto-draft to';
|
||||
} 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.';
|
||||
}
|
||||
|
||||
const date = new Date();
|
||||
const order_date = date.toJSON().slice( 0, 10 );
|
||||
|
||||
export function addOrder() {
|
||||
let response;
|
||||
let ajax_nonce_add_meta;
|
||||
let wpnonce;
|
||||
let closed_postboxes_nonce;
|
||||
let sample_permalink_nonce;
|
||||
let woocommerce_meta_nonce;
|
||||
let meta_box_order_nonce;
|
||||
let post_id;
|
||||
let hpos_post_id;
|
||||
let api_x_wp_nonce;
|
||||
let apiNonceHeader;
|
||||
let heartbeat_nonce;
|
||||
|
||||
group( 'Add Order', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_new_order_base }`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - New Order Page' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Add new order' header": ( response ) =>
|
||||
response.body.includes( `${ admin_new_order_assert }` ),
|
||||
} );
|
||||
|
||||
// Correlate nonce values for use in subsequent requests.
|
||||
ajax_nonce_add_meta = response
|
||||
.html()
|
||||
.find( 'input[id=_ajax_nonce-add-meta]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
wpnonce = response
|
||||
.html()
|
||||
.find( 'input[id=_wpnonce]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
closed_postboxes_nonce = response
|
||||
.html()
|
||||
.find( 'input[id=closedpostboxesnonce]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
sample_permalink_nonce = response
|
||||
.html()
|
||||
.find( 'input[id=samplepermalinknonce]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
woocommerce_meta_nonce = response
|
||||
.html()
|
||||
.find( 'input[id=woocommerce_meta_nonce]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
meta_box_order_nonce = response
|
||||
.html()
|
||||
.find( 'input[id=meta-box-order-nonce]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
post_id = response
|
||||
.html()
|
||||
.find( 'input[id=post_ID]' )
|
||||
.first()
|
||||
.attr( 'value' );
|
||||
hpos_post_id = findBetween( response.body, 'post_id":"', '",' );
|
||||
heartbeat_nonce = findBetween(
|
||||
response.body,
|
||||
'heartbeatSettings = {"nonce":"',
|
||||
'"};'
|
||||
);
|
||||
api_x_wp_nonce = findBetween(
|
||||
response.body,
|
||||
'wp.apiFetch.createNonceMiddleware( "',
|
||||
'" )'
|
||||
);
|
||||
|
||||
// Create request header with nonce value for use in subsequent requests.
|
||||
apiNonceHeader = {
|
||||
'x-wp-nonce': `${ api_x_wp_nonce }`,
|
||||
};
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
|
||||
group( 'All Orders - Other Requests', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
jsonAPIRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonAPIGetRequestHeaders,
|
||||
apiNonceHeader,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-json/wc-admin/onboarding/tasks?_locale=user`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - wc-admin/onboarding/tasks?' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
} );
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-json/wc-analytics/admin/notes?page=1&per_page=25&` +
|
||||
`type=error%2Cupdate&status=unactioned&_locale=user`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - wc-analytics/admin/notes?' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
} );
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-json/wc-admin/options?options=woocommerce_ces_tracks_queue&_locale=user`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: {
|
||||
name: 'Merchant - wc-admin/options?options=woocommerce_ces_tracks_queue',
|
||||
},
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
} );
|
||||
} );
|
||||
|
||||
group( 'WP Admin Heartbeat', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
jsonRequestHeader,
|
||||
commonRequestHeaders,
|
||||
contentTypeRequestHeader,
|
||||
commonPostRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.post(
|
||||
`${ base_url }/wp-admin/admin-ajax.php`,
|
||||
`_nonce=${ heartbeat_nonce }&action=heartbeat&has_focus=true&interval=15&screen_id=shop_order`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - action=heartbeat' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
} );
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
|
||||
group( 'Create New Order', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
contentTypeRequestHeader,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
const date = new Date();
|
||||
const order_date = date.toJSON().slice( 0, 10 );
|
||||
|
||||
const orderParams = 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 }` ],
|
||||
[ '_billing_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_billing_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_billing_country', `${ addresses_guest_billing_country }` ],
|
||||
[ '_billing_email', `${ addresses_guest_billing_email }` ],
|
||||
[
|
||||
'_billing_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_billing_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_billing_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_billing_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_billing_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_shipping_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_shipping_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
[ '_shipping_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_shipping_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_shipping_country', `${ addresses_guest_billing_country }` ],
|
||||
[
|
||||
'_shipping_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_shipping_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_shipping_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_shipping_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_shipping_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_payment_method', `${ payment_method }` ],
|
||||
[ '_transaction_id', '' ],
|
||||
[ '_wp_http_referer', '' ],
|
||||
[ '_wp_original_http_referer', '' ],
|
||||
[ '_wpnonce', `${ wpnonce }` ],
|
||||
[ 'action', 'editpost' ],
|
||||
[ 'auto_draft', '1' ], //no
|
||||
[ 'closedpostboxesnonce', `${ closed_postboxes_nonce }` ],
|
||||
[ 'customer_user', '' ],
|
||||
[ 'excerpt', '' ],
|
||||
[ 'meta-box-order-nonce', `${ meta_box_order_nonce }` ],
|
||||
[ 'metakeyinput', '' ],
|
||||
[ 'metakeyselect', '%23NONE%23' ],
|
||||
[ 'metavalue', '' ],
|
||||
[ 'order_date', `${ order_date }` ],
|
||||
[ 'order_date_hour', '01' ],
|
||||
[ 'order_date_minute', '01' ],
|
||||
[ 'order_date_second', '01' ],
|
||||
[ 'order_note', '' ],
|
||||
[ 'order_note_type', '' ],
|
||||
[ 'order_status', 'wc-pending' ], //change
|
||||
[ 'original_post_status', 'auto-draft' ], //wc-pending
|
||||
[ 'original_post_title', '' ], //string
|
||||
[ 'originalaction', 'editpost' ],
|
||||
[ 'post_ID', `${ post_id }` ],
|
||||
[ 'post_author', '1' ],
|
||||
[ 'post_status', 'auto-draft' ], //pending
|
||||
[ 'post_title', '%2COrder' ], //string
|
||||
[ 'post_type', 'shop_order' ],
|
||||
[ 'referredby', '' ],
|
||||
[ 'samplepermalinknonce', `${ sample_permalink_nonce }` ],
|
||||
[ 'save', 'Create' ], //Update
|
||||
[ 'user_ID', '1' ],
|
||||
[ 'wc_order_action', '' ],
|
||||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
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 }` ],
|
||||
[ '_billing_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_billing_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_billing_country', `${ addresses_guest_billing_country }` ],
|
||||
[ '_billing_email', `${ addresses_guest_billing_email }` ],
|
||||
[
|
||||
'_billing_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_billing_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_billing_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_billing_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_billing_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_shipping_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_shipping_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
[ '_shipping_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_shipping_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_shipping_country', `${ addresses_guest_billing_country }` ],
|
||||
[
|
||||
'_shipping_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_shipping_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_shipping_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_shipping_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_shipping_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_payment_method', `${ payment_method }` ],
|
||||
[ '_transaction_id', '' ],
|
||||
[ '_wp_http_referer', '' ],
|
||||
[ '_wpnonce', `${ wpnonce }` ],
|
||||
[ 'action', 'edit_order' ],
|
||||
[ 'customer_user', '' ],
|
||||
[ 'excerpt', '' ],
|
||||
[ 'metakeyinput', '' ],
|
||||
[ 'metavalue', '' ],
|
||||
[ 'order_date', `${ order_date }` ],
|
||||
[ 'order_date_hour', '01' ],
|
||||
[ 'order_date_minute', '01' ],
|
||||
[ 'order_date_second', '01' ],
|
||||
[ 'order_note', '' ],
|
||||
[ 'order_note_type', '' ],
|
||||
[ 'order_status', 'wc-pending' ],
|
||||
[ 'original_order_status', 'auto-draft' ], //pending
|
||||
[ 'post_status', 'auto-draft' ], //pending
|
||||
[ 'post_title', 'Order' ],
|
||||
[ 'referredby', '' ],
|
||||
[ 'save', 'Create' ], //Save
|
||||
[ 'wc_order_action', '' ],
|
||||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order_base = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order_params = orderParams.toString();
|
||||
}
|
||||
|
||||
response = http.post(
|
||||
`${ base_url }/wp-admin/${ admin_update_order_base }`,
|
||||
admin_update_order_params.toString(),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Create New Order' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Edit order' header": ( response ) =>
|
||||
response.body.includes( `${ admin_open_order_assert }` ),
|
||||
"body contains: 'Order updated' confirmation": ( response ) =>
|
||||
response.body.includes( `${ admin_created_order_assert }` ),
|
||||
} );
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
|
||||
group( 'Open Order', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
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 }`;
|
||||
}
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_open_order_base }&action=edit`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Open Order' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Edit order' header": ( response ) =>
|
||||
response.body.includes( `${ admin_open_order_assert }` ),
|
||||
} );
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
|
||||
group( 'Update Order', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
contentTypeRequestHeader,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
const orderParams = 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 }` ],
|
||||
[ '_billing_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_billing_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_billing_country', `${ addresses_guest_billing_country }` ],
|
||||
[ '_billing_email', `${ addresses_guest_billing_email }` ],
|
||||
[
|
||||
'_billing_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_billing_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_billing_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_billing_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_billing_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_shipping_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_shipping_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
[ '_shipping_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_shipping_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_shipping_country', `${ addresses_guest_billing_country }` ],
|
||||
[
|
||||
'_shipping_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_shipping_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_shipping_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_shipping_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_shipping_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_payment_method', `${ payment_method }` ],
|
||||
[ '_transaction_id', '' ],
|
||||
[ '_wp_http_referer', '' ],
|
||||
[ '_wp_original_http_referer', '' ],
|
||||
[ '_wpnonce', `${ wpnonce }` ],
|
||||
[ 'action', 'editpost' ],
|
||||
[ 'closedpostboxesnonce', `${ closed_postboxes_nonce }` ],
|
||||
[ 'customer_user', '' ],
|
||||
[ 'excerpt', '' ],
|
||||
[ 'meta-box-order-nonce', `${ meta_box_order_nonce }` ],
|
||||
[ 'metakeyinput', '' ],
|
||||
[ 'metakeyselect', '%23NONE%23' ],
|
||||
[ 'metavalue', '' ],
|
||||
[ 'order_date', `${ order_date }` ],
|
||||
[ 'order_date_hour', '01' ],
|
||||
[ 'order_date_minute', '01' ],
|
||||
[ 'order_date_second', '01' ],
|
||||
[ 'order_note', '' ],
|
||||
[ 'order_note_type', '' ],
|
||||
[ 'order_status', 'wc-completed' ],
|
||||
[ 'original_post_status', 'wc-pending' ],
|
||||
[ 'original_post_title', '' ], //string
|
||||
[ 'originalaction', 'editpost' ],
|
||||
[ 'post_ID', `${ post_id }` ],
|
||||
[ 'post_author', '1' ],
|
||||
[ 'post_status', 'pending' ],
|
||||
[ 'post_title', '%2COrder' ], //string
|
||||
[ 'post_type', 'shop_order' ],
|
||||
[ 'referredby', '' ],
|
||||
[ 'samplepermalinknonce', `${ sample_permalink_nonce }` ],
|
||||
[ 'save', 'Update' ],
|
||||
[ 'user_ID', '1' ],
|
||||
[ 'wc_order_action', '' ],
|
||||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
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 }` ],
|
||||
[ '_billing_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_billing_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_billing_country', `${ addresses_guest_billing_country }` ],
|
||||
[ '_billing_email', `${ addresses_guest_billing_email }` ],
|
||||
[
|
||||
'_billing_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_billing_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_billing_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_billing_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_billing_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_shipping_address_1', `${ addresses_guest_billing_address_1 }` ],
|
||||
[ '_shipping_address_2', `${ addresses_guest_billing_address_2 }` ],
|
||||
[ '_shipping_city', `${ addresses_guest_billing_city }` ],
|
||||
[ '_shipping_company', `${ addresses_guest_billing_company }` ],
|
||||
[ '_shipping_country', `${ addresses_guest_billing_country }` ],
|
||||
[
|
||||
'_shipping_first_name',
|
||||
`${ addresses_guest_billing_first_name }`,
|
||||
],
|
||||
[ '_shipping_last_name', `${ addresses_guest_billing_last_name }` ],
|
||||
[ '_shipping_phone', `${ addresses_guest_billing_phone }` ],
|
||||
[ '_shipping_postcode', `${ addresses_guest_billing_postcode }` ],
|
||||
[ '_shipping_state', `${ addresses_guest_billing_state }` ],
|
||||
[ '_payment_method', `${ payment_method }` ],
|
||||
[ '_transaction_id', '' ],
|
||||
[ '_wp_http_referer', '' ],
|
||||
[ '_wpnonce', `${ wpnonce }` ],
|
||||
[ 'action', 'edit_order' ],
|
||||
[ 'customer_user', '' ],
|
||||
[ 'excerpt', '' ],
|
||||
[ 'metakeyinput', '' ],
|
||||
[ 'metavalue', '' ],
|
||||
[ 'order_date', `${ order_date }` ],
|
||||
[ 'order_date_hour', '01' ],
|
||||
[ 'order_date_minute', '01' ],
|
||||
[ 'order_date_second', '01' ],
|
||||
[ 'order_note', '' ],
|
||||
[ 'order_note_type', '' ],
|
||||
[ 'order_status', 'wc-completed' ],
|
||||
[ 'original_order_status', 'pending' ],
|
||||
[ 'post_status', 'pending' ],
|
||||
[ 'post_title', 'Order' ],
|
||||
[ 'referredby', '' ],
|
||||
[ 'save', 'Save' ],
|
||||
[ 'wc_order_action', '' ],
|
||||
[ 'woocommerce_meta_nonce', `${ woocommerce_meta_nonce }` ],
|
||||
] );
|
||||
|
||||
if ( cot_status === true ) {
|
||||
admin_update_order_id = `${ admin_update_order_base }&id=${ hpos_post_id }`;
|
||||
admin_update_order_params = cotOrderParams.toString();
|
||||
} else {
|
||||
admin_update_order_params = orderParams.toString();
|
||||
admin_update_order_id = `${ admin_open_order_base }`;
|
||||
}
|
||||
|
||||
response = http.post(
|
||||
`${ base_url }/wp-admin/${ admin_update_order_id }`,
|
||||
admin_update_order_params.toString(),
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Update Existing Order Status' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Edit order' header": ( response ) =>
|
||||
response.body.includes( `${ admin_open_order_assert }` ),
|
||||
"body contains: 'Order updated' confirmation": ( response ) =>
|
||||
response.body.includes( `${ admin_update_order_assert }` ),
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
export default function () {
|
||||
addOrder();
|
||||
}
|
|
@ -46,9 +46,7 @@ export function myAccountMerchantLogin() {
|
|||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'My account' title": ( response ) =>
|
||||
response.body.includes(
|
||||
'<h1 class="entry-title">My account</h1>'
|
||||
),
|
||||
response.body.includes( '>My account</h1>' ),
|
||||
} );
|
||||
|
||||
// Correlate nonce value for use in subsequent requests.
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/* eslint-disable import/no-unresolved */
|
||||
/* eslint-disable no-shadow */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { sleep, check, group } from 'k6';
|
||||
import http from 'k6/http';
|
||||
import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.1.0/index.js';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import {
|
||||
base_url,
|
||||
cot_status,
|
||||
admin_orders_base_url,
|
||||
cot_admin_orders_base_url,
|
||||
think_time_min,
|
||||
think_time_max,
|
||||
customer_user_id,
|
||||
} from '../../config.js';
|
||||
import {
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders,
|
||||
} from '../../headers.js';
|
||||
|
||||
const date = new Date();
|
||||
const month = date.toJSON().slice( 5, 7 );
|
||||
const year = date.toJSON().slice( 0, 4 );
|
||||
const currentDate = `${ year }${ month }`;
|
||||
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_filter_month_assert;
|
||||
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`;
|
||||
admin_filter_month_assert = `selected='selected' value='${ currentDate }'>`;
|
||||
}
|
||||
|
||||
export function ordersFilter() {
|
||||
let response;
|
||||
|
||||
group( 'Orders Filter', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_orders_base }` +
|
||||
`&s&action=-1&m=${ currentDate }&_customer_user&filter_action=Filter&paged=1&action2=-1`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Filter Orders By Month' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
'body contains: filter set to selected month': ( response ) =>
|
||||
response.body.includes( `${ admin_filter_month_assert }` ),
|
||||
} );
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_orders_base }` +
|
||||
`&s&action=-1&m=0&_customer_user=${ customer_user_id }&filter_action=Filter&paged=1&action2=-1`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Filter Orders By Customer' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
'body contains: filter set to selected customer': ( response ) =>
|
||||
response.body.includes(
|
||||
`<option value="${ customer_user_id }" selected="selected">`
|
||||
),
|
||||
} );
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
}
|
||||
|
||||
export default function () {
|
||||
ordersFilter();
|
||||
}
|
|
@ -18,6 +18,8 @@ import {
|
|||
think_time_min,
|
||||
think_time_max,
|
||||
product_search_term,
|
||||
addresses_customer_billing_email,
|
||||
addresses_customer_billing_postcode,
|
||||
} from '../../config.js';
|
||||
import {
|
||||
htmlRequestHeader,
|
||||
|
@ -28,10 +30,13 @@ import {
|
|||
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_search_assert;
|
||||
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;
|
||||
admin_orders_base = `${ admin_orders_base_url }&post_status=all`;
|
||||
admin_search_assert = 'Search results for:';
|
||||
}
|
||||
|
||||
export function ordersSearch() {
|
||||
|
@ -58,7 +63,37 @@ export function ordersSearch() {
|
|||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Search results' subtitle": ( response ) =>
|
||||
response.body.includes( 'Search results for:' ),
|
||||
response.body.includes( `${ admin_search_assert }` ),
|
||||
} );
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_orders_base }` +
|
||||
`&s=${ addresses_customer_billing_email }&action=-1&m=0&_customer_user&` +
|
||||
`paged=1&action2=-1`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Search Orders By Customer Email' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Search results' subtitle": ( response ) =>
|
||||
response.body.includes( `${ admin_search_assert }` ),
|
||||
} );
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_orders_base }` +
|
||||
`&s=${ addresses_customer_billing_postcode }&action=-1&m=0&_customer_user&` +
|
||||
`paged=1&action2=-1`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Search Orders By Customer Address' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Search results' subtitle": ( response ) =>
|
||||
response.body.includes( `${ admin_search_assert }` ),
|
||||
} );
|
||||
} );
|
||||
|
||||
|
|
|
@ -35,10 +35,13 @@ import {
|
|||
|
||||
// Change URL if COT is enabled and being used
|
||||
let admin_orders_base;
|
||||
let admin_orders_completed;
|
||||
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;
|
||||
admin_orders_completed = 'post_status=wc-completed';
|
||||
}
|
||||
|
||||
export function orders() {
|
||||
|
@ -157,6 +160,31 @@ export function orders() {
|
|||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
|
||||
group( 'Completed Orders', function () {
|
||||
const requestHeaders = Object.assign(
|
||||
{},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.get(
|
||||
`${ base_url }/wp-admin/${ admin_orders_base }&${ admin_orders_completed }`,
|
||||
{
|
||||
headers: requestHeaders,
|
||||
tags: { name: 'Merchant - Completed Orders' },
|
||||
}
|
||||
);
|
||||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'Orders' header": ( response ) =>
|
||||
response.body.includes( 'Orders</h1>' ),
|
||||
} );
|
||||
} );
|
||||
|
||||
sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
|
||||
}
|
||||
|
||||
export default function () {
|
||||
|
|
|
@ -46,9 +46,7 @@ export function myAccount() {
|
|||
check( response, {
|
||||
'is status 200': ( r ) => r.status === 200,
|
||||
"body contains: 'My account' title": ( response ) =>
|
||||
response.body.includes(
|
||||
'<h1 class="entry-title">My account</h1>'
|
||||
),
|
||||
response.body.includes( '>My account</h1>' ),
|
||||
} );
|
||||
|
||||
// Correlate nonce value for use in subsequent requests.
|
||||
|
|
|
@ -9,18 +9,21 @@ import { cart } from '../requests/shopper/cart.js';
|
|||
import { cartRemoveItem } from '../requests/shopper/cart-remove-item.js';
|
||||
import { checkoutGuest } from '../requests/shopper/checkout-guest.js';
|
||||
import { checkoutCustomerLogin } from '../requests/shopper/checkout-customer-login.js';
|
||||
import { coupons } from '../requests/merchant/coupons.js';
|
||||
import { myAccount } from '../requests/shopper/my-account.js';
|
||||
import { categoryPage } from '../requests/shopper/category-page.js';
|
||||
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
|
||||
import { products } from '../requests/merchant/products.js';
|
||||
import { addProduct } from '../requests/merchant/add-product.js';
|
||||
import { coupons } from '../requests/merchant/coupons.js';
|
||||
import { orders } from '../requests/merchant/orders.js';
|
||||
import { ordersSearch } from '../requests/merchant/orders-search.js';
|
||||
import { addOrder } from '../requests/merchant/add-order.js';
|
||||
import { ordersAPI } from '../requests/api/orders.js';
|
||||
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
|
||||
|
||||
const shopper_request_threshold = 'p(95)<10000';
|
||||
const merchant_request_threshold = 'p(95)<10000';
|
||||
const api_request_threshold = 'p(95)<10000';
|
||||
|
||||
export const options = {
|
||||
scenarios: {
|
||||
|
@ -70,6 +73,13 @@ export const options = {
|
|||
maxDuration: '360s',
|
||||
exec: 'allMerchantFlow',
|
||||
},
|
||||
allAPISmoke: {
|
||||
executor: 'per-vu-iterations',
|
||||
vus: 1,
|
||||
iterations: 3,
|
||||
maxDuration: '120s',
|
||||
exec: 'allAPIFlow',
|
||||
},
|
||||
},
|
||||
thresholds: {
|
||||
checks: [ 'rate==1' ],
|
||||
|
@ -147,9 +157,35 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - All Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Completed Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - New Order Page}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Create New Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Open Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Update Existing Order Status}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Product}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Email}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Address}':
|
||||
[ `${ merchant_request_threshold }` ],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Month}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Customer}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - All Products}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
|
@ -179,6 +215,24 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - action=heartbeat}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Create Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Retrieve Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Update Order (Status)}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Delete Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Create Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Update (Status) Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -206,9 +260,14 @@ export function cartFlow() {
|
|||
export function allMerchantFlow() {
|
||||
myAccountMerchantLogin();
|
||||
homeWCAdmin();
|
||||
addOrder();
|
||||
orders();
|
||||
ordersSearch();
|
||||
products();
|
||||
addProduct();
|
||||
products();
|
||||
coupons();
|
||||
}
|
||||
|
||||
export function allAPIFlow() {
|
||||
ordersAPI();
|
||||
}
|
||||
|
|
|
@ -17,10 +17,14 @@ import { addProduct } from '../requests/merchant/add-product.js';
|
|||
import { coupons } from '../requests/merchant/coupons.js';
|
||||
import { orders } from '../requests/merchant/orders.js';
|
||||
import { ordersSearch } from '../requests/merchant/orders-search.js';
|
||||
import { ordersFilter } from '../requests/merchant/orders-filter.js';
|
||||
import { addOrder } from '../requests/merchant/add-order.js';
|
||||
import { ordersAPI } from '../requests/api/orders.js';
|
||||
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
|
||||
|
||||
const shopper_request_threshold = 'p(95)<10000';
|
||||
const merchant_request_threshold = 'p(95)<10000';
|
||||
const api_request_threshold = 'p(95)<10000';
|
||||
|
||||
export const options = {
|
||||
scenarios: {
|
||||
|
@ -70,6 +74,13 @@ export const options = {
|
|||
maxDuration: '360s',
|
||||
exec: 'allMerchantFlow',
|
||||
},
|
||||
allAPISmoke: {
|
||||
executor: 'per-vu-iterations',
|
||||
vus: 1,
|
||||
iterations: 3,
|
||||
maxDuration: '120s',
|
||||
exec: 'allAPIFlow',
|
||||
},
|
||||
},
|
||||
thresholds: {
|
||||
checks: [ 'rate==1' ],
|
||||
|
@ -147,9 +158,35 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - All Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Completed Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - New Order Page}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Create New Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Open Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Update Existing Order Status}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Product}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Email}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Address}':
|
||||
[ `${ merchant_request_threshold }` ],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Month}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Customer}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - All Products}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
|
@ -179,6 +216,24 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - action=heartbeat}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Create Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Retrieve Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Update Order (Status)}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Delete Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Create Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Update (Status) Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -206,9 +261,15 @@ export function cartFlow() {
|
|||
export function allMerchantFlow() {
|
||||
wpLogin();
|
||||
homeWCAdmin();
|
||||
addOrder();
|
||||
orders();
|
||||
ordersSearch();
|
||||
products();
|
||||
ordersFilter();
|
||||
addProduct();
|
||||
products();
|
||||
coupons();
|
||||
}
|
||||
|
||||
export function allAPIFlow() {
|
||||
ordersAPI();
|
||||
}
|
||||
|
|
|
@ -17,13 +17,17 @@ import { addProduct } from '../requests/merchant/add-product.js';
|
|||
import { coupons } from '../requests/merchant/coupons.js';
|
||||
import { orders } from '../requests/merchant/orders.js';
|
||||
import { ordersSearch } from '../requests/merchant/orders-search.js';
|
||||
import { ordersFilter } from '../requests/merchant/orders-filter.js';
|
||||
import { addOrder } from '../requests/merchant/add-order.js';
|
||||
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
|
||||
import { wpLogin } from '../requests/merchant/wp-login.js';
|
||||
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
|
||||
import { ordersAPI } from '../requests/api/orders.js';
|
||||
import { admin_acc_login } from '../config.js';
|
||||
|
||||
const shopper_request_threshold = 'p(95)<10000';
|
||||
const merchant_request_threshold = 'p(95)<10000';
|
||||
const api_request_threshold = 'p(95)<10000';
|
||||
|
||||
export const options = {
|
||||
scenarios: {
|
||||
|
@ -73,6 +77,13 @@ export const options = {
|
|||
maxDuration: '360s',
|
||||
exec: 'allMerchantFlow',
|
||||
},
|
||||
allAPISmoke: {
|
||||
executor: 'per-vu-iterations',
|
||||
vus: 1,
|
||||
iterations: 1,
|
||||
maxDuration: '120s',
|
||||
exec: 'allAPIFlow',
|
||||
},
|
||||
},
|
||||
thresholds: {
|
||||
checks: [ 'rate==1' ],
|
||||
|
@ -150,9 +161,35 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - All Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Completed Orders}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - New Order Page}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Create New Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Open Order}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Update Existing Order Status}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Product}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Email}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Search Orders By Customer Address}':
|
||||
[ `${ merchant_request_threshold }` ],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Month}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - Filter Orders By Customer}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:Merchant - All Products}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
|
@ -182,6 +219,24 @@ export const options = {
|
|||
'http_req_duration{name:Merchant - action=heartbeat}': [
|
||||
`${ merchant_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Create Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Retrieve Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Update Order (Status)}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Delete Order}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Create Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
'http_req_duration{name:API - Batch Update (Status) Orders}': [
|
||||
`${ api_request_threshold }`,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -215,9 +270,15 @@ export function allMerchantFlow() {
|
|||
wpLogin();
|
||||
}
|
||||
homeWCAdmin();
|
||||
addOrder();
|
||||
orders();
|
||||
ordersSearch();
|
||||
products();
|
||||
ordersFilter();
|
||||
addProduct();
|
||||
products();
|
||||
coupons();
|
||||
}
|
||||
|
||||
export function allAPIFlow() {
|
||||
ordersAPI();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue