Update orders and product k6 tests to be more robust
This commit is contained in:
parent
74c72274a7
commit
579d491ca2
|
@ -55,8 +55,8 @@ export function orders() {
|
||||||
);
|
);
|
||||||
api_x_wp_nonce = findBetween(
|
api_x_wp_nonce = findBetween(
|
||||||
response.body,
|
response.body,
|
||||||
'wp-json\\/","nonce":"',
|
'wp.apiFetch.createNonceMiddleware( "',
|
||||||
'",'
|
'" )'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create request header with nonce value for use in subsequent requests.
|
// Create request header with nonce value for use in subsequent requests.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.1.0/index.js";
|
||||||
import {
|
import {
|
||||||
base_url,
|
base_url,
|
||||||
product_url,
|
product_url,
|
||||||
product_id,
|
product_sku,
|
||||||
think_time_min,
|
think_time_min,
|
||||||
think_time_max,
|
think_time_max,
|
||||||
} from "../../config.js";
|
} from "../../config.js";
|
||||||
|
@ -36,8 +36,8 @@ export function singleProduct() {
|
||||||
productPageTrend.add(response.timings.duration);
|
productPageTrend.add(response.timings.duration);
|
||||||
check(response, {
|
check(response, {
|
||||||
"is status 200": (r) => r.status === 200,
|
"is status 200": (r) => r.status === 200,
|
||||||
"body contains: product ID": (response) =>
|
"body contains: product SKU": (response) =>
|
||||||
response.body.includes(`id="product-${product_id}`),
|
response.body.includes(`class="sku">${product_sku}`),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue