diff options
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute')
15 files changed, 0 insertions, 2829 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java deleted file mode 100644 index 19a0d6414f..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/adminworkspace/AdminUserManagment.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.adminworkspace; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.validation.constraints.AssertTrue; - -import org.junit.rules.TestName; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.google.common.collect.Ordering; - -public class AdminUserManagment extends SetupCDTest { - // - // public AdminUserManagment() { - // super(new TestName(), AdminUserManagment.class.getName()); - // } - - private WebDriver driver = GeneralUIUtils.getDriver(); - - // Create new USER_ID user - @Test - public void creatUserIdNewUserTest() throws Exception { - String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(userId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.typeToSearchBox(userId); - String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText(); - userId.equals(createdUserUserId); - GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting"); - GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role); - AdminWorkspaceUIUtilies.deleteuser(userId); - - } - - // Create new MacId user - @Test - public void creatMacIdNewUserTest() throws Exception { - - String macId = AdminWorkspaceUIUtilies.defineNewUserId("m12345"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(macId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.typeToSearchBox(macId); - String createdUserUserId = GeneralUIUtils.getWebElementWaitForVisible("tdUSER_ID").getText(); - macId.equals(createdUserUserId); - GeneralUIUtils.getWebElementWaitForVisible("tdLast Active").getText().equals("Waiting"); - GeneralUIUtils.getWebElementWaitForVisible("tdRole").getText().equals(role); - AdminWorkspaceUIUtilies.deleteuser(macId); - } - - // Create exist user and get error already exist . - @Test - public void createxistUserTest() throws Exception { - String userId = AdminWorkspaceUIUtilies.defineNewUserId("th0695"); - String role = AdminWorkspaceUIUtilies.selectUserRole("designer"); - AdminWorkspaceUIUtilies.deleteuser(userId); - GeneralUIUtils.getWebButton("creategreen").click(); - AdminWorkspaceUIUtilies.defineNewUserId(userId); - AdminWorkspaceUIUtilies.selectUserRole("admin"); - GeneralUIUtils.getWebButton("creategreen").click(); - ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") - .equals("User with '" + userId + "' ID already exists."); - GeneralUIUtils.clickOkButton(); - AdminWorkspaceUIUtilies.deleteuser(userId); - - } - - // enter Special chars and the create button disabled. - @Test - public void insertSpacialcharsTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("!@DER%"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // enter invalid macid and create button shall be disabled. - @Test - public void insertInvalidUserMacidTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("k12345"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // enter invalid userId and create button shall be disabled. - @Test - public void insertInvalidUserUserIdTest() throws Exception { - AdminWorkspaceUIUtilies.defineNewUserId("ac1c23"); - AdminWorkspaceUIUtilies.selectUserRole("designer"); - WebElement createbutton = GeneralUIUtils.getWebElementWaitForVisible("creategreen"); - Assert.assertFalse(createbutton.isEnabled()); - } - - // display users list and sort by column name. - @Test - public void displayuserslistandsorting() throws Exception { - GeneralUIUtils.getWebElementWaitForVisible("thFirst Name").click(); - Collection<WebElement> usersFname = GeneralUIUtils.getWebElements("tdFirst Name"); - for (WebElement webElement : usersFname) { - System.out.println(webElement.getText()); - } - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.ADMIN; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java deleted file mode 100644 index 39755a9db8..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogLeftFilterPanelCheckBoxTest.java +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum; -import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; -import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class CatalogLeftFilterPanelCheckBoxTest extends SetupCDTest { - - public CatalogLeftFilterPanelCheckBoxTest() { - // TODO Auto-generated constructor stub - } - - private ResourceReqDetails resourceDetails; - FileWriter filwriter = GeneralUIUtils.InitializeprintToTxt("CatalogLeftFilterPanelCheckBoxTest"); - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - // filter by Type Resource in catalog - @Test - public void filterByAssetTypeResource() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VF", "VL", "CP", "VFC"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.RESOURCE); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVF() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VF"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VF); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVFC() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VFC"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VFC); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeCP() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("CP"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.CP); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - @Test - public void filterByResourceTypeVL() throws Exception { - List<WebElement> elements = null; - List<String> validValues = Arrays.asList("VL"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.VL); - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.waitForElementsListVisibilityTestMethod("asset-type"); - for (WebElement webElement : elements) { - assertTrue(validValues.contains(webElement.getAttribute("class"))); - } - } - - // @Test - // public void filterByProducTType() throws Exception{ - // List<WebElement> elements = null; - // List<String> validValues = Arrays.asList("PRODUCT"); - // GeneralUIUtils.checkIn(); - // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - // GeneralUIUtils.catalogFilterTypeChecBox(TypesEnum.PRODUCT); - // GeneralUIUtils.getWorkspaceElements(); - // try { - // elements = - // GeneralUIUtils.getEelementsByClassName1("w-sdc-dashboard-card-avatar"); - // for (WebElement webElement : elements) { - // assertTrue(validValues.contains(webElement.findElement(By.xpath(".//*")).getAttribute("class"))); - // } - // } catch (Exception e) { - // System.out.println("No Elements founds!"); - // } - // } - - @Test - public void filterByResourceCategories() throws Exception { - List<WebElement> elements = null; - List<String> validValues = null; - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - Thread.sleep(2000); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE); - List<String> categories = CatalogUIUtilitis.abcd(); - for (String category : categories) { - validValues = CatalogUIUtilitis.getAllSubcategoriesByUniqueId(category); - boolean bool = false; - try { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - bool = true; - } catch (Exception e) { - while (!bool) { - GeneralUIUtils.scrollDown(); - try { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - bool = true; - } catch (Exception e2) { - - } - } - } - String checkBox = GeneralUIUtils.getWebElementWaitForVisible(category).findElement(By.xpath(".//input")) - .getAttribute("class"); - if (checkBox.contains("ng-not-empty") && validValues != null) { - try { - GeneralUIUtils.getWorkspaceElements(); - elements = GeneralUIUtils.getEelementsBycontainsClassName("sprite-resource-icons"); - for (WebElement webElement : elements) { - String elementUniqueId = webElement.getAttribute("data-tests-id"); - if (!validValues.contains(elementUniqueId)) { - System.out.println("assert error!"); - } - } - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - } catch (Exception e) { - GeneralUIUtils.getWebElementWaitForVisible(category).click(); - System.out.println("No Elements founds!"); - } - } - } - } - - @SuppressWarnings("null") - @Test - public void filterByStatus() throws Exception { - - List<WebElement> elements = null; - List<String> validValues = null; - List<ResourceReqDetails> createdComponents = new ArrayList<ResourceReqDetails>(); - List<String> catalogStatuses = Arrays.asList("IN_DESIGN", "READY_FOR_TESTING", "IN_TESTING", "CERTIFIED", - "DISTRIBUTED"); - GeneralUIUtils.checkIn(); - for (int i = 1; i < catalogStatuses.size() - 1; i++) { - GeneralUIUtils.sleep(3000); - GeneralUIUtils.createAndImportButtons(CreateAndImportButtonsEnum.CREATE_VF, GeneralUIUtils.getDriver()); - resourceDetails.setName(getRandomComponentName("ResourceCDTest-")); - ResourceUIUtils.createResourceInUI(resourceDetails, getUser()); - GeneralUIUtils.clickSubmitForTest(); - if (catalogStatuses.get(i) == "IN_TESTING") { - GeneralUIUtils.testerUser(true, false, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - - } - if (catalogStatuses.get(i) == "CERTIFIED") { - GeneralUIUtils.testerUser(true, true, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - } - if (catalogStatuses.get(i) == "DISTRIBUTED") { - GeneralUIUtils.testerUser(true, true, resourceDetails); - GeneralUIUtils.governorUser(false, true, resourceDetails); - GeneralUIUtils.opsUser(true, false, resourceDetails); - GeneralUIUtils.sleep(3000); - navigateToUrl(getUrl()); - - } - createdComponents.add(resourceDetails); - } - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - // get filters title close. - Thread.sleep(2000); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.TYPE); - GeneralUIUtils.minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum.CATEGORIES); - for (CheckBoxStatusEnum statusEnum : CheckBoxStatusEnum.values()) { - if (catalogStatuses.contains(statusEnum.name().toString())) { - validValues = GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - if (GeneralUIUtils.getWorkspaceElements().size() > 0) { - String checkBox = GeneralUIUtils.getWebElementByName(statusEnum.getCatalogValue()) - .getAttribute("class"); - if (checkBox.contains("ng-not-empty") && validValues != null) { - try { - elements = GeneralUIUtils.getEelementsBycontainsClassName("w-sdc-dashboard-card-edit"); - for (WebElement webElement : elements) { - String className = webElement.getAttribute("class"); - String textCategory = className.substring(className.indexOf(" ")); - assertTrue(validValues.contains(textCategory.replace(" ", ""))); - } - GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - } catch (Exception e) { - GeneralUIUtils.catalogFilterStatusChecBox(statusEnum); - System.out.println("No Elements founds!"); - } - } - } else { - break; - } - } - } - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java deleted file mode 100644 index efdb9532a4..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/CatalogSearchBoxTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.io.FileWriter; -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class CatalogSearchBoxTest extends SetupCDTest { - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - // search by ResourceName - @Test - public void searchResourceInCatalogMenuTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - Thread.sleep(500); - assertTrue(GeneralUIUtils.getWorkspaceElements().size() == 1); - } - - // search by Description - @Test - public void searchResourceInCatalogMenuByDescriptionTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription()); - Thread.sleep(2000); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - - int count = 0; - for (WebElement webElement : assets) { - if (count != 0) { - GeneralUIUtils.catalogSearchBox(resourceDetails.getDescription()); - } - if (count == 0) { - webElement.click(); - } else { - List<WebElement> assets1 = GeneralUIUtils.getWorkspaceElements(); - assets1.get(count).click(); - } - GeneralUIUtils.getWebElementWaitForVisible("description").getText() - .equals(resourceDetails.getDescription()); - GeneralUIUtils.clickExitSign(); - Thread.sleep(500); - count++; - } - } - - // search by tags - @Test - public void searchResourceInCatalogMenuBytagsTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getTags().get(0)); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - List<WebElement> expectedTagsList = GeneralUIUtils.getWebElements("i-sdc-tag-text"); - for (int i = 0; i < expectedTagsList.size(); i++) { - expectedTagsList.get(i).equals(resourceDetails.getTags().get(i)); - } - - } - - // search by Version - @Test - public void searchResourceInCatalogMenuByVersionTest() throws Exception { - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getVersion().replace("V", "")); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText() - .equals(resourceDetails.getVersion()); - } - - // search by SpecialCharacters - @Test - public void searchResourceInCatalogMenuBySpecialCharactersTest() throws Exception { - GeneralUIUtils.moveToStep(StepsEnum.GENERAL); - GeneralUIUtils.defineDescription(resourceDetails.getDescription() + "!@#$%^&*"); - GeneralUIUtils.checkIn(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox("!@#$%^&*"); - Thread.sleep(500); - GeneralUIUtils.getWorkspaceElements().get(0).click(); - GeneralUIUtils.getWebElementWaitForVisible("description").getText().equals(resourceDetails.getDescription()); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java deleted file mode 100644 index a75240d2b2..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ChangeLifeCycleStatFromCatalogTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; - -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.WebElement; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class ChangeLifeCycleStatFromCatalogTest extends SetupCDTest { - - public ChangeLifeCycleStatFromCatalogTest() { - // TODO Auto-generated constructor stub - } - - // This test check the status filter . - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - @Test - public void checkInFromCatalog() throws InterruptedException { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - if (assets.isEmpty()) { - System.out.println("error elements not found."); - } else { - for (WebElement webElement : assets) { - webElement.click(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - Thread.sleep(2000); - System.out.println(ResourceUIUtils.lifeCycleStateUI()); - System.out.println(LifeCycleStateEnum.CHECKIN.getValue()); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue())); - - } - } - - } - - @Test - public void checkOutFromCatalog() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - GeneralUIUtils.catalogSearchBox(resourceDetails.getName()); - List<WebElement> assets = GeneralUIUtils.getWorkspaceElements(); - if (assets.isEmpty()) { - System.out.println("error elements not found."); - } else { - for (WebElement webElement : assets) { - webElement.click(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue())); - - } - } - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java deleted file mode 100644 index 8e9df40068..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/ImportAssetInUITest.java +++ /dev/null @@ -1,480 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import static org.testng.Assert.assertNotEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; -import java.util.Map; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ImportAssetUIUtils; -import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.testng.AssertJUnit; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class ImportAssetInUITest extends SetupCDTest { - - private ResourceReqDetails resourceDetails; - - @BeforeMethod(alwaysRun = true) - public void inializeBeforeImportTest() { - GeneralUIUtils.fileName = "JDM_vfc.yml"; - resourceDetails = ElementFactory.getDefaultResource(); - resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString()); - } - - @Test - public void importAssetFillGeneralInfoAndSelectIconTest() throws Exception { - ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - CreateAndImportButtonsEnum.IMPORT_CP); - ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser()); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - ResourceUIUtils.getVFCGeneralInfoAndValidate(resourceDetails, getUser()); - } - - @Test - public void changeImportedAssetFileTest() throws Exception { - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - String firstFileName = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - AssertJUnit.assertTrue(firstFileName.equals(GeneralUIUtils.fileName)); - String secondFileName = "Valid_tosca_ReplaceTest.yml"; - ResourceUIUtils.importFileWithSendKeyBrowse(GeneralUIUtils.FILE_PATH, secondFileName); - String secondFileNameFromField = GeneralUIUtils.getWebElementWaitForVisible("filename").getText(); - // assertThat(fileName, not(secondFileNameFromField)); - assertNotEquals(GeneralUIUtils.fileName, secondFileNameFromField); - } - - @Test - public void duplicateFileTest() throws Exception { - ResourceUIUtils.importFileWithSendKey(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - CreateAndImportButtonsEnum.IMPORT_CP); - ResourceUIUtils.fillGeneralInfoValuesAndIcon(resourceDetails, getUser()); - String nameofresource = resourceDetails.getName(); - resourceDetails.setName(getRandomComponentName("SecondImportCDTest")); - GeneralUIUtils.checkIn(); - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.allReadyExistErro); - GeneralUIUtils.clickOkButton(); - resourceDetails.setName(nameofresource); - - } - - @Test - public void importInvalidFileTest() throws Exception { - GeneralUIUtils.fileName = "InValid_tosca_File .yml"; - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - equals(ResourceUIUtils.getErrorMessageText("w-sdc-modal-body-content") == GeneralUIUtils.toscaErrorMessage); - GeneralUIUtils.clickOkButton(); - } - - @Test - public void deleteImportAssetFileTest() throws Exception { - ImportAssetUIUtils.importAsssetAndFillGeneralInfo(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - WebElement deleteFileButton = GeneralUIUtils.getDriver() - .findElement(By.className("i-sdc-form-file-upload-x-btn")); - deleteFileButton.click(); - WebElement filefield = GeneralUIUtils.getWebElementWaitForVisible("filename"); - AssertJUnit.assertEquals("", filefield.getText()); - } - - // Add artifact by Clicking the Place holders button. - @Test - public void importAssetAddInformationArtifactPlaceHoldersTest() throws Exception { - // fileName = "CP_WAN.yml"; - String artifactByname = "placeHolder"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT); - GeneralUIUtils.getWebElementWaitForVisible("Features"); - List<WebElement> Placholders = GeneralUIUtils.getDriver().findElements(By.className("add-button")); - for (WebElement element : Placholders) { - Thread.sleep(500); - element.click(); - // Placholders.get(4).click(); - System.out.println(element.getText()); - if (element.getText().equalsIgnoreCase("Add Other Artifact")) { - ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact("Create New Artifact"), false); - } else { - ArtifactUIUtils.valideArtifact(ArtifactUIUtils.addInformationalArtifact(null), false); - } - } - } - - // Add information artifact by Clicking the Add button. - @Test - public void importAssetAddInformationArtifactAddButtonTest() throws Exception { - String type = "Create New Artifact"; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT); - GeneralUIUtils.actionBuild(GeneralUIUtils.getWebButton("add-information-artifact-button")).click(); - ; - ; - Map<String, String> expected = ArtifactUIUtils.addInformationalArtifact(type); - Thread.sleep(1000); - ResourceUIUtils.scrollDownPage(); - ArtifactUIUtils.valideArtifact(expected, false); - } - - // Add New property String Type. - @Test - public void importAssetAddStringPropertyTest() throws Exception { - WebElement prop = null; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - Thread.sleep(500); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("String-Property", "string", - "!This is strig123456@#$%$", "This is description.", null); - WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow"); - GeneralUIUtils.actionBuild(elementTohover).click(); - int counter = 0; - try { - prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")); - } catch (Exception e) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - } finally { - if (prop.isDisplayed()) { - counter++; - } - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Add New property Integer Type. - @Test - public void importAssetAddIntegerPropertyTest() throws Exception { - WebElement prop; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - Thread.sleep(500); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Integer-Property", "integer", "123456", - "This is description.", null); - WebElement elementTohover = GeneralUIUtils.getEelementBycontainsClassName("table-arrow"); - GeneralUIUtils.actionBuild(elementTohover); - int counter = 0; - prop = GeneralUIUtils.getWebElementWaitForVisible(propertyValues.get("name")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Add New property boolean Type. - @Test - public void importAssetAddBooleanPropertyTest() throws Exception { - // fileName = "CP_WAN.yml"; - WebElement prop; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("Boolean-Property", "boolean", "true", - "This is boolean description.", null); - int counter = 0; - WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow")); - GeneralUIUtils.actionBuild(elementTohover); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - AssertJUnit.assertEquals(1, counter); - } - - // Add New property float Type. - @Test - public void importAssetAddFloatPropertyTest() throws Exception { - WebElement prop; - // fileName = "CP_WAN.yml"; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("data-row"); - GeneralUIUtils.getWebButton("addGrey").click(); - Map<String, String> propertyValues = PropertiesUIUtils.addProperties("floatProperty", "float", "22.5", - "This is description.", null); - int counter = 0; - WebElement elementTohover = GeneralUIUtils.getDriver().findElement(By.className("table-arrow")); - GeneralUIUtils.actionBuild(elementTohover); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - if (prop.isDisplayed()) { - counter++; - } - if (counter == 0) { - ResourceUIUtils.scrollDownPage(); - prop = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@data-tests-id='" + propertyValues.get("name") + "']")); - counter++; - } - PropertiesUIUtils.vlidateProperties(propertyValues); - } - - // Edit property. - @Test - public void importAssetEditPropertiesTest() throws Exception { - // fileName = "CP_WAN.yml"; - Map<String, String> expected = null; - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES); - GeneralUIUtils.getEelementBycontainsClassName("table-col-general"); - GeneralUIUtils.getWebButton("addGrey").click(); - expected = PropertiesUIUtils.addProperties("BooleanProperty", "boolean", "true", "This is boolean description.", - null); - GeneralUIUtils.getWebElement(GeneralUIUtils.getDriver(), "table-edit-btn").click(); - ; - List<WebElement> properties = GeneralUIUtils.getDriver().findElements(By.xpath("//*[@*='table-edit-btn']")); - ; - for (WebElement webElement : properties) { - webElement.click(); - GeneralUIUtils.defineDescription("This is Property update"); - GeneralUIUtils.getWebButton("Update").click(); - break; - } - Thread.sleep(2000); - GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='BooleanProperty']")).click(); - Thread.sleep(1000); - String actual = GeneralUIUtils.getDriver() - .findElement(By.xpath("//*[@class='item-opened ng-binding ng-scope']")).getText(); - assertNotEquals(expected.get("name"), actual); - // assertThat(expected.get("name"),not(actual)); - } - - // ************************************************************************************************** - // change VFC version - - // this test return error 500; - @Test(alwaysRun = false) - public void importAssetChangeVersionOfVFCTest() throws Exception { - // fileName = "VFC.yml"; - // resourceDetails.setResourceType(ResourceTypeEnum.VFC.toString()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - - // change VL version - // this test return error 500; - @Test - public void importAssetChangeVersionOfVLTest() throws Exception { - GeneralUIUtils.fileName = "VL.yml"; - resourceDetails.setResourceType(ResourceTypeEnum.VL.getValue()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - // change CP version - - @Test - public void importAssetChangeVersionOfCPTest() throws Exception { - GeneralUIUtils.fileName = "CP_LAN.yml"; - resourceDetails.setResourceType(ResourceTypeEnum.CP.toString()); - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - resourceDetails.setVersion("0.2"); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - version.equals("0.2"); - } - - // @Test - // public void viewPageActivityLogTest() throws Exception { - // resourceDetails.setResourceType(ResourceTypeEnum.VF.toString()); - // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, - // GeneralUIUtils.fileName , resourceDetails, getUser(), - // CreateAndImportButtonsEnum.IMPORT_CP); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // RestCDUtils.getResource(resourceDetails, getUser()); - // GeneralUIUtils.checkIn(); - // GeneralUIUtils.openObjectMenuAndSelectOption(resourceDetails.getUniqueId(), - // MenuOptionsEnum.VIEW); - // ResourceUIUtils.lifeCycleState(); - // Thread.sleep(1000); - // ViewPageUIUtils.validateActivityLog("Action: Checkin Performed by: Carlos - // Santana(cs0008) Status: 200"); - // } - - // @Test - // public void downloadArtifactViewPaage() throws Exception { - // importAssetAddInformationArtifactAddButton(); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // ViewPageUIUtils.openDropDownListOfObject(resourceDetails.getName(), - // ImportAssetUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver()), - // "View", - // ImportAssetUIUtils.scrollElement(GeneralUIUtils.getDriver())); - // ValidateViewPageParameters.ViewPagedownloadArtifact(); - // String myheatfile="Heat-File.yaml"; - // //Assert.assertTrue((GeneralUIUtils.FILE_PATH, "mailmerge.xls"), "Failed - // to download - // Expected document"); - // String dowloadedfile= - // "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Downloads\\"+fileName+""; - // int index=dowloadedfile.lastIndexOf("\\"); - // System.out.println(dowloadedfile.substring(index+1)); - // File getLatestFile = getLatestFilefromDir(); - // String fileName = getLatestFile.getName(); - // Assert.assertTrue(fileName.equals("mailmerge.xls"), "Downloaded file name - // is not matching with expected file name"); - // - // } - - @Test - public void importAssetcheckInVFCTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKIN.getValue())); - } - - @Test - public void importAssetcheckOutVFCTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - assertTrue(ResourceUIUtils.lifeCycleStateUI().contentEquals(LifeCycleStateEnum.CHECKOUT.getValue())); - } - - @Test - public void importAssetDeleteVFCVersionTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - GeneralUIUtils.checkinCheckout(resourceDetails.getName()); - GeneralUIUtils.deleteVersionInUI(); - Thread.sleep(1000); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - String version = GeneralUIUtils.getWebElementWaitForVisible("versionHeader").getText(); - AssertJUnit.assertEquals("0.1", version.replace("V", "")); - } - - // @Test(enabled = false) - // public void importAssetVFCPrintScreenTest() throws Exception { - // ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, - // GeneralUIUtils.fileName , resourceDetails, getUser()); - // ResourceUIUtils.waitToFinishButtonEnabled().click(); - // ResourceUIUtils.openDropDownListOfObject(resourceDetails.getName(), - // ResourceUIUtils.getAllObjectsOnWorkspace(driver,resourceDetails), "Edit", - // ResourceUIUtils.scrollElement(driver)); - // ResourceUIUtils.waitfunctionforelements("sprite-resource-icons", 7); - // Thread.sleep(2000); - // WebElement element = - // GeneralUIUtils.getDriver().findElement(By.className("network")); - // WebElement target = - // GeneralUIUtils.getDriver().findElement(By.className("dropzone")); - // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element, - // target).perform(); - // WebElement element1 = - // GeneralUIUtils.getDriver().findElement(By.className("network")); - // (new Actions(GeneralUIUtils.getDriver())).dragAndDrop(element1, - // target).perform(); - // ResourceUIUtils.clickPrintScreen(); - // - // // the firefox not support print screen. - // } - - @Test - public void importAssetVFCSubmitForTestingTest() throws Exception { - ImportAssetUIUtils.importAsssetFillGeneralInfoAndSelectIcon(GeneralUIUtils.FILE_PATH, GeneralUIUtils.fileName, - resourceDetails, getUser(), CreateAndImportButtonsEnum.IMPORT_CP); - String name = ""; - GeneralUIUtils.clickSubmitForTest(); - Thread.sleep(2000); - String url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; - navigateToUrl(url); - GeneralUIUtils.getWebElementWaitForVisible("w-sdc-dashboard-card-info"); - int counter = 0; - for (WebElement object : ResourceUIUtils.getAllObjectsOnWorkspace(GeneralUIUtils.getDriver(), - resourceDetails)) { - if (object.getText().equals(resourceDetails.getName())) { - name = object.getText(); - counter++; - } - } - AssertJUnit.assertEquals(1, counter); - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java deleted file mode 100644 index 51454173de..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFCanvasTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Action; -import org.openqa.selenium.interactions.Actions; -import org.testng.annotations.Test; - -public class VFCanvasTest extends SetupCDTest { - - public List<Integer> getposition(WebElement canvas, int width, int height) { - - width = canvas.getSize().getWidth(); - height = canvas.getSize().getHeight(); - Random r = new Random(); - int Resultx = r.nextInt(width); - int Resulty = r.nextInt(height); - List<Integer> position = new ArrayList<Integer>(); - position.add(Resultx); - position.add(Resulty); - return position; - } - - @Test - public void VFCanvasTest1() throws Exception { - // GeneralUIUtils.waitForContainsdataTestIdVisibility("left-sectioin-element-QA"); - - GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); - Thread.sleep(2000); - List<Integer> position = null; - WebElement canvas = GeneralUIUtils.getWebElementWaitForVisible("canvas"); - int xPos = 0; - int yPos = 0; - position = getposition(canvas, xPos, yPos); - WebElement otherElement = GeneralUIUtils - .getWebElementWaitForVisible("left-sectioin-element-QA left-section-NeutronPort"); - for (int i = 0; i < 8; i++) { - Actions builder = new Actions(GeneralUIUtils.getDriver()); - Action dragAndDrop = builder.clickAndHold(otherElement) - .moveToElement(canvas, position.get(0), position.get(1)).release().build(); - dragAndDrop.perform(); - Thread.sleep(2000); - } - Thread.sleep(2000); - Actions builder = new Actions(GeneralUIUtils.getDriver()); - builder.moveToElement(canvas, position.get(0), position.get(1)); - builder.clickAndHold(); - position = getposition(canvas, xPos, yPos); - builder.moveToElement(canvas, position.get(0), position.get(1)); - builder.release(); - builder.build(); - builder.perform(); - builder.moveToElement(canvas, 200, 300); - builder.release(); - builder.perform(); - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java deleted file mode 100644 index eec04bc297..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VFUITest.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; - -public class VFUITest extends SetupCDTest { - - public VFUITest() { - super(); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java deleted file mode 100644 index 5550287aba..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/VfTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; - -public class VfTests extends SetupCDTest { - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java deleted file mode 100644 index 792d687a72..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resourceui/WorkspaceCheckBoxFilterTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.resourceui; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.testng.AssertJUnit; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class WorkspaceCheckBoxFilterTest extends SetupCDTest { - - // This test check the status filter . - - private ResourceReqDetails resourceDetails; - - @BeforeMethod - public void beforTest() { - resourceDetails = ElementFactory.getDefaultResource(); - } - - @Test - public void selectCheckOutMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickASDCLogo(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKOUT); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectCheckInMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.checkIn(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CHECKIN); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectReadyForTestingMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.READY_FOR_TESTING); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectInTestIngMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester")); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - GeneralUIUtils.clickStartTesting(); - GeneralUIUtils.clickASDCLogo(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer")); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.IN_TESTING); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Test - public void selectCertifiedMenuTest() throws Exception { - GeneralUIUtils.clickSaveIcon(); - GeneralUIUtils.clickSubmitForTest(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("designer", "tester")); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - GeneralUIUtils.clickStartTesting(); - GeneralUIUtils.clickAccept(); - GeneralUIUtils.waitForClassNameVisibility("w-sdc-dashboard-card-footer"); - GeneralUIUtils.getDriver().navigate().to(SetupCDTest.getUrl().replace("tester", "designer")); - String Status = GeneralUIUtils - .checkBoxLifeCyclestate(org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum.CERTIFIED); - Thread.sleep(500); - GeneralUIUtils.getWebElementWaitForVisible(resourceDetails.getName()).click(); - - AssertJUnit.assertEquals(Status, GeneralUIUtils.getWebElementWaitForVisible("lifecyclestate").getText()); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java deleted file mode 100644 index c5017a4f34..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.sanity; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; -import java.util.function.Supplier; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; -import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openqa.selenium.ElementNotVisibleException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.Select; -import org.testng.annotations.Test; - -public class Import extends SetupCDTest { - - @Test - public void importResource() throws Exception { - - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - - // import Resource - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser()); - ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser()); - - } - - @Test - public void certifyVFC() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - // GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG); - String cpVersion = GeneralUIUtils.getComponentVersion(atomicResourceMetaData.getName()); - assertTrue("V 1.0".equals(cpVersion)); - } - - @Test - public void uploadAllInformationalArtifactPlaceholdersInVFC() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - - for (InformationalArtifacts infoArtifact : InformationalArtifacts.values()) { - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(infoArtifact, filePath, "Heat-File 1.yaml", - infoArtifact.name()); - } - - assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifacts.values().length, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - InformationalArtifactPage.clickAddNewArtifact(); - Select artifactLabelList = InformationalArtifactPage.artifactPopup().defineArtifactLabel(""); - assertEquals(1, artifactLabelList.getAllSelectedOptions().size()); - - } - - @Test(expectedExceptions = ElementNotVisibleException.class) - public void uploadInformationaArtifactMetdataTest() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - assertTrue(InformationalArtifactPage.checkElementsCountInTable(0, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - ArtifactInfo artifactInfo = new ArtifactInfo(filePath, "Heat-File 1.yaml", "new artifact", "artifact1", - "OTHER"); - InformationalArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo); - - assertTrue(InformationalArtifactPage.checkElementsCountInTable(1, - () -> InformationalArtifactPage.getElemenetsFromTable())); - - String actulaArtifactDescription = InformationalArtifactPage - .getArtifactDescription(artifactInfo.getArtifactLabel()); - assertTrue(artifactInfo.getDescription().equals(actulaArtifactDescription)); - - InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel()); - InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2"); - } - - // @Test() - // public void updateInformationalArtifact(){ - // ArtifactInfo artifactInfo = new ArtifactInfo("", "", "new artifact", - // "artifact1", ""); - // InformationalArtifactPage.clickEditArtifact("artifact1"); - // String newDesc = "newDesc"; - // InformationalArtifactPage.artifactPopup().insertDescription(newDesc); - // InformationalArtifactPage.artifactPopup().clickUpdateButton(); - // String actulaArtifactDescription = - // InformationalArtifactPage.getArtifactDescription(artifactInfo.getArtifactLabel()); - // assertTrue(newDesc.equals(actulaArtifactDescription)); - // InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel()); - // InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2"); - // InformationalArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType()); - // } - - @Test - public void verifyTwoToscaArtifacts() throws Exception { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CPWithAttributes.yml"; - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); - - // List<WebElement> elemenetsFromTable = - // GeneralPageElements.getElemenetsFromTable(); - // Supplier<List<WebElement>> supplier = () -> elemenetsFromTable; - // assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2, - // supplier)); - assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2)); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java deleted file mode 100644 index 713bc4df41..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java +++ /dev/null @@ -1,222 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.sanity; - -import static org.testng.AssertJUnit.assertNotNull; - -import java.awt.AWTException; -import java.io.File; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; -import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; -import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; -import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; -import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.AssertJUnit; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.relevantcodes.extentreports.LogStatus; - -public class Onboard extends SetupCDTest { - - - public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) { - Object[][] arObject = new Object[fileNamesFromFolder.length][]; - - int index = 0; - for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[] { filepath, obj }; - } - return arObject; - } - - @DataProvider(name = "VNF_List") - private static final Object[][] VnfList() throws Exception { - String filepath = getFilePath(); - Object[] fileNamesFromFolder = OnboardingUtils.getZipFileNamesFromFolder(filepath); - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length)); - return provideData(fileNamesFromFolder, filepath); - } - - @Test(dataProvider = "VNF_List") - public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable { - SetupCDTest.setScreenshotFile(vnfFile); - extendTest.setDescription(vnfFile); - - String vspName = onboardVNF(filepath, vnfFile); - - ResourceGeneralPage.clickSubmitForTestingButton(vspName); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - - quitAndReLogin(UserRoleEnum.DESIGNER); - // create service - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vspName); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); - assertNotNull(vfElement); - ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser()); - - ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - TesterOperationPage.certifyComponent(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); - -// quitAndReLogin(UserRoleEnum.OPS); -// GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); -// OpsOperationPage.distributeService(); -// OpsOperationPage.displayMonitor(); -// -// List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); -// AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); -// -// OpsOperationPage.waitUntilArtifactsDistributed(0); -// -// extendTest.log(LogStatus.PASS, String.format("onboarding %s test is passed ! ", vnfFile)); - } - - private String onboardVNF(String filepath, String vnfFile) throws Exception, Throwable { - extendTest.log(LogStatus.INFO, String.format("going to onboard the VNF %s......", vnfFile)); - System.out.println(String.format("going to onboard the VNF %s......", vnfFile)); - - OnboardingUtils.createVendorLicense(getUser()); - String vspName = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); - GeneralUIUtils.getWebButton("repository-icon").click(); - extendTest.log(LogStatus.INFO, String.format("searching for onboarded %s", vnfFile)); - GeneralUIUtils.getWebElementWaitForVisible("onboarding-search").sendKeys(vspName); - AssertJUnit.assertTrue(GeneralPageElements.checkElementsCountInTable(2)); - - List<WebElement> elemenetsFromTable = GeneralPageElements.getElemenetsFromTable(); - GeneralUIUtils.waitForLoader(); - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); - WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); - findElement.click(); - GeneralUIUtils.waitForLoader(); - extendTest.log(LogStatus.INFO, - String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - GeneralUIUtils.getWebElementWaitForVisible("import-csar").click(); - GeneralUIUtils.getWebButton("create/save").click(); - GeneralUIUtils.waitForLoaderOnboarding(); - WebDriverWait wait2 = new WebDriverWait(GeneralUIUtils.getDriver(), 2 * 60); - wait2.until(ExpectedConditions.visibilityOfElementLocated( - By.xpath("//*[@data-tests-id='" + DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue() + "']"))); - extendTest.log(LogStatus.PASS, - String.format("succeeded to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - return vspName; - } - - public static String getFilePath() { - String filepath = System.getProperty("filepath"); - if (filepath == null && System.getProperty("os.name").contains("Windows")) { - filepath = FileHandling.getResourcesFilesPath(); - } - - else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ - filepath = FileHandling.getBasePath() + File.separator + "Files"; - } - return filepath; - } - - @Test - public void twoOnboardedVNFsInService() throws Exception, Throwable{ - - String filepath = getFilePath(); - - final String dnsScaling = "DNSscaling12.8.16.zip"; - final String vLB = "vLB12.8.16.zip"; - - String[] onboardList = {dnsScaling, vLB}; - - Map<String, String> vspMap = new HashMap<String,String>(); - - for (String vnf : onboardList){ - GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification")); - String vspName = onboardVNF(filepath, vnf); - vspMap.put(vnf, vspName); - ResourceGeneralPage.clickSubmitForTestingButton(vspName); - } - - quitAndReLogin(UserRoleEnum.TESTER); - for (String vspName : vspMap.values()){ - GeneralUIUtils.waitForElementsListInvisibility(By.className("ui-notification")); - GeneralUIUtils.findComponentAndClick(vspName); - TesterOperationPage.certifyComponent(vspName); - } - - quitAndReLogin(UserRoleEnum.DESIGNER); - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - - Map<String, CanvasElement> canvasElements = new HashMap<String,CanvasElement>(); - for (String vspName : vspMap.values()){ - CompositionPage.searchForElement(vspName); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName); - assertNotNull(vfElement); - canvasElements.put(vspName, vfElement); - } - ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 2, getUser()); - - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java deleted file mode 100644 index 96a22ef2fe..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java +++ /dev/null @@ -1,377 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.sanity; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; -import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.ci.tests.datatypes.PropertyInfo; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.CompositionPage; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; -import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; -import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; -import org.openecomp.sdc.ci.tests.pages.PropertiesPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; -import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; -import org.openecomp.sdc.ci.tests.verificator.VfVerificator; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.Select; -import org.testng.AssertJUnit; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class Vf extends SetupCDTest { - - private String filePath; - - @BeforeMethod - public void beforeTest() { - filePath = System.getProperty("filepath"); - if (filePath == null) { - filePath = FileHandling.getResourcesFilesPath(); - } - } - - @Test - public void createVF() throws Exception { - - // create Resource - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(resourceMetaData, getUser()); - - } - - @Test - public void updateVF() throws Exception { - - // create Resource - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(resourceMetaData, getUser()); - - // update Resource - String expectedDesc = "kuku"; - resourceMetaData.setDescription(expectedDesc); - ResourceGeneralPage.defineDescription(expectedDesc); - GeneralUIUtils.clickUpdateButton(); - - VfVerificator.verifyVFUpdatedInUI(resourceMetaData); - } - - @Test - public void vfcLinkedToComputeInVfWithArtifactsFlow() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; - - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath, - "asc_heat 0 2.yaml", "features"); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - - // create Resource - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(vfMetaData, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - ArtifactInfo artifact1 = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"); - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact1); - ArtifactInfo artifact2 = new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2", - "YANG_XML"); - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact2); - - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - - CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - AssertJUnit.assertNotNull(cpElement); - ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser()); - canvasManager.linkElements(cpElement, computeElement); - - vfMetaData.setVersion("0.1"); - VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1); - - } - - @Test - public void addingDeploymentArtifactToVFInstanceInService() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - // create Resource - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(vfMetaData, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); - deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); - deploymentArtifactList - .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML")); - for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); - } - - ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); - GeneralUIUtils.clickASDCLogo(); - - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vfMetaData.getName()); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName()); - - serviceCanvasManager.clickOnCanvaElement(vfElement); - GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click(); - GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click(); - GeneralUIUtils.waitForLoader(); - ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", - "DCAE_INVENTORY_TOSCA"); - deploymentArtifactList.add(artifact3); - GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel()); - DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType()); - DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription()); - DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename()); - GeneralUIUtils.getWebElementWaitForVisible("Done").click(); - GeneralUIUtils.waitForLoader(); - - List<WebElement> actualArtifactList = GeneralUIUtils - .waitForElementsListVisibility(By.className("i-sdc-designer-sidebar-section-content-item-artifact")); - AssertJUnit.assertEquals(deploymentArtifactList.size(), actualArtifactList.size()); - - } - - @Test - public void distibuteVFCInVFInServiceTest() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; - - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.FEATURES, filePath, - "asc_heat 0 2.yaml", "features"); - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - - // create Resource - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(vfMetaData, getUser()); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>(); - deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER")); - deploymentArtifactList - .add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "kuku", "artifact2", "YANG_XML")); - for (ArtifactInfo deploymentArtifact : deploymentArtifactList) { - DeploymentArtifactPage.clickAddNewArtifact(); - ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact); - } - - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement cpElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - - vfCanvasManager.linkElements(cpElement, computeElement); - - ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); - TesterOperationPage.certifyComponent(vfMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - - // create service - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); - ServiceUIUtils.createService(serviceMetadata, getUser()); - - ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); - CompositionPage.searchForElement(vfMetaData.getName()); - CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager(); - CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vfMetaData.getName()); - - ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - TesterOperationPage.certifyComponent(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.GOVERNOR); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - GovernorOperationPage.approveSerivce(serviceMetadata.getName()); - - quitAndReLogin(UserRoleEnum.OPS); - GeneralUIUtils.findComponentAndClick(serviceMetadata.getName()); - OpsOperationPage.distributeService(); - OpsOperationPage.displayMonitor(); - - List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable(); - AssertJUnit.assertEquals(1, rowsFromMonitorTable.size()); - - String deploymentArtifactsSize = String.valueOf(deploymentArtifactList.size() + 1); - - OpsOperationPage.waitUntilArtifactsDistributed(deploymentArtifactsSize, 0); - - } - - @Test - public void changesInVFCInstanceInVF() throws Exception { - // String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vFW_VFC.yml"; - - // import Resource - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory( - ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); - ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); - ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); - ArtifactUIUtils.fillPlaceHolderInformationalArtifact(InformationalArtifacts.CAPACITY, filePath, - "asc_heat 0 2.yaml", "capacity"); - - InformationalArtifactPage.getLeftMenu().moveToPropertiesScreen(); - int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); - - PropertyInfo prop1 = new PropertyInfo("p1", "v1", "prop1", PropertyTypeEnum.STRING); - - PropertiesPage.clickAddPropertyArtifact(); - PropertiesUIUtils.addNewProperty(prop1); - AssertJUnit.assertTrue(PropertiesPage.checkElementsCountInTable(propertiesCount + 1, - () -> PropertiesPage.getElemenetsFromTable())); - - ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName()); - - ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); - ResourceUIUtils.createResource(vfMetaData, getUser()); - - DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); - CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); - CompositionPage.searchForElement(atomicResourceMetaData.getName()); - CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName()); - - vfCanvasManager.clickOnCanvaElement(vfcElement); - CompositionPage.showPropertiesAndAttributesTab(); - List<WebElement> properties = CompositionPage.getProperties(); - for (int i = 0; i < 2; i++) { - // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver() - // , 30); - // WebElement findElement = - // wait.until(ExpectedConditions.visibilityOf(properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")))); - WebElement findElement = properties.get(i).findElement( - By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label")); - findElement.click(); - PropertiesPage.getPropertyPopup().insertPropertyDefaultValue("abc123"); - PropertiesPage.getPropertyPopup().clickSave(); - GeneralUIUtils.waitForInvisibileElement(DataTestIdEnum.PropertiesPageEnum.SAVE.getValue()); - } - vfCanvasManager.moveToFreeLocation(vfMetaData.getName()); - GeneralUIUtils.waitFordataTestIdVisibility("deployment-artifact-tab").click(); - GeneralUIUtils.waitFordataTestIdVisibility("add_Artifact_Button").click(); - GeneralUIUtils.waitForLoader(); - ArtifactInfo artifact3 = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3", "OTHER"); - GeneralUIUtils.getWebElementWaitForVisible("artifact-label").sendKeys(artifact3.getArtifactLabel()); - DeploymentArtifactPage.artifactPopup().selectArtifactType(artifact3.getArtifactType()); - DeploymentArtifactPage.artifactPopup().insertDescription(artifact3.getDescription()); - DeploymentArtifactPage.artifactPopup().loadFile(artifact3.getFilepath(), artifact3.getFilename()); - GeneralUIUtils.getWebElementWaitForVisible("Done").click(); - GeneralUIUtils.waitForLoader(); - - quitAndReLogin(UserRoleEnum.TESTER); - GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); - TesterOperationPage.certifyComponent(atomicResourceMetaData.getName()); - - quitAndReLogin(UserRoleEnum.DESIGNER); - GeneralUIUtils.findComponentAndClick(vfMetaData.getName()); - ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - vfCanvasManager = CanvasManager.getCanvasManager(); - vfCanvasManager.clickOnCanvaElement(vfcElement); - // change version - GeneralUIUtils.getWebElementByName("changeVersion"); - Select selectlist = new Select(GeneralUIUtils.getWebElementByName("changeVersion")); - selectlist.selectByVisibleText("1.0"); - GeneralUIUtils.waitForLoader(); - - // GeneralUIUtils.waitUntilClickableButton(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue()).click(); - // ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName()); - // - // vfMetaData.setVersion("0.1"); - // VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), - // LifecycleStateEnum.READY_FOR_CERTIFICATION); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java deleted file mode 100644 index 03c9b0281f..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.setup; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; - -public class OnboardCSVReport { - - private StringBuilder sb; - private PrintWriter pw; - - public OnboardCSVReport(String filepath, String filename) { - sb = new StringBuilder(); - try { - File csvFile = new File(filepath + filename); - pw = new PrintWriter(csvFile); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - } - - public StringBuilder appendStringToFile(String content) { - return sb.append(content + ","); - } - - public void openNewRow() { - sb.append("\n"); - } - - public void writeRow(String... content) { - for (String str : content) { - appendStringToFile(str); - } - openNewRow(); - } - - public void closeFile() { - pw.write(sb.toString()); - pw.close(); - } - -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java deleted file mode 100644 index e5fcafb664..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/RemoteWebDriverTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.setup; - -import java.net.URL; - -import org.junit.Ignore; -import org.junit.Test; -import org.openqa.selenium.Platform; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.remote.RemoteWebDriver; - -public class RemoteWebDriverTest { - - // @Test - public void remoteTest() throws Exception { - DesiredCapabilities cap = new DesiredCapabilities().firefox(); - cap.setPlatform(Platform.WINDOWS); - cap.setBrowserName("firefox"); - - RemoteWebDriver remoteDriver = new RemoteWebDriver(new URL("http://1.2.3.4:5555/wd/hub"), cap); - remoteDriver.navigate().to("http://www.google.co.il"); - remoteDriver.findElementByName("q").sendKeys("execute automation"); - remoteDriver.findElementByName("btnK").click(); - } -} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java deleted file mode 100644 index a72168e4c2..0000000000 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java +++ /dev/null @@ -1,538 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.ci.tests.execute.setup; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; - -import org.apache.commons.io.FileUtils; -import org.apache.log4j.Logger; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.run.StartTest; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.AssertJUnit; -import org.testng.ITestResult; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; - -import com.relevantcodes.extentreports.ExtentReports; -import com.relevantcodes.extentreports.ExtentTest; -import com.relevantcodes.extentreports.LogStatus; - -public abstract class SetupCDTest { - - public SetupCDTest() { - // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - // lc.getLogger("org.apache").setLevel(Level.INFO); - //// System.setProperty("org.apache.commons.logging.Log", - // "org.apache.commons.logging.impl.SimpleLog"); - //// System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", - // "OFF"); - //// System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", - // "OFF"); - - } - - public static Logger logger = Logger.getLogger(SetupCDTest.class.getName()); - - /**************** CONSTANTS ****************/ - private static final String CREDENTIALS_FILE = "credentials.yaml"; - private static final String REPORT_FILE_NAME = "ASDC_UI_Extent_Report.html"; - public static final String REPORT_FOLDER = "./ExtentReport/"; - public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub"; - private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots/"; - private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv"; - private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2; - - /**************** USERS ****************/ - protected static User designerUser; - protected static User adminUser; - protected static User testerUser; - protected static User governorUser; - protected static User opsUser; - protected static User productManagerUser; - - public static Config config; - - /**************** PRIVATES ****************/ - private Map<?, ?> credentialsYamlFileMap; - private static String url; - private User user; - private static boolean localEnv = true; - private int refreshAttempts = 0; - - protected abstract UserRoleEnum getRole(); - - protected ExtentReports extentReport; - protected static ExtentTest extendTest; - private static String screenshotFile; - - public static String getScreenshotFile() { - return screenshotFile; - } - - public static void setScreenshotFile(String screenshotFile) { - SetupCDTest.screenshotFile = screenshotFile; - } - - public static ExtentTest getExtendTest() { - return extendTest; - } - - private OnboardCSVReport csvReport; - - public OnboardCSVReport getCsvReport() { - return csvReport; - } - - /**************** BEFORE ****************/ - - @BeforeSuite(alwaysRun = true) - public void setEnvParameters() throws Exception { - - File dir = new File(REPORT_FOLDER); - try { - FileUtils.deleteDirectory(dir); - } catch (IOException e) { - } - extentReport = new ExtentReports(REPORT_FOLDER + REPORT_FILE_NAME); - csvReport = new OnboardCSVReport(REPORT_FOLDER, SHORT_CSV_REPORT_FILE_NAME); - - System.out.println("Setup...."); - config = Utils.getConfig(); - setUrl(); - } - - @BeforeMethod(alwaysRun = true) - public void setBrowserBeforeTest(java.lang.reflect.Method method) throws Exception { - extendTest = extentReport.startTest(method.getName()); - extendTest.log(LogStatus.INFO, "Test started"); - setBrowserBeforeTest(getRole()); - } - - /**************** AFTER ****************/ - @AfterMethod(alwaysRun = true) - public void quitAfterTest(ITestResult result) throws Exception { - - StringBuilder sb = new StringBuilder(); - if (result.getParameters().length != 0) { - for (int i = 0; i < result.getParameters().length - 1; i++) { - sb.append(result.getParameters()[i].toString() + ","); - } - sb.append(result.getParameters()[result.getParameters().length - 1].toString()); - } - - File imageFilePath = GeneralUIUtils.takeScreenshot(screenshotFile, SCREENSHOT_FOLDER, result.getName()); - final String absolutePath = new File(REPORT_FOLDER).toURI().relativize(imageFilePath.toURI()).getPath(); - if (result.getStatus() == ITestResult.SUCCESS) { - extendTest.log(LogStatus.PASS, "Test Result : <span class='label success'>Success</span>"); - extendTest.log(LogStatus.PASS, - "Finished the test with the following screenshot : " + extendTest.addScreenCapture(absolutePath)); - csvReport.writeRow(result.getName(), sb.toString(), "PASS"); - } else if (result.getStatus() == ITestResult.FAILURE || result.getStatus() == ITestResult.SKIP) { - extendTest.log(LogStatus.ERROR, "ERROR - The following exepction occured"); - extendTest.log(LogStatus.ERROR, result.getThrowable()); - extendTest.log(LogStatus.ERROR, - "Failure is described in the following screenshot : " + extendTest.addScreenCapture(absolutePath)); - extendTest.log(LogStatus.FAIL, "<span class='label failure'>Failure</span>"); - csvReport.writeRow(result.getName(), sb.toString(), "FAIL"); - } - - extentReport.endTest(extendTest); - extentReport.flush(); - - quitBrowser(); -// deleteCreatedComponents2(getCatalogAsMap()); - } - - @AfterClass(alwaysRun = true) - public void afterSuite() { - csvReport.closeFile(); - } - - /*************************************/ - - private Map<String, ArrayList<Component>> getCatalogAsMap() throws IOException { - RestResponse catalog = CatalogRestUtils.getCatalog(getUser().getUserId()); - Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject = ResponseParser - .convertCatalogResponseToJavaObject(catalog.getResponse()); - return convertCatalogResponseToJavaObject; - } - - private void deleteCreatedComponents2(Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject) - throws IOException { - final String userId = getUser().getUserId(); - ArrayList<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get("resources"); - - List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) - .map(e -> e.getUniqueId()).collect(Collectors.toList()); - for (String uId : collect) { - ResourceRestUtils.deleteResource(uId, userId); - } - - resourcesArrayList = convertCatalogResponseToJavaObject.get("services"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); - for (String uId : collect) { - ServiceRestUtils.deleteServiceById(uId, userId); - } - - resourcesArrayList = convertCatalogResponseToJavaObject.get("products"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); - for (String uId : collect) { - ProductRestUtils.deleteProduct(uId, userId); - } - - } - - /**************** MAIN ****************/ - public static void main(String[] args) { - System.out.println("---------------------"); - System.out.println("running test from CLI"); - System.out.println("---------------------"); - - String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "sdc.yaml"; - System.setProperty("config.resource", attsdcFilePath); - System.out.println("sdc.yaml file path is : " + attsdcFilePath); - - Object[] testSuitsList = FileHandling - .getFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml"); - if (testSuitsList != null) { - System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length)); - args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class); - StartTest.main(args); - } - } - - /***********************************************************************************/ - - protected static String setUrl() { - url = config.getUrl(); - if (url == null) { - String message = "no URL found"; - System.out.println(message); - Assert.fail(message); - } else if (!url.contains("localhost") && !url.contains("127.0.0.1")) { - localEnv = false; - } - return url; - } - - private Map<String, String> loadCredentialsFile() throws Exception { - File credentialsFile = new File( - FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); - if (!credentialsFile.exists()) { - credentialsFile = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE); - } - credentialsYamlFileMap = (Map<String, String>) FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); - return (Map<String, String>) credentialsYamlFileMap; - } - - protected UserCredentials getUserCredentialsFromFile(String userRole) throws Exception { - Map<String, String> credentialsMap = (Map<String, String>) credentialsYamlFileMap.get(userRole); - String user = (String) credentialsMap.get("username"); - String password = (String) credentialsMap.get("password"); - String firstname = (String) credentialsMap.get("firstname"); - String lastname = (String) credentialsMap.get("lastname"); - - return new UserCredentials(user, password, firstname, lastname); - } - - public UserCredentials updateUserUserId(String role) throws Exception { - System.out.println("updating..."); - UserCredentials designerCredentialsFromFile = null; - UserCredentials testerCredentialsFromFile = null; - UserCredentials adminCredentialsFromFile = null; - UserCredentials opsCredentialsFromFile = null; - UserCredentials governorCredentialsFromFile = null; - UserCredentials productCredentialsFromFile = null; - UserCredentials productManagerCredentialsFromFile = null; - - String lowerCaseRole = role.toLowerCase(); - try { - if (lowerCaseRole.equals("designer")) { - designerCredentialsFromFile = getUserCredentialsFromFile("designer"); - designerUser.setUserId(designerCredentialsFromFile.getUserId()); - designerUser.setFirstName(designerCredentialsFromFile.getFirstName()); - designerUser.setLastName(designerCredentialsFromFile.getLastName()); - return designerCredentialsFromFile; - } else if (lowerCaseRole.equals("tester")) { - testerCredentialsFromFile = getUserCredentialsFromFile("tester"); - testerUser.setUserId(testerCredentialsFromFile.getUserId()); - testerUser.setFirstName(testerCredentialsFromFile.getFirstName()); - testerUser.setLastName(testerCredentialsFromFile.getLastName()); - return testerCredentialsFromFile; - } else if (lowerCaseRole.equals("admin")) { - adminCredentialsFromFile = getUserCredentialsFromFile("admin"); - adminUser.setUserId(adminCredentialsFromFile.getUserId()); - adminUser.setFirstName(adminCredentialsFromFile.getFirstName()); - adminUser.setLastName(adminCredentialsFromFile.getLastName()); - return adminCredentialsFromFile; - } else if (lowerCaseRole.equals("ops")) { - opsCredentialsFromFile = getUserCredentialsFromFile("ops"); - opsUser.setUserId(opsCredentialsFromFile.getUserId()); - opsUser.setFirstName(opsCredentialsFromFile.getFirstName()); - opsUser.setLastName(opsCredentialsFromFile.getLastName()); - return opsCredentialsFromFile; - } else if (lowerCaseRole == "governor") { - governorCredentialsFromFile = getUserCredentialsFromFile("governor"); - governorUser.setUserId(governorCredentialsFromFile.getUserId()); - governorUser.setFirstName(governorCredentialsFromFile.getFirstName()); - governorUser.setLastName(governorCredentialsFromFile.getLastName()); - return governorCredentialsFromFile; - } else if (lowerCaseRole == "product_local") { - productCredentialsFromFile = getUserCredentialsFromFile("product_local"); - productManagerUser.setUserId(productCredentialsFromFile.getUserId()); - productManagerUser.setFirstName(productCredentialsFromFile.getFirstName()); - productManagerUser.setLastName(productCredentialsFromFile.getLastName()); - return productCredentialsFromFile; - } else if (lowerCaseRole == "product_manager") { - productManagerCredentialsFromFile = getUserCredentialsFromFile("product_manager"); - productManagerUser.setUserId(productManagerCredentialsFromFile.getUserId()); - productManagerUser.setFirstName(productManagerCredentialsFromFile.getFirstName()); - productManagerUser.setLastName(productManagerCredentialsFromFile.getLastName()); - return productManagerCredentialsFromFile; - } - } - - catch (Exception e) { - System.out.print("An exception occured..."); - System.out.println("->exception message is : " + e.getMessage()); - } - - return null; - } - - public static void navigateToUrl(String url) throws Exception { - - try { - WebDriver driver = GeneralUIUtils.getDriver(); - System.out.println("navigating to URL :" + url); - driver.manage().window().maximize(); - driver.manage().deleteAllCookies(); - driver.navigate().to(url); - GeneralUIUtils.windowZoomOut(); - GeneralUIUtils.waitForLoader(); - } catch (Exception e) { - System.out.println("browser is unreachable"); - extendTest.log(LogStatus.ERROR, "browser is unreachable"); - Assert.fail("browser is unreachable"); - } - } - - protected void loginToSystem(UserCredentials credentials, UserRoleEnum role) throws Exception { - - sendUserAndPasswordKeys(credentials); - refreshAttempts = (refreshAttempts == 0) ? NUM_OF_ATTEMPTS_TO_REFTRESH : refreshAttempts; - if (!getRole().equals(UserRoleEnum.ADMIN)) { - try { - if(!localEnv){ -// GeneralUIUtils.ultimateWait(); - WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 3 * 60); - WebElement sdcApp = wait.until(ExpectedConditions.elementToBeClickable(By.id("app-image-SDC"))); - sdcApp.click(); - GeneralUIUtils.getDriver().switchTo().frame(1); - GeneralUIUtils.waitFordataTestIdVisibility("main-menu-input-search"); - } - else{ - enterToUserWorkspace(); - } - - } catch (Exception e) { - refreshAttempts--; - if (refreshAttempts <= 0) { - System.out.println("ERR : Something is wrong with browser!"); - Assert.fail("ERR : Something is wrong with browser!"); - } - System.out.println("trying again..."); - System.out.println(String.format("%s attempt(s) left", refreshAttempts)); - extendTest.log(LogStatus.INFO, "trying again..."); - extendTest.log(LogStatus.INFO, String.format("%s attempt(s) left", refreshAttempts)); - - quitAndReLogin(role); - } - } - } - - private void sendUserAndPasswordKeys(UserCredentials userId) { - - if (localEnv){ - System.out.println("Login with user : " + userId.getUserId()); - WebElement userNameTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userid")); - userNameTextbox.sendKeys(userId.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password")); - passwordTextbox.sendKeys(userId.getPassword()); - - WebElement submitButton = GeneralUIUtils.waitForElementVisibility(By.name("btnSubmit")); - submitButton.click(); - WebElement buttonOK = GeneralUIUtils.waitForElementVisibility(By.name("successOK")); - AssertJUnit.assertTrue(buttonOK.isDisplayed()); - buttonOK.click(); - } - else - { - System.out.println("Login with user : " + userId.getUserId()); - WebElement userNameTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='text']")); - userNameTextbox.sendKeys(userId.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.getDriver().findElement(By.cssSelector("input[type='password']")); - passwordTextbox.sendKeys(userId.getPassword()); - - GeneralUIUtils.getDriver().findElement(By.id("loginBtn")).click(); - } - - - } - - public static String getUrl() { - return url; - } - - public static void setUrl(String url) { - SetupCDTest.url = url; - } - - public static Config getConfig() { - return config; - } - - public void loginToSystem(UserRoleEnum role){ - WebDriver driver = GeneralUIUtils.getDriver(); - WebDriverWait wait = new WebDriverWait(driver, 30); - - wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']")))); - - WebElement userIdTextbox = GeneralUIUtils.waitForElementVisibility(By.name("userId")); - userIdTextbox.sendKeys(role.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.waitForElementVisibility(By.name("password")); - passwordTextbox.sendKeys("123123a"); - - wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Submit" + "']")))).click(); - - GeneralUIUtils.waitForLoader(); - } - - public void loginWithUser(UserRoleEnum role) { - setUser(role); - try { - navigateToUrl(url); - extendTest.log(LogStatus.INFO, String.format("login with user %s", role.name().toUpperCase())); - if (localEnv) { - loginToSystem(role); - enterToUserWorkspace(); - } - else{ - loadCredentialsFile(); - UserCredentials credentials = getUserCredentialsFromFile(role.name().toLowerCase()); - loginToSystem(credentials, role); - user = credentials; - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private void enterToUserWorkspace() { - WebElement enterToUserWorkspaceButton = GeneralUIUtils.waitForElementVisibility(By.className("asdc-welcome-main-back-btn"), 3 * 60); - enterToUserWorkspaceButton.click(); - System.out.println("Entering to system..."); - GeneralUIUtils.waitForLoader(); - } - - private void setUser(UserRoleEnum role) { - user = new User(); - user.setUserId(role.getUserId()); - user.setFirstName(role.getFirstName()); - user.setRole(role.name()); - user.setLastName(role.getLastName()); - } - - public User getUser() { - return user; - } - - protected void setBrowserBeforeTest(UserRoleEnum role) { - refreshAttempts = 0; - System.out.println(String.format("Setup before test as %s", role.toString().toUpperCase())); - GeneralUIUtils.initDriver(); - loginWithUser(role); - } - - public User getUser(UserRoleEnum role) { - User user = new User(); - user = new User(); - user.setUserId(role.getUserId()); - user.setFirstName(role.getFirstName()); - user.setRole(role.name()); - return user; - } - - protected void quitAndReLogin(UserRoleEnum role) throws Exception { - quitBrowser(); - if (localEnv) { - loginToSystem(role); - } - setBrowserBeforeTest(role); - } - - private void quitBrowser() { - System.out.println("Closing browser..."); - GeneralUIUtils.getDriver().quit(); - } - - - protected String getRandomComponentName(String prefix) { - return prefix + randomNumber(); - } - - protected int randomNumber() { - Random r = new Random(); - return r.nextInt(10000); - } - -} |