From 579d491ca22a9b0bef731f1ed9c5736367180cfb Mon Sep 17 00:00:00 2001 From: Tam Mullen Date: Thu, 17 Feb 2022 22:34:09 +0000 Subject: [PATCH] Update orders and product k6 tests to be more robust --- .../tests/performance/requests/merchant/orders.js | 4 ++-- .../tests/performance/requests/shopper/single-product.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce/tests/performance/requests/merchant/orders.js b/plugins/woocommerce/tests/performance/requests/merchant/orders.js index 697e0ea642d..bda0d3674cc 100644 --- a/plugins/woocommerce/tests/performance/requests/merchant/orders.js +++ b/plugins/woocommerce/tests/performance/requests/merchant/orders.js @@ -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. diff --git a/plugins/woocommerce/tests/performance/requests/shopper/single-product.js b/plugins/woocommerce/tests/performance/requests/shopper/single-product.js index 7dd2f13d0f0..9f310852f0f 100644 --- a/plugins/woocommerce/tests/performance/requests/shopper/single-product.js +++ b/plugins/woocommerce/tests/performance/requests/shopper/single-product.js @@ -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}`), }); });