1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
package vid.automation.test.test;
import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
import vid.automation.test.Constants;
import vid.automation.test.infra.Features;
import vid.automation.test.infra.Get;
import vid.automation.test.infra.SelectOption;
import vid.automation.test.model.Service;
import vid.automation.test.model.User;
import vid.automation.test.sections.CreateNewInstancePage;
import vid.automation.test.sections.SideMenu;
import vid.automation.test.services.BulkRegistration;
import vid.automation.test.services.ServicesService;
import vid.automation.test.services.SimulatorApi;
import java.io.IOException;
import java.util.List;
public class CreateNewInstanceTest extends CreateInstanceDialogBaseTest {
private ServicesService servicesService = new ServicesService();
public CreateNewInstanceTest() throws IOException {
}
@Test
private void testCreateNewServiceInstance() throws Exception {
if (!Features.CREATE_INSTANCE_TEST.isActive()) {
// time bomb, as it fails on pipeline and I don't know how to fix it
return;
}
SimulatorApi.clearAll();
BulkRegistration.createNewServiceInstance("SILVIA ROBBINS");
User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
relogin(user.credentials);
SideMenu.navigateToCreateNewServicePage();
CreateNewInstancePage createNewInstancePage = new CreateNewInstancePage();
String subscriberName = "SILVIA ROBBINS";
assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
createNewInstancePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
createNewInstancePage.clickSubmitButton();
assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SUBSCRIBER_NAME_TEST_ID, subscriberName);
String serviceType = "TYLER SILVIA";
assertDropdownPermittedItemsByName(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
createNewInstancePage.selectServiceTypeByName(serviceType);
createNewInstancePage.clickSubmitButton();
assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SERVICE_TYPE_NAME_TEST_ID, serviceType);
Service service = servicesService.getService( "c079d859-4d81-4add-a9c3-94551f96e2b0");
String instanceName = createNewInstancePage.generateInstanceName();
BulkRegistration.deployNewServiceInstance(instanceName);
createNewInstancePage.clickDeployServiceButtonByServiceUUID(service.uuid);
validateServiceCreationDialog(service, subscriberName, serviceType);
createNewInstancePage.setInstanceName(instanceName);
SelectOption.byTestIdAndVisibleText("WayneHolland", Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
SelectOption.byTestIdAndVisibleText("x1", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
createNewInstancePage.selectSuppressRollback("false");
createNewInstancePage.clickConfirmButton();
assertSuccessfulServiceInstanceCreation();
createNewInstancePage.clickCloseButton();
}
@Test
public void testSearchServicesWithSubscriberCAR_2020_ER() throws Exception {
SimulatorApi.clearAll();
BulkRegistration.createNewServiceInstance("CAR_2020_ER");
User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
relogin(user.credentials);
SideMenu.navigateToCreateNewServicePage();
CreateNewInstancePage createNewInstancePage = new CreateNewInstancePage();
String subscriberName = "CAR_2020_ER";
assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
createNewInstancePage.selectSubscriberById("CAR_2020_ER");
createNewInstancePage.clickSubmitButton();
assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SUBSCRIBER_NAME_TEST_ID, subscriberName);
String serviceType = "MSO-dev-service-type";
assertDropdownPermittedItemsByName(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
createNewInstancePage.selectServiceTypeByName(serviceType);
createNewInstancePage.clickSubmitButton();
assertSuccessfulSelection(Constants.CreateNewInstance.SELECTED_SERVICE_TYPE_NAME_TEST_ID, serviceType);
assertSuccessfulGetServicesList();
}
private void assertSuccessfulSelection(String elementTestId, String expectedSelection) {
GeneralUIUtils.ultimateWait();
WebElement selectedElement = GeneralUIUtils.getWebElementByTestID(elementTestId, 30);
Assert.assertEquals(selectedElement.getText(), expectedSelection);
}
private void assertSuccessfulGetServicesList() {
GeneralUIUtils.ultimateWait();
List<List<String>> tableRows = Get.tableBodyValuesByTestId("services-list");
Assert.assertTrue(tableRows.size() > 0);
}
private void validateServiceCreationDialog(Service expectedService, String subscriberName, String serviceType) {
assertServiceMetadata(subscriberName, Constants.SUBSCRIBER_NAME);
assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
validateServiceCreationDialog(expectedService);
}
}
|