Update orders and product k6 tests to be more robust

This commit is contained in:
Tam Mullen 2022-02-17 22:34:09 +00:00
parent 74c72274a7
commit 579d491ca2
2 changed files with 5 additions and 5 deletions

View File

@ -55,8 +55,8 @@ export function orders() {
);
api_x_wp_nonce = findBetween(
response.body,
'wp-json\\/","nonce":"',
'",'
'wp.apiFetch.createNonceMiddleware( "',
'" )'
);
// Create request header with nonce value for use in subsequent requests.

View File

@ -5,7 +5,7 @@ import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.1.0/index.js";
import {
base_url,
product_url,
product_id,
product_sku,
think_time_min,
think_time_max,
} from "../../config.js";
@ -36,8 +36,8 @@ export function singleProduct() {
productPageTrend.add(response.timings.duration);
check(response, {
"is status 200": (r) => r.status === 200,
"body contains: product ID": (response) =>
response.body.includes(`id="product-${product_id}`),
"body contains: product SKU": (response) =>
response.body.includes(`class="sku">${product_sku}`),
});
});