-
Notifications
You must be signed in to change notification settings - Fork 5
/
example.js
48 lines (46 loc) · 1.96 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {
accountRegister,
addProductToCart,
placeOrder,
visitCartPage,
visitConfirmPage,
visitNavigationPage,
visitProductDetailPage,
visitSearchPage,
visitStorefront,
} from "./helpers/storefront.js";
import { Counter } from 'k6/metrics';
import { Trend } from 'k6/metrics';
let orderCounter = new Counter('orders');
let StoreFrontRT = new Trend('response_time_StoreFront');
let SearchPageRT = new Trend('response_time_SearchPage');
let NavigationPageRT = new Trend('response_time_NavigationPage');
let ProductDetailPageRT = new Trend('response_time_ProductDetailPage');
let guestRegisterPageRT = new Trend('response_time_guestRegister');
let CartPageRT = new Trend('response_time_CartPage');
let ConfirmPageRT = new Trend('response_time_ConfirmPage');
let placeOrderRT = new Trend('response_time_placeOrder');
let accountRegisterRT = new Trend('response_time_accountRegister');
let accountLoginRT = new Trend('response_time_accountLogin');
let accountDashboardRT = new Trend('response_time_accountDashboard');
let addProductToCartRT = new Trend('response_time_addProductToCart');
let CartInfoRT = new Trend('response_time_CartInfo');
export default function () {
visitStorefront(StoreFrontRT);
visitSearchPage(SearchPageRT);
visitNavigationPage(NavigationPageRT);
accountRegister(accountRegisterRT);
visitNavigationPage(NavigationPageRT);
addProductToCart(addProductToCartRT, CartInfoRT, visitProductDetailPage(ProductDetailPageRT).id);
visitSearchPage(SearchPageRT);
visitNavigationPage(NavigationPageRT);
visitSearchPage(SearchPageRT);
visitNavigationPage(NavigationPageRT);
addProductToCart(addProductToCartRT, CartInfoRT, visitProductDetailPage(ProductDetailPageRT).id);
visitNavigationPage(NavigationPageRT);
visitNavigationPage(NavigationPageRT);
addProductToCart(addProductToCartRT, CartInfoRT, visitProductDetailPage(ProductDetailPageRT).id);
visitCartPage(CartPageRT);
visitConfirmPage(ConfirmPageRT);
placeOrder(orderCounter, placeOrderRT);
}