org.onap migration
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / CreateInstanceDialogBaseTest.java
1 package vid.automation.test.test;
2
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.model.Service;
8
9 public class CreateInstanceDialogBaseTest extends VidBaseTestCase {
10     void assertServiceMetadata(String expectedMetadata, String actualMetadata) {
11         WebElement serviceNameElem = GeneralUIUtils.getWebElementByTestID(actualMetadata);
12         String actualServiceName = serviceNameElem.getText();
13         Assert.assertEquals(expectedMetadata, actualServiceName);
14     }
15
16     void validateServiceCreationDialog(Service expectedService) {
17         assertThatServiceCreationDialogIsVisible();
18         assertServiceMetadata(expectedService.name, Constants.SERVICE_NAME);
19         assertServiceMetadata(expectedService.uuid, Constants.SERVICE_UUID);
20         assertServiceMetadata(expectedService.invariantUuid, Constants.SERVICE_INVARIANT_UUID);
21         assertServiceMetadata(expectedService.category, Constants.SERVICE_CATEGORY);
22         assertServiceMetadata(expectedService.version, Constants.SERVICE_VERSION);
23         assertServiceMetadata(expectedService.description, Constants.SERVICE_DESCRIPTION);
24     }
25
26     void assertThatServiceCreationDialogIsVisible() {
27         boolean byText = GeneralUIUtils.findAndWaitByText(Constants.BrowseASDC.CREATE_SERVICE_INSTANCE, 15);
28         Assert.assertTrue(byText);
29     }
30
31     void assertSuccessfulServiceInstanceCreation() {
32         boolean byText = GeneralUIUtils.findAndWaitByText(Constants.BrowseASDC.SERVICE_INSTANCE_CREATED_SUCCESSFULLY_TEXT, 100);
33         Assert.assertTrue(Constants.BrowseASDC.SERVICE_INSTANCE_CREATION_FAILED_MESSAGE, byText);
34     }
35 }