From a5ef3fecf6a749b6b9f86e437a23c6662641e95a Mon Sep 17 00:00:00 2001 From: Veljko Date: Thu, 21 Oct 2021 14:47:32 +0200 Subject: [PATCH] Add product category parameter --- plugins/woocommerce/tests/performance/config.js | 1 + .../tests/performance/requests/shopper/category-page.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce/tests/performance/config.js b/plugins/woocommerce/tests/performance/config.js index 3a549193fae..4fd834cd9e9 100644 --- a/plugins/woocommerce/tests/performance/config.js +++ b/plugins/woocommerce/tests/performance/config.js @@ -37,6 +37,7 @@ export const product_sku = __ENV.P_SKU || 'woo-beanie'; export const product_url = __ENV.P_URL || 'beanie'; export const product_id = __ENV.P_ID || '13'; export const product_search_term = __ENV.P_TERM || 'beanie'; +export const product_category = __ENV.P_CAT || 'Accessories'; export const coupon_code = __ENV.P_COUPON || 'testing'; diff --git a/plugins/woocommerce/tests/performance/requests/shopper/category-page.js b/plugins/woocommerce/tests/performance/requests/shopper/category-page.js index 42d5f83ffd0..15092c5a825 100644 --- a/plugins/woocommerce/tests/performance/requests/shopper/category-page.js +++ b/plugins/woocommerce/tests/performance/requests/shopper/category-page.js @@ -2,7 +2,7 @@ import { sleep, check, group } from "k6"; import http from "k6/http"; import { Trend } from "k6/metrics"; import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.1.0/index.js"; -import { base_url, think_time_min, think_time_max } from "../../config.js"; +import { base_url, think_time_min, think_time_max, product_category } from "../../config.js"; import { htmlRequestHeader, commonRequestHeaders, @@ -11,7 +11,7 @@ import { } from "../../headers.js"; // Custom metric to add to standard results output. -let categoryPageTrend = new Trend("wc_get_site_root"); +let categoryPageTrend = new Trend("wc_get_product_category_name"); export function categoryPage() { let response; @@ -24,7 +24,7 @@ export function categoryPage() { commonNonStandardHeaders ); - response = http.get(`${base_url}/product-category/accessories/`, { + response = http.get(`${base_url}/product-category/${product_category}/`, { headers: requestHeaders, }); categoryPageTrend.add(response.timings.duration); @@ -32,7 +32,7 @@ export function categoryPage() { "is status 200": (r) => r.status === 200, "body contains: 'Accessories' title": (response) => response.body.includes( - '

Accessories

' + `

${product_category}

` ), }); });