1 package vid.automation.test.sections;
3 import org.junit.Assert;
4 import org.onap.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 void assertCollectorServiceType(String collectorServiceType) {
28 String displayedCollectorServiceType = SelectOption.getSelectedOption("collectorServiceType");
29 Assert.assertEquals("The displayed collector service type is incorrect", collectorServiceType, displayedCollectorServiceType);
32 public ServiceProxyPage chooseCollector(String collector){
33 GeneralUIUtils.ultimateWait();
34 SelectOption.byTestIdAndVisibleText(collector, Constants.ConfigurationCreation.COLLECTOR_DROPDOWN_TEST_ID);
37 public ServiceProxyPage clickCreateButton() {
38 GeneralUIUtils.clickOnElementByTestId(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID, 60);
42 public ServiceProxyPage clickDeleteConfigurationButton() {
43 GeneralUIUtils.clickOnElementByTestId(Constants.DELETE_CONFIGURATION_BUTTON, 60);
47 public ServiceProxyPage assertDeleteConfigurationButtonExists(boolean shouldExist){
50 WebElement selectedV = GeneralUIUtils.getWebElementByTestID(Constants.DELETE_CONFIGURATION_BUTTON, 3);
51 Assert.assertThat(selectedV != null, is(shouldExist));
52 Assert.assertThat(selectedV.isDisplayed(), is(shouldExist));
54 boolean webElementExistByTestId = GeneralUIUtils.isWebElementExistByTestId(Constants.DELETE_CONFIGURATION_BUTTON);
55 Assert.assertThat(webElementExistByTestId, is(shouldExist));
60 public void assertSourceModelName(String sourceName){
61 String displayedSourceName= getTextByTestID(Constants.ConfigurationCreation.SOURCE_INSTANCE_NAME_TEST_ID);
62 Assert.assertEquals("The displayed source name is not correct", sourceName+" i", displayedSourceName);
65 public void assertCollectorModelName(String collectorName) {
66 String displayedCollectorName = getTextByTestID(Constants.ConfigurationCreation.COLLECTOR_INSTANCE_NAME_TEST_ID);
67 Assert.assertEquals("The displayed collector name is not correct", collectorName+"i", displayedCollectorName);
70 public void assertNoResultRequirementsDropDown(String msgTestId, String resourceType){
71 String noResultText = GeneralUIUtils.getWebElementByTestID(msgTestId, 60).getText();
72 Assert.assertEquals("The error message no instance in DropDown is not match","No "+resourceType+" instances found.",noResultText);
74 public ServiceProxyPage clickInfoButton(String infoButtonTestId) {
75 GeneralUIUtils.clickOnElementByTestId(infoButtonTestId, 90);
80 public ServiceProxyPage assertSelectedInstanceIcon(String SelectedIconTestId){
81 WebElement selectedV = GeneralUIUtils.getWebElementByTestID(SelectedIconTestId, 90);
82 Assert.assertTrue(selectedV != null);
83 String selectedVClass = selectedV.getAttribute("class");
84 Assert.assertTrue(selectedVClass.contains("valid-large"));
88 public ServiceProxyPage clickActivateDeactivateButton() {
89 GeneralUIUtils.clickOnElementByTestId(Constants.ACTIVATE_DEACTIVATE_BUTTON, 60);
93 public ServiceProxyPage clickEnableDisableButton(){
94 GeneralUIUtils.clickOnElementByTestId(Constants.ENABLE_DISABLE_BUTTON, 60);