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.WebElement;
6 import vid.automation.test.Constants;
7 import vid.automation.test.infra.SelectOption;
9 import static org.hamcrest.core.Is.is;
11 public class ServiceProxyPage extends VidBasePage {
13 public ServiceProxyPage chooseSource(String source){
14 SelectOption.byTestIdAndVisibleText(source, Constants.ConfigurationCreation.SOURCE_DROPDOWN_TEST_ID);
17 public ServiceProxyPage chooseSourceServiceType(String sourceServiceType){
18 SelectOption.byTestIdAndVisibleText(sourceServiceType, "sourceServiceType");
19 GeneralUIUtils.ultimateWait();
22 public ServiceProxyPage chooseCollectorServiceType(String collectorServiceType){
23 SelectOption.byTestIdAndVisibleText(collectorServiceType, "collectorServiceType");
24 GeneralUIUtils.ultimateWait();
27 public ServiceProxyPage chooseCollector(String collector){
28 GeneralUIUtils.ultimateWait();
29 SelectOption.byTestIdAndVisibleText(collector, Constants.ConfigurationCreation.COLLECTOR_DROPDOWN_TEST_ID);
32 public ServiceProxyPage clickCreateButton() {
33 GeneralUIUtils.clickOnElementByTestId(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID, 60);
37 public ServiceProxyPage clickDeleteConfigurationButton() {
38 GeneralUIUtils.clickOnElementByTestId(Constants.DELETE_CONFIGURATION_BUTTON, 60);
42 public ServiceProxyPage assertDeleteConfigurationButtonExists(boolean shouldExist){
45 WebElement selectedV = GeneralUIUtils.getWebElementByTestID(Constants.DELETE_CONFIGURATION_BUTTON, 3);
46 Assert.assertThat(selectedV != null, is(shouldExist));
47 Assert.assertThat(selectedV.isDisplayed(), is(shouldExist));
49 boolean webElementExistByTestId = GeneralUIUtils.isWebElementExistByTestId(Constants.DELETE_CONFIGURATION_BUTTON);
50 Assert.assertThat(webElementExistByTestId, is(shouldExist));
55 public void assertSourceModelName(String sourceName){
56 String displayedSourceName= getTextByTestID(Constants.ConfigurationCreation.SOURCE_INSTANCE_NAME_TEST_ID);
57 Assert.assertEquals("The displayed source name is not correct", sourceName+" i", displayedSourceName);
60 public void assertCollectorModelName(String collectorName) {
61 String displayedCollectorName = getTextByTestID(Constants.ConfigurationCreation.COLLECTOR_INSTANCE_NAME_TEST_ID);
62 Assert.assertEquals("The displayed collector name is not correct", collectorName+"i", displayedCollectorName);
65 public void assertNoResultRequirementsDropDown(String msgTestId, String resourceType){
66 String noResultText = GeneralUIUtils.getWebElementByTestID(msgTestId, 60).getText();
67 Assert.assertEquals("The error message no instance in DropDown is not match","No "+resourceType+" instances found.",noResultText);
69 public ServiceProxyPage clickInfoButton(String infoButtonTestId) {
70 GeneralUIUtils.clickOnElementByTestId(infoButtonTestId, 90);
75 public ServiceProxyPage assertSelectedInstanceIcon(String SelectedIconTestId){
76 WebElement selectedV = GeneralUIUtils.getWebElementByTestID(SelectedIconTestId, 90);
77 Assert.assertTrue(selectedV != null);
78 String selectedVClass = selectedV.getAttribute("class");
79 Assert.assertTrue(selectedVClass.contains("valid-large"));
83 public ServiceProxyPage clickActivateDeactivateButton() {
84 GeneralUIUtils.clickOnElementByTestId(Constants.ACTIVATE_DEACTIVATE_BUTTON, 60);
88 public ServiceProxyPage clickEnableDisableButton(){
89 GeneralUIUtils.clickOnElementByTestId(Constants.ENABLE_DISABLE_BUTTON, 60);