@Test public void deleteBonusTest() { expectedImsBonusEntity.setSearchFieldText(existingTemplate); expectedImsBonusEntity.setSelectedTemplateName(existingTemplate); expectedImsBonusEntity.setAvailableTemplates(Arrays.asList(existingTemplate)); expectedImsBonusEntity.setSourceForBonusCalcAmount("No amount required"); // WHEN imsBonusPage = (ImsBonusPage) testGroupsPage.addAction(testGroupToTest, expectedImsBonusEntity.getAction()); imsBonusPage.setAllFields(expectedImsBonusEntity); testGroupsPage = (TestGroupsPage) imsBonusPage.clickOk(true); campaignDetailsPage = testGroupsPage.clickSave(); activityTab = campaignDetailsPage.openActivityTab(); testGroupsPage = activityTab.clickActionsWithTestGroups(); testGroupsPage.clickDelete(testGroupToTest); // THEN assertTrue( testGroupsPage.getAction(testGroupToTest).equals("Add Action"), "IMS Bonus is not disappeared from test group after deleting."); campaignDetailsPage = testGroupsPage.clickSave(); activityTab = campaignDetailsPage.openActivityTab(); testGroupsPage = activityTab.clickActionsWithTestGroups(); assertTrue( testGroupsPage.getAction(testGroupToTest).equals("Add Action"), "IMS Bonus is not disappeared from test group after deleting."); }
@Test public void saveBonusTest() { expectedImsBonusEntity.setSearchFieldText(existingTemplate); expectedImsBonusEntity.setSelectedTemplateName(existingTemplate); expectedImsBonusEntity.setAvailableTemplates(Arrays.asList(existingTemplate)); expectedImsBonusEntity.setSourceForBonusCalcAmount("No amount required"); // WHEN imsBonusPage = (ImsBonusPage) testGroupsPage.addAction(testGroupToTest, expectedImsBonusEntity.getAction()); imsBonusPage.setAllFields(expectedImsBonusEntity); testGroupsPage = (TestGroupsPage) imsBonusPage.clickOk(true); campaignDetailsPage = testGroupsPage.clickSave(); activityTab = campaignDetailsPage.openActivityTab(); testGroupsPage = activityTab.clickActionsWithTestGroups(); // THEN assertEquals(expectedImsBonusEntity.getAction(), testGroupsPage.getAction(testGroupToTest)); assertEquals( expectedImsBonusEntity.getSelectedTemplateName() + " - Amount Source: " + expectedImsBonusEntity.getSourceForBonusCalcAmount(), testGroupsPage.getSummary(testGroupToTest)); activityTab = campaignTabs.openActivityTab(); testGroupsPage = activityTab.clickActionsWithTestGroups(); imsBonusPage = (ImsBonusPage) testGroupsPage.clickEdit(testGroupToTest); actualImsBonusEntity = imsBonusPage.getAllFields(); assertObjectsEquals(expectedImsBonusEntity, actualImsBonusEntity); }
@Test public void clickCancelTest() { expectedImsBonusEntity.setSelectedTemplateName(existingTemplate); expectedImsBonusEntity.setAvailableTemplates(new ArrayList<String>()); // WHEN imsBonusPage = (ImsBonusPage) testGroupsPage.addAction(testGroupToTest, expectedImsBonusEntity.getAction()); imsBonusPage.selectBonusTemplate(expectedImsBonusEntity.getSelectedTemplateName()); testGroupsPage = (TestGroupsPage) imsBonusPage.clickCancel(true); // THEN assertTrue( testGroupsPage.getAction(testGroupToTest).equals("Add Action"), "IMS Bonus is in the Actions table after pressing Cancel button on IMS Bonus form."); campaignDetailsPage = testGroupsPage.clickSave(); activityTab = campaignTabs.openActivityTab(); testGroupsPage = activityTab.clickActionsWithTestGroups(); assertTrue( testGroupsPage.getAction(testGroupToTest).equals("Add Action"), "IMS Bonus is in the Actions table after pressing Cancel button on IMS Bonus form and saving Campaign."); }