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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
package vid.automation.test.test;
import org.junit.Assert;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import vid.automation.test.Constants;
import vid.automation.test.infra.Click;
import vid.automation.test.infra.Exists;
import vid.automation.test.infra.Get;
import vid.automation.test.infra.Wait;
import vid.automation.test.model.User;
import vid.automation.test.sections.PnfSearchAssociationPage;
import vid.automation.test.sections.VidBasePage;
import vid.automation.test.sections.ViewEditPage;
import vid.automation.test.services.BulkRegistration;
import vid.automation.test.services.SimulatorApi;
import vid.automation.test.services.UsersService;
import java.io.IOException;
public class AssociatePnfTest extends VidBaseTestCase {
private UsersService usersService = new UsersService();
private VidBasePage vidBasePage = new VidBasePage();
private ViewEditPage viewEditPage = new ViewEditPage();
private PnfSearchAssociationPage pnfSearchAssociationPage = new PnfSearchAssociationPage();
private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
private String pnfInstanceName = "MX_960-F722";
private String pnfModelName = "pnf 0";
public AssociatePnfTest() throws IOException { }
//work with Simulator & asdc client
@Test
public void testAssociatePnf() throws Exception {
SimulatorApi.clearAll();
BulkRegistration.searchExistingServiceInstance();
BulkRegistration.associatePnf();
User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
relogin(user.credentials);
goToExistingInstanceById(serviceInstanceId);//vid-test-444
addPNF(pnfModelName);//vid-test-444
searchPNF(pnfInstanceName);
testResultSearchPNF();
associatePNF();
vidBasePage.assertMsoRequestModal("COMPLETE - Success");
vidBasePage.clickCloseButton();
}
@Test
public void testRainyAssociatePnf() throws Exception {
SimulatorApi.clearAll();
BulkRegistration.searchExistingServiceInstance();
BulkRegistration.associatePnfError();
User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
relogin(user.credentials);
goToExistingInstanceById(serviceInstanceId);
addPNF(pnfModelName);
searchPNF(pnfInstanceName);
associatePNF();
vidBasePage.assertMsoRequestModal("Error");
vidBasePage.clickCloseButton();
}
@Test
public void testRainyChoosePnf() throws Exception {
SimulatorApi.clearAll();
BulkRegistration.searchExistingServiceInstance();
BulkRegistration.associatePnfError();
User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
relogin(user.credentials);
goToExistingInstanceById(serviceInstanceId);
String pnfName= "pnf 1";
GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID, 60);
String message = String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,
Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID,"Add network instance");
boolean waitForElementResult = Wait.waitByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + pnfName, 60);
Assert.assertTrue(message, !waitForElementResult);
}
@Test
public void testRainySearchPnfInstance() throws Exception {
SimulatorApi.clearAll();
BulkRegistration.searchExistingServiceInstance();
BulkRegistration.associatePnfError();
User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
relogin(user.credentials);
goToExistingInstanceById(serviceInstanceId);
addPNF(pnfModelName);
searchPNF("AAAAA");
Wait.angularHttpRequestsLoaded();
WebElement errorMessageWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.NOT_FOUND_ERROR_TEST_ID, 60);
Assert.assertEquals("not found PNF instance, error message not equals the expected message","The specified PNF instance AAAAA does not exist in A&AI.\n" +
"Please note: A&AI is case sensitive",errorMessageWebElement.getText());
Assert.assertTrue(Constants.PnfAssociation.NOT_FOUND_ERROR_MESSAGE, errorMessageWebElement!=null);
assertAssociateButtonState(false);
}
private void assertAssociateButtonState(boolean shouldBeEnabled) {
WebElement associateWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.ASSOCIATE_PNF_TEST_ID, 60);
boolean enabledAssociate=associateWebElement.isEnabled();
if(shouldBeEnabled) {
Assert.assertTrue(Constants.PnfAssociation.PNF_ENABLE_ASSOCIATE_ERROR_MESSAGE, enabledAssociate);
}else{
Assert.assertTrue(Constants.PnfAssociation.PNF_DISABLE_ASSOCIATE_ERROR_MESSAGE, !enabledAssociate);
}
GeneralUIUtils.ultimateWait();
}
private void associatePNF() throws InterruptedException {
pnfSearchAssociationPage.clickAssociateButton();
}
private void addPNF(String name){
viewEditPage.selectNodeInstanceToAdd(name);
checkServiceModelInfo();
assertAssociateButtonState(false);
}
private void searchPNF(String name){
pnfSearchAssociationPage.setPnfName(name);
pnfSearchAssociationPage.clickSearchButton();
}
private void testResultSearchPNF(){
checkPnfProperties();
Wait.angularHttpRequestsLoaded();
assertAssociateButtonState(true);
}
private void checkServiceModelInfo() {
Wait.angularHttpRequestsLoaded();
//Service name
String elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.SERVIICE_NAME_KEY;
String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Demo Service 1");
//model name
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_NAME;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Test Pnf");
//service instance name
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.SERVICE_INSTANCE_NAME;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"vid-test-444");
//Model Invariant UUID
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_INVARIANT_UUID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"61eba322-c758-48f6-8942-1a7625aaaffb");
//ubscriber NameModel Invariant UUID
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.SUBSCRIBER_NAME_KEY;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"USP VOICE");
//Model Version
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_VERSION;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"0.1");
//Model UUID
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_UUID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"089b1c03-ff6b-4914-8c20-a7de3d375e8d");
//Model Customization UUID
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.MODEL_CUSTOMIZATION_UUID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"cabf6d26-c362-4444-ba06-f850e8af2d35");
//Resource Name
elementTestId = Constants.serviceModelInfo.INFO_TEST_ID_PREFIX + Constants.serviceModelInfo.RESOURCE_NAME;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.serviceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,pnfModelName);
}
private void checkPnfProperties() {
//Pnf Instance unique name
String elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME_TEST_ID;
String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,pnfInstanceName);
//Pnf Instance name2
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2");
//Pnf Instance name2 source
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_SOURCE_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2-source");
//Pnf Instance Id
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_ID_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-id");
//Pnf Instance Equipment type
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_TYPE_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Switch");
//Pnf Instance Equipment vendor
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_VENDOR_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Cisco");
//Pnf Instance Equipment model
elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_MODEL_TEST_ID;
infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"ASR1002-X");
}
}
|