Add new performance test category page
This commit is contained in:
parent
fa0464930c
commit
a84ffcc42d
|
@ -0,0 +1,45 @@
|
|||
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 {
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders,
|
||||
} from "../../headers.js";
|
||||
|
||||
// Custom metric to add to standard results output.
|
||||
let categoryPageTrend = new Trend("wc_get_site_root");
|
||||
|
||||
export function categoryPage() {
|
||||
let response;
|
||||
|
||||
group("Category Page", function () {
|
||||
var requestHeaders = Object.assign({},
|
||||
htmlRequestHeader,
|
||||
commonRequestHeaders,
|
||||
commonGetRequestHeaders,
|
||||
commonNonStandardHeaders
|
||||
);
|
||||
|
||||
response = http.get(`${base_url}/product-category/accessories/`, {
|
||||
headers: requestHeaders,
|
||||
});
|
||||
categoryPageTrend.add(response.timings.duration);
|
||||
check(response, {
|
||||
"is status 200": (r) => r.status === 200,
|
||||
"body contains: 'Accessories' title": (response) =>
|
||||
response.body.includes(
|
||||
'<h1 class="woocommerce-products-header__title page-title">Accessories</h1>'
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
sleep(randomIntBetween(`${think_time_min}`, `${think_time_max}`));
|
||||
}
|
||||
|
||||
export default function () {
|
||||
categoryPage();
|
||||
}
|
|
@ -15,6 +15,7 @@ import { orders } from '../requests/merchant/orders.js';
|
|||
import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js';
|
||||
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
|
||||
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
|
||||
import { categoryPage } from '../requests/shopper/category-page.js';
|
||||
|
||||
export let options = {
|
||||
scenarios: {
|
||||
|
@ -124,6 +125,7 @@ export function shopperBrowsingFlows() {
|
|||
cartRemoveItem();
|
||||
cartApplyCoupon();
|
||||
myAccount();
|
||||
categoryPage();
|
||||
}
|
||||
export function checkoutGuestFlow() {
|
||||
cart();
|
||||
|
|
|
@ -15,6 +15,7 @@ import { orders } from '../requests/merchant/orders.js';
|
|||
import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js';
|
||||
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
|
||||
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
|
||||
import { categoryPage } from '../requests/shopper/category-page.js';
|
||||
|
||||
export let options = {
|
||||
scenarios: {
|
||||
|
@ -114,6 +115,7 @@ export function shopperBrowsingFlows() {
|
|||
cartRemoveItem();
|
||||
cartApplyCoupon();
|
||||
myAccount();
|
||||
categoryPage();
|
||||
}
|
||||
export function checkoutGuestFlow() {
|
||||
cart();
|
||||
|
|
|
@ -8,6 +8,7 @@ import { cartApplyCoupon } from '../requests/shopper/cart-apply-coupon.js';
|
|||
import { checkoutGuest } from '../requests/shopper/checkout-guest.js';
|
||||
import { checkoutCustomerLogin } from '../requests/shopper/checkout-customer-login.js';
|
||||
import { myAccount } from '../requests/shopper/my-account.js';
|
||||
import { categoryPage } from '../requests/shopper/category-page.js';
|
||||
|
||||
export let options = {
|
||||
scenarios: {
|
||||
|
@ -88,6 +89,7 @@ export function searchProductFlow() {
|
|||
}
|
||||
export function singleProductFlow() {
|
||||
singleProduct();
|
||||
categoryPage();
|
||||
}
|
||||
export function checkoutGuestFlow() {
|
||||
cart();
|
||||
|
|
Loading…
Reference in New Issue