Hi,
I am trying to execute if else statement and few of the steps that are mandatory in if statement are getting executed in else statement even thought the steps are not present in else statement.
Please help me in understanding where the issue is.
TestData excelData = findTestData('Data Files/ExcelDataSource/GroupProductTestData')
WebUI.waitForElementClickable(findTestObject('Group Product/Group Order_Hyperlink/Group Products0'), GlobalVariable.TimeOut)
WebUI.click(findTestObject('Group Product/Group Order_Hyperlink/Group Products0'))
WebUI.click(findTestObject('Group Product/New Button/New_GP_Button'))
WebUI.waitForPageLoad(GlobalVariable.TimeOut)
WebUI.waitForElementVisible(findTestObject('Group Product/Facets Benefit Selector/Product Type'), GlobalVariable.TimeOut)
WebUI.selectOptionByValue(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/select_- None -MedicalSpecialt'),
excelData.getValue('Product Type', index), true)
WebUI.delay(3)
WebUI.selectOptionByValue(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/select_- None -PortfolioCustom'),
excelData.getValue('Benefit Complexity', index), false)
WebUI.delay(3)
//Begin If Condition, if Benefit Type = ASO
def asoBenefitType = WebUI.getText(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/select_- None -PortfolioCustom'))
if(asoBenefitType.contains('ASO') == true) {
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/ASO_FBS/FBS_ASO_Type/ASO_Type'), excelData.getValue('Type', index), true)
WebUI.delay(3)
WebUI.setText(findTestObject('Object Repository/Group Product/ASO_FBS/FBS_ASO_PlanName/ASO_PlanName'), excelData.getValue('Plan Name', index), FailureHandling.STOP_ON_FAILURE)
WebUI.delay(2)
WebUI.sendKeys(findTestObject('Object Repository/Group Product/ASO_FBS/FBS_ASO_PlanName/ASO_PlanName'),
Keys.chord(Keys.DOWN, Keys.ENTER))
WebUI.delay(2)
WebUI.click(findTestObject('Group Product/FBS_1st Page/Continue_GP_Button'))
WebUI.waitForPageLoad(GlobalVariable.TimeOut)
WebUI.delay(3)
WebUI.setText(findTestObject('Group Product/RX Plan Field/RX Plan'), excelData.getValue('RX Plan', index), FailureHandling.STOP_ON_FAILURE)
WebUI.delay(3)
WebUI.sendKeys(findTestObject('Group Product/RX Plan Field/RX Plan'), Keys.chord(Keys.DOWN, Keys.ENTER))
WebUI.click(findTestObject('Group Product/FBS_Page2/Continue_GP2_Button'))
WebUI.click(findTestObject('Group Product/FBS_Page3_Save/Save_GP3_Button'))
WebUI.waitForPageLoad(GlobalVariable.TimeOut)
//Edit Group Product Page for ASO
WebUI.click(findTestObject('Object Repository/Group Product/ASO_FBS/Edit Button_ASO GP'))
def stockID1 = excelData.getValue('Stock', index)
//def stockID = '1000000100 DMHC PPO'
WebUI.sendKeys(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/input_Stock_GP'),
stockID1)
WebUI.click(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Stock_lookupIconOn'))
/*WebUI.switchToWindowTitle('Group Product Edit: GP-667972 ~ Salesforce - Unlimited Edition')*/
WebUI.switchToWindowIndex(1)
WebUI.delay(2)
StockID_CODE1 = WebUI.modifyObjectProperty(findTestObject('Object Repository/Group Product/DHMC_PPO_object/a_1000000100 DMHC PPO'),
'text', 'equals', stockID1, true)
WebUI.waitForElementClickable(StockID_CODE1, 7, FailureHandling.OPTIONAL)
WebUI.click(StockID_CODE1)
WebUI.switchToWindowIndex(0)
WebUI.delay(2)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_ID Card Format Control_ASO'),
excelData.getValue('ID Card Format Control ID', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_ID Card Type_ASO'),
excelData.getValue('ID Card Type', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_DOIDHMC_ASO'),
excelData.getValue('DOI/DMHC/Group Specific', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_Plan Type_ASO'),
excelData.getValue('Plan Type', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_Network Set_ASO'),
excelData.getValue('Network Set', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/GP_Prefix_ASO'),
excelData.getValue('Prefix', index), true)
//RX Discount Guarantee Section
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Brand Retail'), excelData.getValue('AWP-Brand Retail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Brand Mail'), excelData.getValue('AWP-Brand Mail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Brand Specialty'),
excelData.getValue('AWP-Brand Specialty', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Brand Retail'),
excelData.getValue('Dispense Fee-Brand Retail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Brand Mail'),
excelData.getValue('Dispense Fee-Brand Mail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Brand Speciality'),
excelData.getValue('Dispense Fee-Brand Specialty', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Generic Retail'), excelData.getValue('AWP-Generic Retail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Generic Mail'), excelData.getValue('AWP-Generic Mail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/AWP-Generic Specialty'),
excelData.getValue('AWP-Generic Specialty', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Generic Retail'),
excelData.getValue('Dispense Fee-Generic Retail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Generic Mail'),
excelData.getValue('Dispense Fee-Generic Mail', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.setText(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Edit Page_ASO/Dispense Fee-Generic Speciality'),
excelData.getValue('Dispense Fee-Generic Specialty', index), FailureHandling.CONTINUE_ON_FAILURE)
WebUI.click(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/Save_GP Edit Button'))
// End If Condition for ASO
} else
//if (asoBenefitType.contains('Portfolio') == true)
{
WebUI.selectOptionByValue(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/select_- None -HMOPOSPPOPSPTan'),
excelData.getValue('Type', index), true)
WebUI.delay(3)
WebUI.setText(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/input_(Reloading)_FacetsBenefi'),
excelData.getValue('Plan Name', index), FailureHandling.STOP_ON_FAILURE)
WebUI.delay(2)
WebUI.sendKeys(findTestObject('Object Repository/Dump/Page_Salesforce - Unlimited Edition/input_(Reloading)_FacetsBenefi'),
Keys.chord(Keys.DOWN, Keys.ENTER))
WebUI.delay(2)
WebUI.click(findTestObject('Group Product/FBS_1st Page/Continue_GP_Button'))
WebUI.waitForPageLoad(GlobalVariable.TimeOut)
WebUI.delay(3)
WebUI.setText(findTestObject('Group Product/RX Plan Field/RX Plan'), excelData.getValue('RX Plan', index), FailureHandling.STOP_ON_FAILURE)
WebUI.delay(3)
WebUI.sendKeys(findTestObject('Group Product/RX Plan Field/RX Plan'), Keys.chord(Keys.DOWN, Keys.ENTER))
WebUI.delay(2)
WebUI.click(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Details_ASO/GP_Shield Support_Radiobutton'), FailureHandling.CONTINUE_ON_FAILURE)
//VBB Section Start
/*WebUI.click(findTestObject('Object Repository/Group Product/GP_ASO/Group Product Details_ASO/GP_Diabetes_Radiobutton'))*/
//VBB Section End
WebUI.click(findTestObject('Group Product/FBS_Page2/Continue_GP2_Button'))
WebUI.click(findTestObject('Group Product/FBS_Page3_Save/Save_GP3_Button'))
WebUI.waitForPageLoad(GlobalVariable.TimeOut)
WebUI.click(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Button/GP_Edit Button'))
def stockID = excelData.getValue('Stock', index)
//def stockID = '1000000100 DMHC PPO'
WebUI.sendKeys(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/input_Stock_GP'),
stockID)
WebUI.click(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Stock_lookupIconOn'))
/*WebUI.switchToWindowTitle('Group Product Edit: GP-667972 ~ Salesforce - Unlimited Edition')*/
WebUI.switchToWindowIndex(1)
WebUI.delay(2)
StockID_CODE = WebUI.modifyObjectProperty(findTestObject('Object Repository/Group Product/DHMC_PPO_object/a_1000000100 DMHC PPO'),
'text', 'equals', stockID, true)
WebUI.waitForElementClickable(StockID_CODE, 7, FailureHandling.OPTIONAL)
WebUI.click(StockID_CODE)
WebUI.switchToWindowIndex(0)
WebUI.delay(2)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_ID Card Format Control ID'),
excelData.getValue('ID Card Format Control ID', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page(2)/ID Card Type(2)'),
excelData.getValue('ID Card Type', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_DOIDHMCGroup Specific'),
excelData.getValue('DOI/DMHC/Group Specific', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Plan Type'),
excelData.getValue('Plan Type', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Network Set'),
excelData.getValue('Network Set', index), true)
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Prefix'),
excelData.getValue('Prefix', index), true)
WebUI.click(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/Save_GP Edit Button'))
}
All the steps in the //RX Discount Guarantee Section starts executing after this step in else statement
WebUI.selectOptionByValue(findTestObject('Object Repository/Group Product/Group Product Edit Page Details/Group Product Edit Page/GP_Prefix'),
excelData.getValue('Prefix', index), true)