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( 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.

View File

@ -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}`),
}); });
}); });