Hello Team,
I am trying to do some calculations within the script but I am noticing weird issues.
Below is the script: This If Statement is a part of another If Statement
if (pdp_product_price >= 50) {
WebUI.verifyElementText(findTestObject('7_Payments_Page/Value_Shipping'), 'Free')
assert (ca_pm_subtotal + ca_pm_taxes).equals(ca_pm_total)
}
This will validate that If the Product Price is greater than or equal to 50 then Shipping should be free and then validates the total using Variables ca_pm_subtotal ca_pm_taxes and then matching it with the variable ca_pm_total . These all variables are already in BigDecimal
The script is automatically removing ( and ) from assert (ca_pm_subtotal + ca_pm_taxes) and leaves it as assert ca_pm_subtotal + ca_pm_taxes.equals(ca_pm_total) when I switch to Manual Mode and do some changes.Because of this auto change, I am getting error
03-15-2019 10:18:56 AM assert ca_pm_subtotal + ca_pm_shipping + ca_pm_taxes.equals(ca_pm_total)
Elapsed time: 0.015s
if (IsRegionCA) FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: java.math.BigDecimal.plus() is applicable for argument types: (java.lang.Boolean) values: [false]
Possible solutions: plus(), plus(java.math.MathContext), plus(java.lang.Character), plus(java.lang.Number), plus(java.lang.String), ulp()