cbc28d0b09244144c2c254edb9ad449423345f06
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / ViewEditServiceInstanceTest.java
1 package vid.automation.test.test;
2
3 import static org.apache.logging.log4j.core.util.Assert.isNonEmpty;
4 import static org.hamcrest.CoreMatchers.is;
5 import static org.hamcrest.MatcherAssert.assertThat;
6 import static org.hamcrest.Matchers.equalTo;
7 import static org.hamcrest.collection.IsEmptyCollection.empty;
8 import static org.testng.AssertJUnit.assertEquals;
9 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
10
11 import com.google.common.collect.ImmutableMap;
12 import java.text.ParseException;
13 import java.text.SimpleDateFormat;
14 import java.time.LocalDate;
15 import java.util.Arrays;
16 import java.util.List;
17 import java.util.Map;
18 import java.util.regex.Matcher;
19 import java.util.regex.Pattern;
20 import org.hamcrest.MatcherAssert;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
24 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails;
25 import org.openqa.selenium.By;
26 import org.openqa.selenium.WebElement;
27 import org.testng.annotations.AfterMethod;
28 import org.testng.annotations.DataProvider;
29 import org.testng.annotations.Test;
30 import vid.automation.test.Constants;
31 import vid.automation.test.infra.Click;
32 import vid.automation.test.infra.Exists;
33 import vid.automation.test.infra.FeatureTogglingTest;
34 import vid.automation.test.infra.Features;
35 import vid.automation.test.infra.Get;
36 import vid.automation.test.infra.Wait;
37 import vid.automation.test.model.User;
38 import vid.automation.test.sections.VidBasePage;
39 import vid.automation.test.sections.ViewEditPage;
40 import vid.automation.test.services.BulkRegistration;
41 import vid.automation.test.services.SimulatorApi;
42
43 public class ViewEditServiceInstanceTest extends VidBaseTestCase {
44
45     private ViewEditPage viewEditPage = new ViewEditPage();
46     VidBasePage vidBasePage =new VidBasePage();
47     private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
48     private String crServiceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7testCR";
49     private String serviceFabricInstanceId = "c187e9fe-40c3-4862-b73e-84ff056205f61234";
50     private  String serviceInstanceId2 ="c187e9fe-40c3-4862-b73e-84ff056205f6";
51     private final String DEACTIVATE_ACTION = "deactivate";
52     private final String ACTIVATE_ACTION = "activate";
53     private List<String> pnfs = Arrays.asList("SANITY6785cce9", "tesai371ve2");
54     private final String serviceInstanceIdeWithoutModelVerId ="9caf5581-40ab-47be-b1f1-909a87724add";
55     private final String crNetworkText ="NETWORK INSTANCE GROUP: l3network-id-rs804s | ROLE: RosemaProtectedOam.OAM | TYPE: Tenant_Layer_3 | # OF NETWORKS: 3";
56     private final String crCollectionText ="COLLECTION: collection-name | TYPE: L3-NETWORK";
57     private final String crInfoText = "\"requestState\": \"COMPLETE\"";
58     SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
59     static final String LCP_REGION = "hvf6";
60     static final String CLOUD_OWNER = "AIC";
61     static final String TENANT = "bae71557c5bb4d5aac6743a4e5f1d054";
62
63
64     ///////////////////////////////////////////////
65     /// Activate / Deactivate service instance ///
66     //////////////////////////////////////////////
67
68     @FeatureTogglingTest(value = Features.FLAG_1908_RESUME_MACRO_SERVICE, flagActive = false)
69     @Test
70     public void testViewEditCRServiceInstance() {
71         SimulatorApi.clearAll();
72         BulkRegistration.searchExistingCRServiceInstance("Created");
73         BulkRegistration.activateServiceInstance(ACTIVATE_ACTION);
74         final PresetAAIGetNetworkCollectionDetails presetAAIGetNetworkCollectionDetails = new PresetAAIGetNetworkCollectionDetails(crServiceInstanceId);
75         SimulatorApi.registerExpectationFromPreset(presetAAIGetNetworkCollectionDetails, APPEND);
76         goToExistingInstanceById(crServiceInstanceId);
77         WebElement webElement = Get.byTestId(Constants.ViewEdit.COLLECTIONDIV);
78         Assert.assertNotNull(webElement);
79         Assert.assertEquals(webElement.getText(), crCollectionText);
80         webElement = Get.byTestId(Constants.ViewEdit.COLLECTIONNETWORKDIV);
81         Assert.assertNotNull(webElement);
82         Assert.assertEquals(webElement.getText(), crNetworkText);
83         viewEditPage.clickInfoButton();
84         webElement = Get.byTestId(Constants.ViewEdit.SERVICE_INSTANCE_ID);
85         Assert.assertEquals(webElement.getText(), crServiceInstanceId);
86         webElement = Get.byTestId(Constants.ViewEdit.DETAILS_LOG);
87         Assert.assertTrue(webElement.getText().contains(crInfoText));
88         webElement = Get.byTestId(Constants.ViewEdit.DETAILS_CLOSE_BTN);
89         webElement.click();
90         viewEditPage.clickDeleteButton();
91     }
92     private void deleteInstance(String deleteButtonId, String successMessage) {
93         deleteInstance(deleteButtonId, successMessage, Constants.CONFIRM_RESUME_DELETE_TESTS_ID);
94     }
95
96     private void deleteInstance(String deleteButtonId, String successMessage, String confirmButtonId) {
97         navigateToViewEditPageOfuspVoiceVidTest444("7a6ee536-f052-46fa-aa7e-2fca9d674c44");
98         Click.byTestId(deleteButtonId);
99         viewEditPage.selectLcpRegion(LCP_REGION, CLOUD_OWNER);
100         viewEditPage.selectTenant(TENANT);
101         vidBasePage.clickButtonByTestId(confirmButtonId);
102         viewEditPage.assertMsoRequestModal(successMessage);
103         viewEditPage.clickCommitCloseButton();
104         GeneralUIUtils.ultimateWait();
105     }
106
107     @Test
108     public void deleteVolumeGroupInstance_deleteDialogAppears_msoResponseIsOk() {
109         SimulatorApi.clearAll();
110         BulkRegistration.deleteExistingVolumeGroupInstance("CREATED");
111         deleteInstance(Constants.ViewEdit.DELETE_VNF_VOLUME_GROUP_BUTTON_TEST_ID, Constants.ViewEdit.VOLUME_GROUP_DELETED_SUCCESSFULLY_TEXT);
112     }
113
114     @Test
115     public void deleteVfModuleInstance_deleteDialogAppears_msoResponseIsOk() {
116         SimulatorApi.clearAll();
117         BulkRegistration.deleteExistingVfModuleInstance("CREATED");
118         deleteInstance(Constants.ViewEdit.DELETE_VF_MODULE_BUTTON_TEST_ID + "aa", Constants.ViewEdit.VF_MODULE_DELETED_SUCCESSFULLY_TEXT);
119     }
120
121     @Test
122     public void softDeleteAndResumeVfModuleInstance_deleteDialogAppears_msoResponseIsOk() {
123         SimulatorApi.clearAll();
124         String vfModuleName = "my_vfModule";
125         BulkRegistration.deleteExistingVfModuleInstance("ACTIVE");
126         deleteInstance(Constants.ViewEdit.DELETE_VF_MODULE_BUTTON_TEST_ID + vfModuleName, Constants.ViewEdit.VF_MODULE_DELETED_SUCCESSFULLY_TEXT, Constants.SOFT_DELETE_TESTS_ID);
127         BulkRegistration.resumeWithHomingDataVfModule("ACTIVE", "Assigned", vfModuleName);
128         navigateToViewEditPageOfuspVoiceVidTest444("7a6ee536-f052-46fa-aa7e-2fca9d674c44");
129         viewEditPage.clickResumeButton(vfModuleName);
130         assertThat("Select lcp region shouldn't be display when homing data is presented",
131                 GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID)),
132                 is(empty()));
133         assertThat("Select tenant shouldn't be display when homing data is presented",
134                 GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.TENANT_SELECT_TESTS_ID)),
135                 is(empty()));
136         viewEditPage.clickConfirmButtonInResumeDelete();
137         assertSuccessfulVFModuleCreation();
138         viewEditPage.clickCommitCloseButton();
139         GeneralUIUtils.ultimateWait();
140     }
141
142     @Test
143     public void deleteNetworkInstance_deleteDialogAppears_msoResponseIsOk() {
144         SimulatorApi.clearAll();
145         BulkRegistration.deleteExistingNetworkInstance("CREATED");
146         deleteInstance(Constants.ViewEdit.DELETE_NETWORK_BUTTON_TEST_ID, Constants.ViewEdit.VL_DELETED_SUCCESSFULLY_TEXT);
147     }
148
149     @Test
150     public void deleteVnfInstance_deleteDialogAppears_msoResponseIsOk() {
151         SimulatorApi.clearAll();
152         BulkRegistration.deleteExistingVnfInstance("CREATED");
153         deleteInstance(Constants.ViewEdit.DELETE_VNF_BUTTON_TEST_ID,Constants.ViewEdit.VNF_DELETED_SUCCESSFULLY_TEXT);
154     }
155
156     @Test
157     public void deleteServiceInstance_deleteDialogAppears_msoResponseIsOk() {
158         SimulatorApi.clearAll();
159         BulkRegistration.deleteExistingServiceInstance("ACTIVE");
160         navigateToViewEditPageOfuspVoiceVidTest444("7a6ee536-f052-46fa-aa7e-2fca9d674c44");
161         viewEditPage.clickDeleteButton();
162         vidBasePage.clickConfirmButtonInResumeDelete();
163         viewEditPage.assertMsoRequestModal(Constants.ViewEdit.SERVICE_DELETED_SUCCESSFULLY_TEXT);
164         viewEditPage.clickCommitCloseButton();
165         GeneralUIUtils.ultimateWait();
166     }
167
168     @Test(dataProvider = "serviceStatusesAndExpectedResults")
169     public void testActivateServiceInstanceTransportType(String orchStatus) {
170         SimulatorApi.clearAll();
171         BulkRegistration.searchExistingServiceInstance(orchStatus);
172         BulkRegistration.activateServiceInstance(ACTIVATE_ACTION);
173         goToExistingInstanceById(serviceInstanceId);
174         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID, true);
175         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
176         assertResumeButtonVisibility(false, false);
177         assertAndCheckShowAssignmentsSdncUrl(orchStatus, serviceInstanceId);
178         viewEditPage.clickActivateButton();
179         viewEditPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT);
180         viewEditPage.clickCloseButton();
181     }
182
183     @Test
184     public void testActivateServiceInstanceWithFabric() {
185         String orchStatus = "assiGNed";
186         SimulatorApi.clearAll();
187         BulkRegistration.searchExistingServiceInstanceWithFabric(orchStatus);
188         goToExistingInstanceById(serviceFabricInstanceId);
189         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
190         boolean flagIsActive = Features.FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS.isActive();
191         if(flagIsActive) {
192             viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_FABRIC_CONFIGURATION_BUTTON_TEST_ID, true);
193             viewEditPage.clickActivateFabricConfigurationButton();
194             viewEditPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT);
195             viewEditPage.clickCloseButton();
196         }
197     }
198
199     private void assertAndCheckShowAssignmentsSdncUrl(String orchStatus, String serviceInstanceId) {
200         boolean buttonIsEnable = Features.FLAG_SHOW_ASSIGNMENTS.isActive() && orchStatus.equals("assiGNed");
201         boolean isNotDisplay = GeneralUIUtils.getDriver().findElements(Get.getXpathForDataTestId(Constants.ViewEdit.SHOW_ASSIGNMENTS_BUTTON_TEST_ID)).isEmpty();
202         Assert.assertNotEquals(isNotDisplay, buttonIsEnable);
203
204         if (buttonIsEnable)  {
205             WebElement webElement = Get.byTestId(Constants.ViewEdit.SHOW_ASSIGNMENTS_BUTTON_TEST_ID);
206             String expectedUrl = "https://mtan.onap.org:8448/configAdapter/index#/resource_manager/"+serviceInstanceId;
207             MatcherAssert.assertThat("Show assignments SDNC url is wrong",
208                     webElement.getAttribute("href"), equalTo(expectedUrl));
209         }
210
211     }
212
213     @DataProvider
214     public static Object[][] serviceStatusesAndExpectedResults() {
215         return new Object[][] {
216                 { "Created" },
217                 {"pendingdeLete" },
218                 {"pending-deLete" },
219                 {"assiGNed" }
220         };
221     }
222
223     @Test
224     public void testDeactivateServiceInstanceNotTransportType()throws Exception {
225         SimulatorApi.clearAll();
226         BulkRegistration.searchExistingServiceInstancePortMirroring("Active", "mdt1");
227         goToExistingInstanceById(serviceInstanceId2);
228         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID, false);
229         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID, true);
230     }
231
232     @Test
233     public void testActivateServiceInstanceNotTransportType()throws Exception {
234         SimulatorApi.clearAll();
235         BulkRegistration.searchExistingServiceInstancePortMirroring("Created", "mdt1");
236         goToExistingInstanceById(serviceInstanceId2);
237         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID, true);
238         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID, false);
239     }
240
241     @Test
242     public void testActivateServiceInstanceError()throws Exception {
243         SimulatorApi.clearAll();
244         BulkRegistration.searchExistingServiceInstance("Created");
245         BulkRegistration.activateServiceInstanceError(ACTIVATE_ACTION);
246         goToExistingInstanceById(serviceInstanceId);
247         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,true);
248         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
249         viewEditPage.clickActivateButton();
250         viewEditPage.assertMsoRequestModal("Error");
251         viewEditPage.clickCloseButton();
252     }
253
254     @Test
255     public void testDeactivateServiceInstance(){
256         SimulatorApi.clearAll();
257         BulkRegistration.searchExistingServiceInstance("Active");
258         BulkRegistration.activateServiceInstance(DEACTIVATE_ACTION);
259         goToExistingInstanceById(serviceInstanceId);
260         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,true);
261         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,false);
262         assertResumeButtonVisibility(true, true);
263         viewEditPage.clickDeactivateButton();
264         viewEditPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT);
265         SimulatorApi.clearAll();
266         BulkRegistration.searchExistingServiceInstance("PendingDelete");
267         BulkRegistration.activateServiceInstance(ACTIVATE_ACTION);
268         viewEditPage.clickCloseButton();
269         GeneralUIUtils.findAndWaitByText(serviceInstanceId, 30); //kind of "ultimate wait" for refresh to complete
270         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,true);
271         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,false);
272     }
273
274     @Test
275     public void testDeactivateServiceInstanceError()throws Exception {
276         SimulatorApi.clearAll();
277         BulkRegistration.searchExistingServiceInstance("Active");
278         BulkRegistration.activateServiceInstanceError(DEACTIVATE_ACTION);
279         goToExistingInstanceById(serviceInstanceId);
280         viewEditPage.assertButtonState(Constants.ViewEdit.ACTIVATE_BUTTON_TEST_ID,false);
281         viewEditPage.assertButtonState(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID,true);
282         viewEditPage.clickDeactivateButton();
283         viewEditPage.assertMsoRequestModal("Error");
284         viewEditPage.clickCloseButton();
285     }
286
287     @Test
288     public void testTimestampOnDeactivateAndInfoServiceInstance() throws ParseException {
289         SimulatorApi.clearAll();
290         BulkRegistration.searchExistingServiceInstance("Active");
291         BulkRegistration.activateServiceInstance(DEACTIVATE_ACTION);
292         SimulatorApi.registerExpectation(
293                 Constants.RegisterToSimulator.SearchForServiceInstance.GET_MSO_INSTANCE_ORCH_STATUS_REQ,
294                 ImmutableMap.<String, Object>of("<SERVICE_INSTANCE_ID>", "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"),
295                 SimulatorApi.RegistrationStrategy.APPEND);
296         goToExistingInstanceById(serviceInstanceId);
297         Click.byClass("service-info");
298         GeneralUIUtils.ultimateWait();
299         assertEquals("Timestamp isn't the finished time", getTimeatampValue(Constants.ViewEdit.DETAILS_LOG), "Tue, 24 Oct 2017 02:28:39");
300         viewEditPage.clickCloseButton();
301         viewEditPage.clickDeactivateButton();
302         GeneralUIUtils.ultimateWait();
303         try {
304             dateFormat.parse(getTimeatampValue(Constants.ViewEdit.MSO_COMMIT_LOG));
305         } catch (ParseException e) {
306             System.err.println("Timestamp isn't a date");
307             throw e;
308         }
309         viewEditPage.clickCloseButton();
310     }
311
312     private String getTimeatampValue(String dataTestsId) {
313         String logText = Get.byTestId(dataTestsId).getText();
314         Matcher matcher = Pattern.compile("\"timestamp\": \"(.*?)\"").matcher(logText);
315         matcher.find();
316         return matcher.group(1);
317     }
318
319
320     /////////////////////////////////////////////
321     /// Dissociate pnf from service instance ///
322     ////////////////////////////////////////////
323
324     @Test
325     public void testGetAssociatedPnfsForServiceInstance() {
326         SimulatorApi.clearAll();
327         BulkRegistration.searchExistingServiceInstance();
328         BulkRegistration.getAssociatedPnfs();
329
330         goToExistingInstanceById(serviceInstanceId);
331         for (String pnf: pnfs) {
332             viewEditPage.getPnf(pnf);
333         }
334     }
335
336     @Test
337     public void testPnfsNotExistForServiceInstance() {
338         SimulatorApi.clearAll();
339         BulkRegistration.searchExistingServiceInstance();
340
341         goToExistingInstanceById(serviceInstanceId);
342         assertNoPnfExists();
343     }
344
345      @Test
346     public void testSuccessDissociatePnfFromServiceInstance() throws Exception {
347         SimulatorApi.clearAll();
348         BulkRegistration.searchExistingServiceInstance();
349         BulkRegistration.getAssociatedPnfs();
350         BulkRegistration.dissociatePnf();
351         goToExistingInstanceById(serviceInstanceId);
352         dissociatePnf(pnfs.get(0)); //SANITY6785cce9
353         viewEditPage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT);
354         viewEditPage.clickCloseButton();
355     }
356
357     @Test
358     public void testFailDissociatePnfFromServiceInstance() throws Exception {
359         SimulatorApi.clearAll();
360         BulkRegistration.searchExistingServiceInstance();
361         BulkRegistration.getAssociatedPnfs();
362         SimulatorApi.registerExpectation(Constants.RegisterToSimulator.pProbe.REMOVE_PNF_RELATIONSHIP_ERROR, SimulatorApi.RegistrationStrategy.APPEND);
363
364         if (LocalDate.now().isBefore(LocalDate.parse("2018-06-04"))) return; // skip few days to see green build
365         goToExistingInstanceById(serviceInstanceId);
366         dissociatePnf(pnfs.get(0)); //SANITY6785cce9
367         viewEditPage.assertMsoRequestModal("Error");
368         GeneralUIUtils.ultimateWait();
369         viewEditPage.clickCloseButton();
370     }
371
372
373     private void assertNoPnfExists() {
374         WebElement pnfElement = Get.byClassAndText("tree-node", "PNF: ");
375         Assert.assertNull("Pnf found under service instance", pnfElement);
376     }
377
378     private void dissociatePnf(String pnfName) throws InterruptedException {
379         viewEditPage.clickDissociatePnfButton(pnfName);
380         assertDissociateConfirmModal(pnfName);
381     }
382
383     private void assertDissociateConfirmModal(String pnfName) {
384         Wait.modalToBeDisplayed();
385         Assert.assertTrue(Exists.modal());
386         Assert.assertTrue(Exists.byCssSelectorAndText(".modal-body span", String.format(Constants.ViewEdit.DISSOCIATE_CONFIRM_MODAL_TEXT, pnfName)));
387         WebElement confirmBtn = Get.byId(Constants.ViewEdit.DISSOCIATE_CONFIRM_MODAL_BTN_ID);
388         Assert.assertNotNull(confirmBtn);
389         confirmBtn.click();
390 //        Wait.modalToDisappear();
391     }
392
393     @Test
394     public void testErrorMsgNoModelVerIdFromAai() throws Exception {
395         getExtendTest().info("from Bug 480129,this test check the error case, while model version Id not supplied from A&AI");
396         SimulatorApi.clearAll();
397         BulkRegistration.genericSearchExistingServiceInstance();
398         BulkRegistration.searchExistingServiceInstanceWithoutModelVerId();
399         goToExistingInstanceByIdNoWait(serviceInstanceIdeWithoutModelVerId);
400         viewEditPage.checkAndCloseAlert(Constants.ViewEdit.MODEL_VERSION_ID_MISSING_MSG);
401         String errMsg= viewEditPage.getTextByTestID(Constants.ViewEdit.SUBDETAILS_ERROR_MESSAGE_TEST_ID);
402         Assert.assertEquals(Constants.ViewEdit.MODEL_VERSION_ID_MISSING_MSG, errMsg);
403     }
404
405     private void assertResumeButtonVisibility(boolean pendingActivationResumeVisible, boolean assignedResumeVisible) {
406         ImmutableMap<String, Boolean> vfModulesStatuses = ImmutableMap.of(
407                 "pendingactivation", pendingActivationResumeVisible,
408                 "assigned", assignedResumeVisible,
409                 "pending-delete", false);
410         for(Map.Entry<String, Boolean> entry: vfModulesStatuses.entrySet()) {
411             WebElement vfModule = GeneralUIUtils.getWebElementByClassName("vfModuleTreeNode-" + entry.getKey());
412             Assert.assertEquals(isNonEmpty(vfModule.findElements(By.className("resume"))), entry.getValue());
413         }
414     }
415
416     @Before
417     public void before() throws Exception {
418         User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
419         relogin(user.credentials);
420     }
421
422     @AfterMethod(alwaysRun = true)
423     public void finallyClosePopup() {
424         // Tries closing left-out popups, if any
425         // If none -- catch clause will swallow the exception
426         try {
427             viewEditPage.clickCloseButton(3);
428         } catch (Exception e) {
429             // ok, stop
430         }
431     }
432 }