-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRealBrowser-Example.js
More file actions
32 lines (25 loc) · 1.13 KB
/
RealBrowser-Example.js
File metadata and controls
32 lines (25 loc) · 1.13 KB
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
/*
Purpose: Checks for any regression error in the Cart page by comparing the actual cart value with the expected cart value
Author: NaveenKumar Namachivayam | QAInsights.com
Build: 2022.11
URL: https://store.qainsights.com
*/
// Printing the captured values
logger.debug("Product Price " + context.variableManager.getValue("productPrice"));
logger.debug("Cart Quantity " + context.variableManager.getValue("cartQuantity"));
logger.debug("Total Price " + context.variableManager.getValue("totalPrice"));
// Directives
var productPrice = context.variableManager.getValue("productPrice");
var cartQuantity = context.variableManager.getValue("cartQuantity");
var totalPrice = context.variableManager.getValue("totalPrice");
// Calculating expected total cart value
productPrice = productPrice.slice(1);
var expectedCartValue = parseFloat(productPrice) * parseInt(cartQuantity);
totalPrice = totalPrice.slice(1);
// Comparing Actual Vs Expected Cart Value
if (parseFloat(expectedCartValue) == parseFloat(totalPrice) ) {
logger.debug("No Regression Error. Cart value is matching.");
}
else {
logger.debug("Regression Error");
}