diff options
Diffstat (limited to 'ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute')
9 files changed, 0 insertions, 1802 deletions
diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java deleted file mode 100644 index f9e294cbc7..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java +++ /dev/null @@ -1,419 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.base; - -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.commons.lang.NotImplementedException; -import org.apache.log4j.Logger; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.rules.TestName; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.run.StartTest; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; -import org.openecomp.sdc.uici.tests.datatypes.CleanTypeEnum; -import org.openecomp.sdc.uici.tests.datatypes.UserCredentials; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.testng.AssertJUnit; -import org.testng.ITestResult; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; - -import com.google.common.collect.Lists; -import com.thinkaurelius.titan.core.TitanGraph; - -public abstract class SetupCDTest extends ComponentBaseTest { - - private TitanSnapshot snapshot; - private static CleanTypeEnum cleanType; - - public SetupCDTest() { - super(new TestName(), SetupCDTest.class.getName()); - } - - public SetupCDTest(TestName name, String className) { - super(name, className); - } - - public static Logger logger = Logger.getLogger(SetupCDTest.class.getName()); - - /**************** CONSTANTS ****************/ - private static final String CREDENTIALS_FILE = "src/main/resources/ci/conf/credentials.yaml"; - public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub"; - - /**************** PRIVATES ****************/ - public static Config config; - private Map<?, ?> credentialsYamlFileMap; - - private static String devUrl, cdUrl; - - @BeforeSuite(alwaysRun = true) - public static void openTitan() throws FileNotFoundException { - try { - openTitanLogic(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @AfterSuite(alwaysRun = true) - public static void shutdownTitan() { - shutdownTitanLogic(); - } - - @BeforeSuite(alwaysRun = true) - @Parameters({ "clean-type" }) - public void setEnvParameters(@Optional("PARTIAL") String cleanType) throws FileNotFoundException { - this.cleanType = CleanTypeEnum.findByName(cleanType); - System.out.println("setup before class"); - config = Utils.getConfig(); - loadCredentialsFile(); - setUrl(); - } - - @BeforeMethod(alwaysRun = true) - public void setBrowserBeforeTest() { - setBrowserBeforeTest(getRole()); - } - - /**************** AFTER ****************/ - @AfterMethod(alwaysRun = true) - public void quitAfterTest() { - System.out.println("closing browser"); - GeneralUIUtils.getDriver().quit(); - } - - @BeforeMethod(alwaysRun = true) - public void beforeState(java.lang.reflect.Method method) throws Exception { - CleanTypeEnum cleanType = getCleanMode(); - switch (cleanType) { - case FULL: { - super.performeClean(); - break; - } - case PARTIAL: { - takeTitanSnapshot(); - break; - } - case NONE: { - // No Clean Up - break; - } - default: { - throw new NotImplementedException("Enum Value:" + cleanType.name() + " Is not handled"); - } - } - - } - - @AfterMethod(alwaysRun = true) - public void afterState(ITestResult result) throws Exception { - CleanTypeEnum cleanType = getCleanMode(); - switch (cleanType) { - case FULL: { - super.performeClean(); - break; - } - case PARTIAL: { - resetToOriginalSnapshot(); - break; - } - case NONE: { - // No Clean Up - break; - } - default: { - throw new NotImplementedException("Enum Value:" + cleanType.name() + " Is not handled"); - } - } - - } - - private void takeTitanSnapshot() { - List<Edge> edgeList = Lists.newArrayList(getTitanGraph().edges(null)); - List<Vertex> verList = Lists.newArrayList(getTitanGraph().vertices(null)); - setSnapshot(new TitanSnapshot(edgeList, verList)); - - } - - private static class TitanSnapshot { - List<Edge> edges; - List<Vertex> vertices; - - public List<Edge> getEdges() { - return edges; - } - - public List<Vertex> getVertices() { - return vertices; - } - - private TitanSnapshot(List<Edge> edges, List<Vertex> vertices) { - super(); - this.edges = edges; - this.vertices = vertices; - } - } - - private void resetToOriginalSnapshot() { - - List<Edge> joinedEdges = new ArrayList<>(); - List<Vertex> joinedVertices = new ArrayList<>(); - TitanSnapshot original = getSnapshot(); - takeTitanSnapshot(); - TitanSnapshot current = getSnapshot(); - - original.getEdges().stream().forEach(e -> addIfIdInList(e, current.getEdges(), joinedEdges, e2 -> e2.id())); - original.getVertices().stream() - .forEach(e -> addIfIdInList(e, current.getVertices(), joinedVertices, e2 -> e2.id())); - - List<Edge> edgesToRemove = removeFromList(current.getEdges(), joinedEdges, e2 -> e2.id()); - List<Vertex> verticesToRemove = removeFromList(current.getVertices(), joinedVertices, e2 -> e2.id()); - - List<Edge> edgesToAdd = removeFromList(original.getEdges(), joinedEdges, e2 -> e2.id()); - List<Vertex> verticesToAdd = removeFromList(original.getVertices(), joinedVertices, e2 -> e2.id()); - - if (edgesToAdd.isEmpty() && verticesToAdd.isEmpty()) { - edgesToRemove.stream().forEach(e -> e.remove()); - verticesToRemove.stream().forEach(v -> v.remove()); - } - - } - - private <Element, ID> List<Element> removeFromList(List<Element> listToRemoveFrom, List<Element> elementsToRemove, - Function<Element, ID> idGetter) { - Set<ID> idSet = new HashSet<>(); - // Fill The Set - elementsToRemove.stream().map(e -> idGetter.apply(e)).forEach(e2 -> idSet.add(e2)); - return listToRemoveFrom.stream().filter(p -> !idSet.contains(idGetter.apply(p))).collect(Collectors.toList()); - - } - - private <Element, ID> void addIfIdInList(Element e, List<Element> listToCheck, List<Element> listToAddTo, - Function<Element, ID> idGetter) { - Stream<Element> matchingElements = listToCheck.stream() - .filter(p -> idGetter.apply(e).equals(idGetter.apply(p))); - listToAddTo.addAll(matchingElements.collect(Collectors.toList())); - } - - /**************** MAIN ****************/ - public static void main(String[] args) { - System.out.println("---------------------"); - System.out.println("running test from CLI"); - System.out.println("---------------------"); - args = new String[] { "ui-ci.xml" }; - StartTest.main(args); - } - - /***********************************************************************************/ - - protected void setBrowserBeforeTest(UserRoleEnum role) { - System.out.println("setup before test"); - GeneralUIUtils.initDriver(); - setDevUrl(role); - loginWithUser(role); - } - - protected void setUrl() { - cdUrl = config.getUrl(); - setDevUrl(getRole()); - } - - private Map<String, String> loadCredentialsFile() { - final String credintialsFile = (System.getProperty("credentials.file") != null) - ? System.getProperty("credentials.file") : CREDENTIALS_FILE; - System.out.println("credentials file is : " + credintialsFile); - FunctionalInterfaces.swallowException( - () -> credentialsYamlFileMap = (Map<String, String>) FileHandling.parseYamlFile(credintialsFile)); - System.out.println(credentialsYamlFileMap.toString()); - 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 void navigateToUrl(String url) throws InterruptedException { - WebDriver driver = GeneralUIUtils.getDriver(); - System.out.println("navigating to URL :" + url); - driver.navigate().to(url); - driver.manage().window().maximize(); - driver.manage().deleteAllCookies(); - } - - protected void loginToSystem(UserCredentials credentials) throws Exception { - - sendUserAndPasswordKeys(credentials); - WebElement submitButton = GeneralUIUtils.getDriver().findElement(By.name("btnSubmit")); - submitButton.click(); - WebElement buttonOK = GeneralUIUtils.getDriver().findElement(By.name("successOK")); - AssertJUnit.assertTrue(buttonOK.isDisplayed()); - buttonOK.click(); - System.out.println("Entering to design studio"); - Thread.sleep(2000); - WebElement enterToUserWorkspaceButton = GeneralUIUtils.getDriver() - .findElement(By.xpath("//button[@data-tests-id='Design Studio']")); - enterToUserWorkspaceButton.click(); - } - - private void sendUserAndPasswordKeys(UserCredentials userId) { - System.out.println("Login to system with user : " + userId.getUserId()); - WebElement userNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("userid")); - userNameTextbox.sendKeys(userId.getUserId()); - WebElement passwordTextbox = GeneralUIUtils.getDriver().findElement(By.name("password")); - passwordTextbox.sendKeys(userId.getPassword()); - } - - public String getUrl() { - String url; - final CleanTypeEnum workMode = getCleanMode(); - switch (workMode) { - case FULL: { - url = devUrl; - break; - } - case PARTIAL: { - url = devUrl; - break; - } - case NONE: { - url = cdUrl; - break; - } - default: { - throw new NotImplementedException(workMode.name()); - } - - } - return url; - } - - public static void setDevUrl(UserRoleEnum role) { - String url = SetupCDTest.devUrl; - switch (role) { - case ADMIN: { - url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard"; - break; - } - case DESIGNER: { - url = "http://localhost:8181/sdc1/proxy-designer1#/dashboard"; - // url = "http://localhost:9000/#/dashboard"; - break; - } - case GOVERNOR: { - url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard"; - break; - } - case OPS: { - url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard"; - break; - } - case TESTER: { - url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; - break; - } - default: { - break; - } - } - SetupCDTest.devUrl = url; - } - - public static Config getConfig() { - return config; - } - - private User user; - - public void loginWithUser(UserRoleEnum role) { - - setUser(role); - String url = getUrl(); - System.out.println("URL is : " + url); - try { - navigateToUrl(url); - if (url.contains("https://www.e-access.att.com")) { - System.out.println("going to update designer user to mechIDs form..."); - UserCredentials credentials = getUserCredentialsFromFile(role.name().toLowerCase()); - loginToSystem(credentials); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private void setUser(UserRoleEnum role) { - user = new User(); - user.setUserId(role.getUserId()); - user.setFirstName(role.getFirstName()); - user.setRole(role.name()); - } - - /** - * Current User Role - * - * @return - */ - public UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } - - /** - * To change clean type update configuration.<br> - * Do not override this method. - * - * @return - */ - protected final CleanTypeEnum getCleanMode() { - return cleanType; - } - - public User getUser() { - return user; - } - - protected void quitAndReLogin(UserRoleEnum role) { - quitAfterTest(); - setBrowserBeforeTest(role); - GeneralUIUtils.waitForLoader(30); - } - - public TitanSnapshot getSnapshot() { - return snapshot; - } - - public void setSnapshot(TitanSnapshot snapshot) { - this.snapshot = snapshot; - } - - public static TitanGraph getTitanGraph() { - return titanGraph; - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/generalTests/GeneralTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/generalTests/GeneralTests.java deleted file mode 100644 index c3caa98c54..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/generalTests/GeneralTests.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.generalTests; - -import static org.testng.AssertJUnit.assertTrue; - -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Resource; -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.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.testng.annotations.Test; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; - -public class GeneralTests extends SetupCDTest{ - - @Test - public void filterVFCMT() throws Exception { - Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFCMT, NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_CALL_CONTROL , UserRoleEnum.DESIGNER, true).left().value(); - assertTrue(!GeneralUIUtils.isElementPresent(resource.getName())); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.MainMenue.CATALOG.getValue()).click(); - assertTrue(!GeneralUIUtils.isElementPresent(resource.getName())); - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java deleted file mode 100644 index e42de862b7..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.service; - -import static org.testng.AssertJUnit.assertTrue; - -import java.util.Arrays; - -import org.apache.http.HttpStatus; -import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; -import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; -import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator; -import org.openecomp.sdc.uici.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.testng.annotations.Test; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; - -public class ServiceBasicTests extends SetupCDTest { - - @Test - public void testCreateService() { - ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - } - - @Test - public void testLinkTwoRI() { - - // create 1st VF - ResourceReqDetails resourceOne = ResourceUIUtils.createResourceInUI(getUser()); - assertTrue(RestCDUtils.getResource(resourceOne).getErrorCode() == HttpStatus.SC_OK); - // add LoadBalancer to resource - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - canvasManager.createElementOnCanvas(LeftPanelCanvasItems.OBJECT_STORAGE); - GeneralUIUtils.checkIn(); - - // create 2nd VF - ResourceReqDetails resourceTwo = ResourceUIUtils.createResourceInUI(getUser()); - assertTrue(RestCDUtils.getResource(resourceTwo).getErrorCode() == HttpStatus.SC_OK); - // add ObjectStorage to resource - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - canvasManager = CanvasManager.getCanvasManager(); - canvasManager.createElementOnCanvas(LeftPanelCanvasItems.LOAD_BALANCER); - GeneralUIUtils.checkIn(); - - // create service - ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); - // Verify Service is Created - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - canvasManager = CanvasManager.getCanvasManager(); - - // adding two resource instances - CanvasElement vfOne = canvasManager.createElementOnCanvas(resourceOne.getName()); - - CanvasElement vfTwo = canvasManager.createElementOnCanvas(resourceTwo.getName()); - // link elements - canvasManager.linkElements(vfOne, vfTwo); - - // check results - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - ServiceVerificator.verifyLinkCreated(createServiceInUI, getUser()); - - } - - /** - * This method tests the following: <br> - * 1. Import of VF <br> - * 2. Certification Of Vf <br> - * 3. Adding deployment artifact to VF <br> - * 4. Creation of Service <br> - * 5. Adding Vf instance to Service <br> - * 6. Service Certification <br> - * 7. Approving Service to distribution by Governor <br> - * 8. Making sure service is ready to distribute by ops <br> - */ - @Test - public void testBuildServiceForDistribution() { - ResourceReqDetails importedVf = ResourceUIUtils.importVfInUI(getUser(), FileHandling.getResourcesFilesPath(), - "valid_vf.csar"); - GeneralUIUtils.waitForLoader(20); - // Verify Import - VfVerificator.verifyResourceIsCreated(importedVf); - - // Create Deployment Artifact - ArtifactUIUtils.createDeploymentArtifactOnVf(FileHandling.getResourcesFilesPath() + "myYang.xml", - ArtifactTypeEnum.YANG_XML); - VfVerificator.verifyResourceContainsDeploymentArtifacts(importedVf, - Arrays.asList(new ArtifactTypeEnum[] { ArtifactTypeEnum.YANG_XML })); - - // Submit For Testing Process VF - GeneralUIUtils.submitForTestingElement(importedVf.getName()); - - // Certify The VF - quitAndReLogin(UserRoleEnum.TESTER); - ResourceUIUtils.testAndAcceptElement(importedVf); - - // Verify Certification - GeneralUIUtils.waitForLoader(); - VfVerificator.verifyResourceIsCertified(importedVf); - - // Create Service - quitAndReLogin(UserRoleEnum.DESIGNER); - ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - - // Drag the VF To the Service - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - canvasManager.createElementOnCanvas(importedVf.getName()); - - // Submit For Testing Process Service - GeneralUIUtils.submitForTestingElement(null); - - // Certify The Service - quitAndReLogin(UserRoleEnum.TESTER); - ResourceUIUtils.testAndAcceptElement(createServiceInUI); - ServiceVerificator.verifyServiceCertified(createServiceInUI, getUser()); - - // Approve with governor - quitAndReLogin(UserRoleEnum.GOVERNOR); - ServiceUIUtils.approveServiceForDistribution(createServiceInUI); - - // Log in with Ops and verify that can distribute - quitAndReLogin(UserRoleEnum.OPS); - GeneralUIUtils.getWebElementWaitForVisible(createServiceInUI.getName()).click(); - WebElement distributeWebElement = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.DISTRIBUTE.getValue()); - assertTrue(distributeWebElement != null); - - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java deleted file mode 100644 index b3e8e023ca..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.service; - -import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertFalse; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; -import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.BreadcrumbsButtonsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.InputsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.ModalItems; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator; -import org.testng.annotations.Test; - -public class ServiceInputsTests extends SetupCDTest { - - public String serviceName = ""; - - @Test - private void testSelectingInputAndAddingItToTheService() { - ServiceInputsTestsSetUp(); - - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertTrue(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); - } - - @Test - private void testDeletingAnInputFromTheService() { - ServiceInputsTestsSetUp(); - - // clicking on the delete input button and accepting the delete - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.DELETE_INPUT.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(ModalItems.OK.getValue()).click(); - - assertFalse(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertFalse(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); - } - - @Test - private void testCheckingInTheServiceAndButtonsAreDisabled() throws Exception { - ServiceInputsTestsSetUp(); - - // Checking in the service and accessing it again in the home - GeneralUIUtils.checkIn(); - GeneralUIUtils.closeNotificatin(); - GeneralUIUtils.findComponentAndClick(serviceName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); - - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.SECOND_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.DELETE_INPUT.getValue()).getAttribute("class").contains("disabled")); - } - - @Test - private void testInputsSanity() throws Exception { - ServiceInputsTestsSetUp(); - - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertTrue(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); - - // clicking on the delete input button and accepting the delete - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.DELETE_INPUT.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(ModalItems.OK.getValue()).click(); - - assertFalse(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertFalse(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); - - // adding the input to the service again - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.ADD_INPUTS_BUTTON.getValue()).click(); - - // Checking in the service and accessing it again in the home - GeneralUIUtils.checkIn(); - GeneralUIUtils.closeNotificatin(); - GeneralUIUtils.findComponentAndClick(serviceName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); - - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.SECOND_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); - } - - private void ServiceInputsTestsSetUp() { - // create vf - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "service_with_inputs.csar"; - ResourceReqDetails importVfREsourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, fileName); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.closeNotificatin(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.closeNotificatin(); - - // create service - ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - serviceName = createServiceInUI.getName(); - - // go to composition - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - - // drag vf into canvas - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement canvasElement = canvasManager.createElementOnCanvas(importVfREsourceInUI.getName()); - canvasManager.selectElementFromCanvas(canvasElement); - GeneralUIUtils.waitForLoader(); - - // moving to inputs view - GeneralUIUtils.getWebElementWaitForClickable(BreadcrumbsButtonsEnum.COMPONENT.getValue()).click(); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); - - // adding the input to the service - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.ADD_INPUTS_BUTTON.getValue()).click(); - } -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java deleted file mode 100644 index d3bb8a1375..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java +++ /dev/null @@ -1,333 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.vf; - -import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnException; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.Callable; - -import org.apache.http.HttpStatus; -import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; -import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; -import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils; -import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator; -import org.openecomp.sdc.uici.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.testng.annotations.Test; - -import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.Convertor; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; - -public class VfBasicTests extends SetupCDTest { - - @Test - public void testImportVfTableColumns() { - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.OPEN_MODAL_BUTTON.getValue()).click(); - - assertTrue(GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.VENDOR_HEADER_COL.getValue()) != null); - assertTrue(GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.NAME_HEADER_COL.getValue()) != null); - assertTrue(GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.CATEGORY_HEADER_COL.getValue()) != null); - - assertTrue(GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.VERSION_HEADER_COL.getValue()) != null); - } - - private void testsToChangeSomeParametersValues(){ - //open parameters form - GeneralUIUtils.moveToHTMLElementByDataTestId(DataTestIdEnum.Artifatcs.BASE_CMUI_LAB1_ARTIFACT_ITEM.getValue()); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.Artifatcs.OPEN_EDIT_PROPERTIES_FORM_OF_BASE_CMUI_LAB1.getValue()).click(); - //edit values for parameter without default value and for parameter with default - String valueForFirstParam="111"; - String newValueForSecondParam="222"; - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_AVAILABILITY_ZONE_0.getValue()).sendKeys(valueForFirstParam); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_CMAUI_FLAVOR.getValue()).clear(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_CMAUI_FLAVOR.getValue()).sendKeys(newValueForSecondParam); - //save changes - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.EnvParametersForm.SAVE_BUTTON.getValue()).click(); - GeneralUIUtils.waitForLoader(); - //open form again - GeneralUIUtils.moveToHTMLElementByDataTestId(DataTestIdEnum.Artifatcs.BASE_CMUI_LAB1_ARTIFACT_ITEM.getValue()); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.Artifatcs.OPEN_EDIT_PROPERTIES_FORM_OF_BASE_CMUI_LAB1.getValue()).click(); - //check if values were changed - assertTrue("The parameter value without default was not changed.", - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_AVAILABILITY_ZONE_0.getValue()).getAttribute("value").equals(valueForFirstParam)); - assertTrue("The parameter value with default was not changed.", - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_CMAUI_FLAVOR.getValue()).getAttribute("value").equals(newValueForSecondParam)); - //delete the value of the parameter without default - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.EnvParametersForm.DELETE_AVAILABILITY_ZONE_0.getValue()).click(); - boolean isThereDefaultValue=!GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.EnvParametersForm.DEFAULT_VALUE_COLMN_OF_CMAUI_FLAVOR.getValue()).getText().isEmpty(); - if(isThereDefaultValue){ - //revert the value of the parameter with default - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.EnvParametersForm.REVERET_CMAUI_FLAVOR.getValue()).click(); - } - //save changes - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.EnvParametersForm.SAVE_BUTTON.getValue()).click(); - GeneralUIUtils.waitForLoader(); - //open form again - GeneralUIUtils.moveToHTMLElementByDataTestId(DataTestIdEnum.Artifatcs.BASE_CMUI_LAB1_ARTIFACT_ITEM.getValue()); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.Artifatcs.OPEN_EDIT_PROPERTIES_FORM_OF_BASE_CMUI_LAB1.getValue()).click(); - //check if values were changed - assertTrue("The parameter value without default was not deleted.", - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_AVAILABILITY_ZONE_0.getValue()).getAttribute("value").equals("")); - if(isThereDefaultValue){ - String theDefaultValue="m1.large"; - assertTrue("The parameter value with default was not reverted.", - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.EnvParametersForm.VALUE_FIELD_OF_CMAUI_FLAVOR.getValue()).getAttribute("value").equals(theDefaultValue)); - } - } - - @Test - public void testVFiUpdateHeatENVParameters() throws Exception { - // create vf - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vmmc_work.csar"; - ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, - fileName); - GeneralUIUtils.closeNotificatin(); - GeneralUIUtils.checkIn(); - GeneralUIUtils.closeNotificatin(); - //create service - ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); - ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); - //go to composition - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - //drag vf into canvas - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement canvasElement = canvasManager.createElementOnCanvas(importVfResourceInUI.getName()); - canvasManager.selectElementFromCanvas(canvasElement); - GeneralUIUtils.waitForLoader(); - //go to deployment artifacts tab - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.DEPLOYMENT_ARTIFACTS.getValue()).click(); - //test change parameters - testsToChangeSomeParametersValues(); - } - - @Test - public void testVFUpdateHeatENVParameters() throws Exception { - // create vf - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vmmc_work.csar"; - ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, - fileName); - //go to deployment artifacts - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.DEPLOYMENT_ARTIFACT); - //test change parameters - testsToChangeSomeParametersValues(); - } - - @Test - public void testUpdateVfCreatedFromCsar() throws Exception { - // create vf - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "Sample_CSAR.csar"; - ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, - fileName); - // update csar - fileName = "Sample_CSAR2.csar"; - ResourceUIUtils.updateVfCsar(filePath, fileName); - VfVerificator.verifyNumOfComponentInstances(importVfResourceInUI, 4); - } - - @Test - public void testImportVf() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "Sample_CSAR.csar"; - ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUI(getUser(), filePath, fileName); - GeneralUIUtils.waitForLoader(); - assertTrue(RestCDUtils.getResource(importVfResourceInUI).getErrorCode() == HttpStatus.SC_OK); - } - - @Test - public void testCreateVf() { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - assertTrue(RestCDUtils.getResource(createResourceInUI).getErrorCode() == HttpStatus.SC_OK); - } - - @Test - public void testDeleteInstanceFromCanvas() { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - - canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); - CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 2); - canvasManager.deleteElementFromCanvas(computeElement); - VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 1); - - } - - @Test - public void testUpdateInstanceAttributeValue() { - // creare vfc with attrs - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.checkIn(); - // create vf - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - // add vfc to canvas - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement canvasElement = canvasManager.createElementOnCanvas(importVfcResourceInUI.getName()); - canvasManager.selectElementFromCanvas(canvasElement); - // edit value of vfc attr - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.PROPERTIES_AND_ATTRIBUTES.getValue()) - .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.MYATTR_ATTR_FROM_LIST.getValue()).click(); - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DEFAULT_VAL_FIELD.getValue()) - .sendKeys("2"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); - String newValue = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.RightBar.MYATTR_ATTR_VALUE_FROM_LIST.getValue()).getText(); - assertEquals("2", newValue); - } - - @Test(enabled = false) - public void testAddInfomratinalArtifact() throws Exception { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INFORMATION_ARTIFACT); - - ArtifactReqDetails informationalArtifact = ElementFactory.getDefaultArtifact(); - final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\"; - final String FILE_NAME = "Valid_tosca_Mycompute.yml"; - - ArtifactUIUtils.addInformationArtifact(informationalArtifact, FILE_PATH + FILE_NAME, - DataTestIdEnum.InformationalArtifatcs.FEATURES); - ArtifactUIUtils.addInformationArtifact(informationalArtifact, FILE_PATH + FILE_NAME, - DataTestIdEnum.InformationalArtifatcs.CAPACITY); - - RestResponse getResourceResponse = RestCDUtils.getResource(createResourceInUI); - assertEquals("Did not succeed to get resource after create", HttpStatus.SC_OK, - getResourceResponse.getErrorCode().intValue()); - - Map<String, Map<String, Object>> artifactsListFromResponse = ArtifactUIUtils - .getArtifactsListFromResponse(getResourceResponse.getResponse(), "artifacts"); - Map<String, Object> map = artifactsListFromResponse.get("Features"); - - assertTrue(artifactsListFromResponse.size() >= 2); - - } - - @Test - public void testVfCertification() throws IOException { - // Create VF - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - assertTrue(RestCDUtils.getResource(createResourceInUI).getErrorCode() == HttpStatus.SC_OK); - - // Submit For Testing Process - GeneralUIUtils.submitForTestingElement(createResourceInUI.getName()); - - // Tester - quitAndReLogin(UserRoleEnum.TESTER); - ResourceUIUtils.testAndAcceptElement(createResourceInUI); - - // Verification - GeneralUIUtils.waitForLoader(); - VfVerificator.verifyResourceIsCertified(createResourceInUI); - - } - - @Test - public void testDeploymentArtifactForVFi() { - User user = getUser(); - // create vf - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(user); - GeneralUIUtils.checkIn(); - GeneralUIUtils.waitForLoader(); - // create service - GeneralUIUtils.clickOnCreateEntityFromDashboard(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()); - ResourceUIUtils.defineResourceName("serv"); - GeneralUIUtils.defineDescription("description"); - GeneralUIUtils.waitForLoader(); - ResourceUIUtils.defineResourceCategory("Mobility", "selectGeneralCategory"); - ResourceUIUtils.defineProjectCode("012345"); - GeneralUIUtils.clickSaveButton(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - GeneralUIUtils.waitForLoader(); - // add vf to canvas - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement canvasElement = canvasManager.createElementOnCanvas(createResourceInUI.getName()); - canvasManager.selectElementFromCanvas(canvasElement); - GeneralUIUtils.waitForLoader(); - // add artifact - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.DEPLOYMENT_ARTIFACTS.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.ADD_ARTIFACT_BUTTON.getValue()).click(); - String newArtifactLabel = "newArtifact"; - ArtifactReqDetails details = new ArtifactReqDetails("new_atifact", "DCAE_INVENTORY_EVENT", "desc", "", - newArtifactLabel); - ResourceUIUtils.fillinDeploymentArtifactFormAndClickDone(details, - FileHandling.getResourcesFilesPath() + "yamlSample.yml"); - assertTrue(GeneralUIUtils.isElementPresent("artifact_Display_Name-" + newArtifactLabel)); - // edit artifact - GeneralUIUtils.getWebElementWaitForClickable("artifact_Display_Name-" + newArtifactLabel).click(); - String newFileName = "yamlSample2.yml"; - retryMethodOnException( - () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.GeneralSection.BROWSE_BUTTON.getValue()) - .sendKeys(FileHandling.getResourcesFilesPath() + newFileName)); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DONE.getValue()).click(); - GeneralUIUtils.waitForLoader(); - assertEquals(newFileName, - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.ARTIFACT_NAME.getValue()).getText()); - // delete artifact - GeneralUIUtils.moveToHTMLElementByDataTestId("artifact_Display_Name-" + newArtifactLabel); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.DELETE_ARTIFACT_BUTTON.getValue()).click(); - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); - assertTrue(!GeneralUIUtils.isElementPresent("artifact_Display_Name-" + newArtifactLabel)); - } - - @Test - public void testDisplayVfModuleProperies() { - //create vf with components instances properties - ResourceReqDetails importedVf = ResourceUIUtils.importVfInUI(getUser(), FileHandling.getResourcesFilesPath(), - "vmmc_work.csar"); - GeneralUIUtils.waitForLoader(40); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.DEPLOYMENT); - GeneralUIUtils.getWebElementWaitForClickable("hierarchy-module-0-title").click(); - assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.DeploymentSection.MODULE_PROPERTIES_HEADER_LIST.getValue())); - } - - protected ArtifactReqDetails defineInformationalArtifact() throws IOException, Exception { - return ElementFactory.getDefaultArtifact(); - } - - protected ResourceRespJavaObject buildResourceJavaObject(ResourceReqDetails resource, RestResponse restResponse, - User user) { - ResourceRespJavaObject resourceObject = new ResourceRespJavaObject(); - resourceObject = Convertor.constructFieldsForRespValidation(resource, resource.getVersion(), user); - resourceObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString()); - resourceObject.setAbstractt("false"); - resourceObject.setIcon(resource.getIcon().replace(" ", "")); - resourceObject.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse)); - return resourceObject; - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java deleted file mode 100644 index 73b09666ae..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.vf; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; -import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.verificator.VfVerificator; -import org.testng.annotations.Test; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; - -public class VfCanvasTests extends SetupCDTest { - - @Test - public void testCanvasDrag() { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement createElementOnCanvas = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); - - ImmutablePair<String, String> preMovePos = ResourceUIUtils.getRIPosition(createResourceInUI, getUser()); - - canvasManager.moveElementOnCanvas(createElementOnCanvas); - - VfVerificator.verifyRILocationChanged(createResourceInUI, preMovePos, getUser()); - - } - - @Test - public void testCanvasConnectComponents() { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - CanvasElement bsElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); - CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - - canvasManager.linkElements(bsElement, computeElement); - - VfVerificator.verifyLinkCreated(createResourceInUI); - - } - - @Test - public void testCanvasVFSanity() { - ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); - CanvasManager canvasManager = CanvasManager.getCanvasManager(); - - CanvasElement bsElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); - CanvasElement compElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); - - ImmutablePair<String, String> preMovePos = ResourceUIUtils.getRIPosition(createResourceInUI, getUser()); - canvasManager.moveElementOnCanvas(bsElement); - canvasManager.moveElementOnCanvas(compElement); - - VfVerificator.verifyRILocationChanged(createResourceInUI, preMovePos, getUser()); - - CanvasElement bsElement2 = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); - - canvasManager.linkElements(bsElement2, compElement); - - VfVerificator.verifyLinkCreated(createResourceInUI); - - VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 3); - - canvasManager.moveElementOnCanvas(compElement); - - canvasManager.deleteElementFromCanvas(bsElement); - - VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 2); - - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java deleted file mode 100644 index 47344b7c68..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java +++ /dev/null @@ -1,340 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.vf; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertTrue; - -import java.io.IOException; -import java.util.regex.Pattern; - -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; -import org.openqa.selenium.WebElement; -import org.testng.annotations.Test; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; - -public class VfDeploymentTests extends SetupCDTest { - - // *****************************EditNamePopoverTests*****************************// - @Test - public void ClickingOnEditNamePopoverIconShouldOpenTheEditNamePopoverForm() { - EditNamePopoverTestsSetUp(); - - assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); - } - - @Test - public void ModuleDataShouldBeDisplayedInTheEditNameForm() { - EditNamePopoverTestsSetUp(); - - WebElement instanceName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_INSTANCE_NAME.getValue()); - WebElement heatName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()); - WebElement moduleName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_MODULE_NAME.getValue()); - - String moduleNameToDivide = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); - - String[] dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); - - assertEquals(dividedModuleName[0], instanceName.getText()); - assertEquals(dividedModuleName[1], heatName.getAttribute("value")); - assertEquals(dividedModuleName[2], moduleName.getText()); - - } - - @Test - public void CloseButtonShouldCloseThePopover() { - EditNamePopoverTestsSetUp(); - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_CLOSE_BUTTON.getValue()) - .click(); - - assertFalse(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); - } - - @Test - public void XButtonShouldCloseThePopover() { - EditNamePopoverTestsSetUp(); - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_X_BUTTON.getValue()) - .click(); - - assertFalse(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); - } - - @Test - public void SaveButtonShouldBeDisabledWhileTheNameHasNotBeenChanged() { - EditNamePopoverTestsSetUp(); - - WebElement popoverSaveButton = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()); - - assertTrue(popoverSaveButton.getAttribute("class").contains("disabled")); - } - - @Test - public void ClickingOnTheSaveButtonShouldUpdateTheModuleName() { - EditNamePopoverTestsSetUp(); - - String newName = "testName"; - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()) - .clear(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()) - .sendKeys(newName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()) - .click(); - - GeneralUIUtils.waitForLoader(); - - String moduleName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); - - String[] dividedModuleName = moduleName.split(Pattern.quote("..")); - - assertEquals(dividedModuleName[1], newName); - } - - @Test - public void testUpdateModuleNameSanity() { - EditNamePopoverTestsSetUp(); - - String newName = "testName"; - - WebElement instanceName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_INSTANCE_NAME.getValue()); - WebElement heatName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()); - WebElement moduleName = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_MODULE_NAME.getValue()); - - String moduleNameToDivide = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); - - String[] dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); - - assertEquals(dividedModuleName[0], instanceName.getText()); - assertEquals(dividedModuleName[1], heatName.getAttribute("value")); - assertEquals(dividedModuleName[2], moduleName.getText()); - - WebElement popoverSaveButton = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()); - - assertTrue(popoverSaveButton.getAttribute("class").contains("disabled")); - - heatName.clear(); - heatName.sendKeys(newName); - - popoverSaveButton.click(); - - GeneralUIUtils.waitForLoader(); - - moduleNameToDivide = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); - dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); - - assertEquals(dividedModuleName[1], newName); - } - - // *****************************DeploymentTabsTests*****************************// - - @Test - public void testTabIsBeingDisplayedAtDeploymentView() { - DeploymentTestsSetUp(); - - assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue())); - } - - @Test - public void testClickingOnTabSetsItAsSelected() { - DeploymentTestsSetUp(); - - WebElement hierarchyTab = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()); - hierarchyTab.click(); - - assertTrue(hierarchyTab.getAttribute("class").contains("selected")); - } - - @Test - public void testTabNameIsBeingDisplayedInTheSelectedTabHeader() { - DeploymentTestsSetUp(); - - // select the hierarchy tab and check the header - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - WebElement tabHeader = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_HEADER.getValue()); - - assertEquals(tabHeader.getText(), "HIERARCHY"); - } - - @Test - public void testSelectingModuleNameInTheHierarchyTabShouldSelectIt() { - DeploymentTestsSetUp(); - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - WebElement hierarchyModule = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE_TITLE.getValue()); - - hierarchyModule.click(); - - assertTrue(hierarchyModule.getAttribute("class").contains("selected")); - } - - @Test - public void testSelectingModuleNameInTheHierarchyTabShouldExpandIt() { - DeploymentTestsSetUp(); - - // select hierarchy tab - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - WebElement hierarchyModule = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); - - hierarchyModule.click(); - - assertTrue(hierarchyModule.getAttribute("class").contains("expanded")); - } - - @Test - public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsData() { - DeploymentTestsSetUp(); - - // select hierarchy tab - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).click(); - - assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.TabsBar.HIERARCHY_SELECTED_MODULE_DATA.getValue())); - } - - @Test(enabled = false) - public void testResourceNameIsBeingDisplayedInTheSelectedTabSubHeader() { - DeploymentTestsSetUp(); - - // select the hierarchy tab and check the header - // WebElement tabSubHeader = - // getWebElement(DataTestIdEnum.TabsBar.TAB_SUB_HEADER.getValue()); - - // assertEquals(tabSubHeader.getText(), vmmcCsar.getName()); - } - - @Test(enabled = false) - public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsInformation() throws IOException { - DeploymentTestsSetUp(); - - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - WebElement hierarchyModule = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); - - // get the module - // String component = RestCDUtils.getResource(vmmcCsar).getResponse(); - // TODO idana fix test - /* - * GroupDefinitionInfo module = getModuleById(component, - * hierarchyModule.getText()); - * - * hierarchyModule.click(); - * - * assertModuleDetails(module, hierarchyModule); - */ - - } - - @Test(enabled = false) - public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsArtifacts() throws IOException { - DeploymentTestsSetUp(); - - GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - WebElement hierarchyModule = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); - - // TODO idana fix test - // Get the artifact from the module - /* - * String component = RestCDUtils.getResource(vmmcCsar, - * getUser()).getResponse(); GroupDefinitionInfo module = - * getModuleById(component, hierarchyModule.getText()); - * ArtifactDefinitionInfo artifact = module.getArtifacts().get(0); - * - * hierarchyModule.click(); - * - * assertModuleArtifactDetails(artifact); - */ - } - - @Test - public void testTabsViewSanity() throws IOException { - DeploymentTestsSetUp(); - - WebElement hierarchyTab = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()); - - assertTrue(hierarchyTab != null); - - hierarchyTab.click(); - - assertTrue(hierarchyTab.getAttribute("class").contains("selected")); - - WebElement tabHeader = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_HEADER.getValue()); - WebElement tabSubHeader = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_SUB_HEADER.getValue()); - - assertEquals(tabHeader.getText(), "HIERARCHY"); - // assertEquals(tabSubHeader.getText(), vmmcCsar.getName()); - - WebElement hierarchyModule = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); - WebElement hierarchyModuleTitle = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE_TITLE.getValue()); - hierarchyModule.click(); - WebElement selectedModuleData = GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_SELECTED_MODULE_DATA.getValue()); - - assertTrue(hierarchyModuleTitle.getAttribute("class").contains("selected")); - assertTrue(hierarchyModule.getAttribute("class").contains("expanded")); - assertTrue(selectedModuleData.getAttribute("ng-if") != null); - // TODO idana fix test - /* - * String component = RestCDUtils.getResource(vmmcCsar, - * getUser()).getResponse(); GroupDefinitionInfo module = - * getModuleById(component, hierarchyModule.getText()); - * ArtifactDefinitionInfo artifact = module.getArtifacts().get(0); - * - * assertModuleDetails(module, hierarchyModule); - * - * assertModuleArtifactDetails(artifact); - */ - - } - - // ************************DeploymentTestsSetUpFunction************************// - - private void EditNamePopoverTestsSetUp() { - DeploymentTestsSetUp(); - - // clicking on a module and opening the edit name popover - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.OPEN_POPOVER_ICON.getValue()) - .click(); - } - - private void DeploymentTestsSetUp() { - // import csar - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "vf_with_groups.csar"; - ResourceUIUtils.importVfInUI(getUser(), filePath, fileName); - - GeneralUIUtils.waitForLoader(20); - - // moving to deployment view - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.DEPLOYMENT); - } -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java deleted file mode 100644 index a81d854630..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.vf; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.OnboardUtility; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.testng.annotations.Test; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import com.google.gson.GsonBuilder; - -public class VfOnboardingTests extends SetupCDTest { - - @Test - public void testUpdateVfCreatedOnBoarding() { - // create vf - ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfFromOnBoardingModalWithoutCheckin(getUser(), - "mock_vf"); - // update vf - ResourceUIUtils.updateVfCsarFromOnBoarding(); - } - - @Test - public void createVfsFromOnboarding() throws IOException { - String folderPath = "C:\\onboardingTest\\onBoardingZips"; - File folder = new File(folderPath); - File[] listOfFiles = folder.listFiles(); - List<String> zipFileNames = Arrays.asList(listOfFiles).stream().map(file -> file.getName()) - .filter(fileName -> fileName.endsWith(".zip")).collect(Collectors.toList()); - Map<String, String> filesSuccessMap = new HashMap<>(); - for (String fileName : zipFileNames) { - try { - createSingleVfFromOnboarding(folderPath, fileName); - filesSuccessMap.put(fileName, "SUCCESS"); - } catch (Exception e) { - filesSuccessMap.put(fileName, "FAIL"); - } - } - Path file = Paths.get("RunResults.txt"); - String stringDataModel = new GsonBuilder().setPrettyPrinting().create().toJson(filesSuccessMap); - Files.write(file, stringDataModel.getBytes()); - } - - private static void createSingleVfFromOnboarding(String filePath, String zipFileName) { - String userId = UserRoleEnum.DESIGNER.getUserId(); - OnboardUtility.createVfFromOnboarding(userId, zipFileName, filePath); - GeneralUIUtils.submitForTestingElement("Vf From Onboarding"); - - } - -} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java deleted file mode 100644 index eb4980e3a0..0000000000 --- a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.openecomp.sdc.uici.tests.execute.vfc; - -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; -import java.util.function.Function; -import java.util.function.Supplier; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.http.HttpStatus; -import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; -import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; -import org.openecomp.sdc.uici.tests.utilities.FileHandling; -import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; -import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; -import org.openecomp.sdc.uici.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.Select; -import org.testng.annotations.Test; - -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; - -public class VfcBasicTests extends SetupCDTest { - - @Test - public void testRequirementsAndCapabilitiesSectionOfVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "mycompute.yml"; - ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.REQUIREMENTS_AND_CAPABILITIES); - // all expected requirements - assertTrue("Not all expected requirements are displayed.", - GeneralUIUtils.isElementPresent("dependency") && GeneralUIUtils.isElementPresent("local_storage")); - // filter requirements - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ReqAndCapabilitiesSection.SEARCH_BOX.getValue()) - .sendKeys("root"); - Supplier<Boolean> supplier = () -> !GeneralUIUtils.isElementPresent("local_storage"); - Function<Boolean, Boolean> resultVerifier = isNotPresent -> isNotPresent; - Boolean isFilteredRowNotPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The new property was not inserted to the properties table.", isFilteredRowNotPresent); - assertTrue("Filter problem.", GeneralUIUtils.isElementPresent("dependency") && isFilteredRowNotPresent); - // move to cap tab - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ReqAndCapabilitiesSection.CAP_TAB.getValue()).click(); - GeneralUIUtils.getWebElementWaitForVisible("endpoint").click(); - GeneralUIUtils.getWebElementWaitForVisible("initiator").click(); - supplier = () -> GeneralUIUtils.isElementPresent(DataTestIdEnum.PropertyForm.FORM_CONTAINER.getValue()); - resultVerifier = isPresent -> isPresent; - Boolean isPopupOpen = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The update property popup was not opened.", isPopupOpen); - } - - @Test - public void testCreatePropertyTypeListForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); - // fill in fields - String newPropName = "listProperty"; - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()) - .sendKeys(newPropName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()) - .sendKeys("desc"); - Select typeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); - typeField.selectByVisibleText("list"); - Select schemaTypeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SCHEMA_FIELD.getValue())); - schemaTypeField.selectByVisibleText("string"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.LIST_TYPE_DEFAULT_VAL_FIELD.getValue()) - .sendKeys("first"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_LIST_BUTTON.getValue()) - .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.LIST_TYPE_DEFAULT_VAL_FIELD.getValue()) - .sendKeys("second"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_LIST_BUTTON.getValue()) - .click(); - // save - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); - Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); - Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; - Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The new property was not inserted to the properties table.", isPresent); - } - - @Test - public void testCreatePropertyTypeMapForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); - // fill in fields - String newPropName = "mapProperty"; - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()) - .sendKeys(newPropName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()) - .sendKeys("desc"); - Select typeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); - typeField.selectByVisibleText("map"); - Select schemaTypeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SCHEMA_FIELD.getValue())); - schemaTypeField.selectByVisibleText("string"); - // insert item to map - GeneralUIUtils - .getWebElementWaitForVisible( - DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_FIRST_ITEM.getValue()) - .sendKeys("key1"); - GeneralUIUtils - .getWebElementWaitForVisible( - DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_FIRST_ITEM.getValue()) - .sendKeys("val1"); - // insert item to map - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_MAP_BUTTON.getValue()) - .click(); - GeneralUIUtils - .getWebElementWaitForVisible( - DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_SECOND_ITEM.getValue()) - .sendKeys("key2"); - GeneralUIUtils - .getWebElementWaitForVisible( - DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_SECOND_ITEM.getValue()) - .sendKeys("val2"); - // delete item from map - GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DELETE_FIRST_ITEM_FROM_MAP_BUTTON.getValue()) - .click(); - // save - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); - Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); - Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; - Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The new property was not inserted to the properties table.", isPresent); - } - - @Test - public void testCreatePropertyTypeDTForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); - // fill in fields - String newPropName = "dt"; - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()) - .sendKeys(newPropName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()) - .sendKeys("desc"); - Select typeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); - typeField.selectByValue("org.openecomp.datatypes.heat.contrail.network.rule.PortPairs"); - GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.START_PORT_FIELD_FOR_PORT_PAIRS_DT.getValue()) - .sendKeys("first"); - // save - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); - Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); - Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; - Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The new property was not inserted to the properties table.", isPresent); - } - - @Test - public void testViewAttributesTabForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); - - List<WebElement> attributesRows = GeneralUIUtils - .getWebElementsListWaitForVisible(DataTestIdEnum.AttributesSection.TABLE_ROWS.getValue()); - assertTrue("There is not any row in the table.", !CollectionUtils.isEmpty(attributesRows)); - // display editable buttons - assertTrue("The Add button is not dispaly.", - GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue())); - assertTrue("The Edit button is not dispaly for 'network' attribute.", GeneralUIUtils - .isElementPresent(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue())); - assertTrue("The Remove button is not dispaly for 'network' attribute.", GeneralUIUtils - .isElementPresent(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue())); - // click checkin - GeneralUIUtils.checkIn(); - // enter again - GeneralUIUtils.getWebElementWaitForVisible(importVfcResourceInUI.getName()).click(); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); - // the editable buttons disappear - assertTrue("The Add button is not dispaly.", - !GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue())); - assertTrue("The Edit button is not dispaly for 'network' attribute.", !GeneralUIUtils - .isElementPresent(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue())); - assertTrue("The Remove button is not dispaly for 'network' attribute.", !GeneralUIUtils - .isElementPresent(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue())); - } - - @Test - public void testCreateAttributeForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue()).click(); - // fill in fields - String newAttrName = "attr"; - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.NAME_FIELD.getValue()) - .sendKeys(newAttrName); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DESCRIPTION_FIELD.getValue()) - .sendKeys("desc"); - Select typeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.TYPE_FIELD.getValue())); - typeField.selectByVisibleText("integer"); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DEFAULT_VAL_FIELD.getValue()) - .sendKeys("2"); - // click ok - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); - Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newAttrName); - Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; - Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The new attribute was not inserted to the attributes table.", isPresent); - } - - @Test - public void testUpdateTypeForAttributeOfVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - VfVerificator.verifyResourceIsCreated(importVfcResourceInUI); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); - GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue()) - .click(); - // fill in fields - Select typeField = new Select( - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.TYPE_FIELD.getValue())); - typeField.selectByVisibleText("float"); - // click ok - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); - Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent("float"); - Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; - Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); - assertTrue("The attribute type was not updated.", isPresent); - } - - @Test - public void testDeleteAttributeForVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "VFCWithAttributes.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); - GeneralUIUtils - .getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue()) - .click(); - GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.waitForLoader(); - Boolean retryResult = FunctionalInterfaces - .retryMethodOnResult(() -> !GeneralUIUtils.isElementPresent("networks"), boolResult -> boolResult); - assertTrue("The attribute is shown in the attributes table.", retryResult); - } - - @Test - public void testImportVfc() { - String filePath = FileHandling.getResourcesFilesPath(); - String fileName = "CP.yml"; - ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); - assertTrue(RestCDUtils.getResource(importVfcResourceInUI).getErrorCode() == HttpStatus.SC_OK); - } -} |