2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.execute.resourceui;
23 import static org.testng.AssertJUnit.assertTrue;
25 import java.util.List;
27 import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
28 import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
31 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
32 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
33 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
34 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
35 import org.openqa.selenium.WebElement;
36 import org.testng.annotations.BeforeMethod;
37 import org.testng.annotations.Test;
39 public class ChangeLifeCycleStatFromCatalogTest extends SetupCDTest {
41 public ChangeLifeCycleStatFromCatalogTest() {
42 // TODO Auto-generated constructor stub
45 // This test check the status filter .
47 private ResourceReqDetails resourceDetails;
50 public void beforTest() {
51 resourceDetails = ElementFactory.getDefaultResource();
55 public void checkInFromCatalog() throws InterruptedException {
56 GeneralUIUtils.clickSaveIcon();
57 GeneralUIUtils.clickASDCLogo();
58 GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
59 GeneralUIUtils.catalogSearchBox(resourceDetails.getName());
60 List<WebElement> assets = GeneralUIUtils.getWorkspaceElements();
61 if (assets.isEmpty()) {
62 System.out.println("error elements not found.");
64 for (WebElement webElement : assets) {
66 GeneralUIUtils.checkIn();
67 GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click();
69 System.out.println(ResourceUIUtils.lifeCycleStateUI());
70 System.out.println(LifeCycleStateEnum.CHECKIN.getValue());
71 assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue()));
79 public void checkOutFromCatalog() throws Exception {
80 GeneralUIUtils.clickSaveIcon();
81 GeneralUIUtils.clickASDCLogo();
82 GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
83 GeneralUIUtils.catalogSearchBox(resourceDetails.getName());
84 List<WebElement> assets = GeneralUIUtils.getWorkspaceElements();
85 if (assets.isEmpty()) {
86 System.out.println("error elements not found.");
88 for (WebElement webElement : assets) {
90 GeneralUIUtils.checkinCheckout(resourceDetails.getName());
91 assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue()));
99 protected UserRoleEnum getRole() {
100 return UserRoleEnum.DESIGNER;