2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.pages;
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
25 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
26 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
27 import org.openqa.selenium.By;
28 import org.openqa.selenium.WebElement;
29 import org.openqa.selenium.support.ui.Select;
33 public class UploadArtifactPopup {
35 boolean isCompositionPage;
37 public UploadArtifactPopup(boolean isCompositionPage) {
39 this.isCompositionPage = isCompositionPage;
42 public UploadArtifactPopup() {
46 public WebElement getArtifactDescriptionWebElement(){
47 return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue());
50 public void loadFile(String path, String filename) {
51 final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue());
52 // browseWebElement.sendKeys(path + filename);
53 browseWebElement.sendKeys(path + File.separator + filename);
54 GeneralUIUtils.ultimateWait();
56 // if (!browseWebElement.getAttribute("value").equals(filename))
58 // throw new TestException("File named " + filename + " does not presented");
64 public void insertDescription(String artifactDescriptoin) {
65 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin));
66 WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement();
67 artifactDescriptionTextbox.clear();
68 artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
70 GeneralUIUtils.ultimateWait();;
73 public Select defineArtifactLabel(String requiredArtifactLabel) {
74 Select selectList = null;
75 WebElement artifactLabelWebElement = null;
77 // if (isCompositionPage){
78 artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
81 // selectList = GeneralUIUtils.getSelectList("Create New Artifact", DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
82 // artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()));
85 artifactLabelWebElement.clear();
86 artifactLabelWebElement.sendKeys(requiredArtifactLabel);
90 public Select selectArtifactType(String artifactType) {
91 return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
94 public void clickDoneButton() throws Exception {
95 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
96 GeneralUIUtils.waitForLoader();
97 GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), 10);
100 public void clickCancelButton() throws Exception {
101 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
102 GeneralUIUtils.waitForLoader();
103 GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact");
106 // public void clickUpdateButton() throws Exception {
108 // GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click();
109 // GeneralUIUtils.waitForLoader();
110 // GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("sdc-add-artifact"), 50);
113 public void insertURL(String artifactDescriptoin) throws Exception {
114 WebElement artifactDescriptionTextbox = getArtifactURLWebElement();
115 artifactDescriptionTextbox.clear();
116 artifactDescriptionTextbox. sendKeys(artifactDescriptoin);
119 public WebElement getArtifactURLWebElement(){
120 return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue())));