1 package vid.automation.test.sections;
3 import org.junit.Assert;
4 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
5 import org.openqa.selenium.By;
6 import org.openqa.selenium.WebElement;
7 import vid.automation.test.Constants;
8 import vid.automation.test.infra.Get;
9 import vid.automation.test.infra.SelectOption;
10 import vid.automation.test.infra.Wait;
11 import org.hamcrest.core.Is;
13 import static org.hamcrest.core.Is.is;
15 import java.util.List;
18 * Created by itzikliderman on 13/06/2017.
20 public class ViewEditPage extends VidBasePage {
21 public ViewEditPage selectNodeInstanceToAdd(String vnfName) {
22 selectFromDropdownByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + vnfName,
23 Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID);
27 public ViewEditPage selectVfModuleToAdd(String vfModuleName) {
28 selectFromDropdownByTestId(Constants.ViewEdit.VF_MODULE_OPTION_TEST_ID_PREFIX + vfModuleName,
29 Constants.ViewEdit.ADD_VF_MODULE_BUTTON_TEST_ID);
33 public ViewEditPage clickResumeButton(String instanceName) {
34 //instanceName = "my_vfModule";
35 String instanceId = Constants.ViewEdit.VF_MODULE_RESUME_ID_PREFIX + instanceName;
36 checkIfExistResumeButton(instanceName,true);
37 GeneralUIUtils.clickOnElementByTestId(instanceId);
42 public ViewEditPage checkIfExistResumeButton(String instanceName, Boolean expected) {
43 //instanceName = "my_vfModule";
44 String instanceId = Constants.ViewEdit.VF_MODULE_RESUME_ID_PREFIX + instanceName;
45 WebElement resumeButton = GeneralUIUtils.getWebElementByTestID(instanceId, 30);
46 Assert.assertThat(resumeButton != null, is(expected));
50 public ViewEditPage selectVolumeGroupToAdd(String volumeGroupName) {
51 selectFromDropdownByTestId(Constants.ViewEdit.VOLUME_GROUP_OPTION_TEST_ID_PREFIX + volumeGroupName,
52 Constants.ViewEdit.ADD_VOLUME_GROUP_BUTTON_TEST_ID);
56 public ViewEditPage selectFromDropdownByText(String itemText, String dropdownButtonTestId) {
57 GeneralUIUtils.clickOnElementByTestId(dropdownButtonTestId, 30);
58 GeneralUIUtils.clickOnElementByText(itemText, 30);
62 public ViewEditPage selectNetworkToAdd(String networkName) {
63 selectFromDropdownByTestId(Constants.ViewEdit.NETWORK_OPTION_TEST_ID_PREFIX + networkName,
64 Constants.ViewEdit.ADD_NETWORK_BUTTON_TEST_ID);
68 public ViewEditPage selectProductFamily(String productFamily){
69 SelectOption.byValue(productFamily, Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
73 public ViewEditPage selectLCPRegion(String lcpRegion){
74 SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID);
78 public ViewEditPage setLegacyRegion(String legacyRegionName){
79 setInputText(Constants.ViewEdit.LEGACY_REGION_INPUT_TESTS_ID, legacyRegionName);
83 public ViewEditPage selectTenant(String tenant){
84 SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID);
85 // GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.TENANT_SELECT_TESTS_ID, 60);
89 public VidBasePage clickActivateButton() {
90 GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID, 60);
94 public VidBasePage clickInfoButton() {
95 GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.INFOSERVICEBUTTON, 30);
99 public VidBasePage clickDeleteButton() {
100 GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.DELETESERVICEBUTTON, 3);
105 public WebElement getPnf(String pnfName) {
106 WebElement pnfElement = Get.byClassAndText("tree-node", "PNF: " + pnfName);
107 Assert.assertNotNull("Pnf "+ pnfName +" not found under service instance", pnfElement);
111 public ViewEditPage clickDissociatePnfButton(String pnfName) {
112 WebElement pnfToDissociate = getPnf(pnfName);
113 WebElement dissociateBtn = pnfToDissociate.findElement(By.className(Constants.ViewEdit.DISSOCIATE_BTN_CLASS));
114 Assert.assertNotNull("Dissociate button not found for pnf " + pnfName, dissociateBtn);
115 dissociateBtn.click();
119 public VidBasePage clickDeactivateButton() {
120 GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID, 30);
124 public ViewEditPage selectLineOfBusiness(String lineOfBusiness) {
126 SelectOption.selectFirstTwoOptionsFromMultiselectById(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID);
127 } catch (InterruptedException e) {
131 //TODO multi SelectOption.byValue(lineOfBusiness, Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID);
135 public ViewEditPage selectPlatform(String platform) {
136 SelectOption.byValue(platform, Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);