Add new performance test category page

This commit is contained in:
Veljko 2021-10-21 12:15:12 +02:00
parent fa0464930c
commit a84ffcc42d
4 changed files with 51 additions and 0 deletions

View File

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

View File

@ -15,6 +15,7 @@ import { orders } from '../requests/merchant/orders.js';
import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js'; import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js';
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js'; import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js'; import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
import { categoryPage } from '../requests/shopper/category-page.js';
export let options = { export let options = {
scenarios: { scenarios: {
@ -124,6 +125,7 @@ export function shopperBrowsingFlows() {
cartRemoveItem(); cartRemoveItem();
cartApplyCoupon(); cartApplyCoupon();
myAccount(); myAccount();
categoryPage();
} }
export function checkoutGuestFlow() { export function checkoutGuestFlow() {
cart(); cart();

View File

@ -15,6 +15,7 @@ import { orders } from '../requests/merchant/orders.js';
import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js'; import { ordersHeartbeat } from '../requests/merchant/orders-heartbeat.js';
import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js'; import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js'; import { myAccountMerchantLogin } from '../requests/merchant/my-account-merchant.js';
import { categoryPage } from '../requests/shopper/category-page.js';
export let options = { export let options = {
scenarios: { scenarios: {
@ -114,6 +115,7 @@ export function shopperBrowsingFlows() {
cartRemoveItem(); cartRemoveItem();
cartApplyCoupon(); cartApplyCoupon();
myAccount(); myAccount();
categoryPage();
} }
export function checkoutGuestFlow() { export function checkoutGuestFlow() {
cart(); cart();

View File

@ -8,6 +8,7 @@ import { cartApplyCoupon } from '../requests/shopper/cart-apply-coupon.js';
import { checkoutGuest } from '../requests/shopper/checkout-guest.js'; import { checkoutGuest } from '../requests/shopper/checkout-guest.js';
import { checkoutCustomerLogin } from '../requests/shopper/checkout-customer-login.js'; import { checkoutCustomerLogin } from '../requests/shopper/checkout-customer-login.js';
import { myAccount } from '../requests/shopper/my-account.js'; import { myAccount } from '../requests/shopper/my-account.js';
import { categoryPage } from '../requests/shopper/category-page.js';
export let options = { export let options = {
scenarios: { scenarios: {
@ -88,6 +89,7 @@ export function searchProductFlow() {
} }
export function singleProductFlow() { export function singleProductFlow() {
singleProduct(); singleProduct();
categoryPage();
} }
export function checkoutGuestFlow() { export function checkoutGuestFlow() {
cart(); cart();