Initial OpenECOMP SDC commit
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / pages / UploadArtifactPopup.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.pages;
22
23 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
24 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
25 import org.openqa.selenium.By;
26 import org.openqa.selenium.WebElement;
27 import org.openqa.selenium.support.ui.Select;
28
29 public class UploadArtifactPopup {
30
31         public UploadArtifactPopup() {
32                 super();
33         }
34
35         public void loadFile(String path, String filename) {
36                 final WebElement browseWebElement = GeneralUIUtils
37                                 .getWebElementByDataTestId(DataTestIdEnum.ArtifactPopup.BROWSE.getValue());
38                 browseWebElement.sendKeys(path + "\\" + filename);
39         }
40
41         public void insertDescription(String artifactDescriptoin) {
42                 WebElement artifactDescriptionTextbox = GeneralUIUtils
43                                 .getWebElementWaitForVisible(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue());
44                 artifactDescriptionTextbox.clear();
45                 artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
46         }
47
48         public Select defineArtifactLabel(String requiredArtifactLabel) {
49                 Select selectList = GeneralUIUtils.getSelectList("Create New Artifact",
50                                 DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
51                 WebElement artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
52                 artifactLabelWebElement.clear();
53                 artifactLabelWebElement.sendKeys(requiredArtifactLabel);
54                 return selectList;
55         }
56
57         public Select selectArtifactType(String artifactType) {
58                 return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
59         }
60
61         public void clickAddButton() throws Exception {
62                 GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.ADD_BUTTON.getValue()).click();
63                 GeneralUIUtils.waitForLoader();
64         }
65
66         public void clickCancelButton() throws Exception {
67                 GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
68                 GeneralUIUtils.waitForLoader();
69         }
70
71         public void clickUpdateButton() throws Exception {
72                 GeneralUIUtils.getWebButton(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click();
73                 GeneralUIUtils.waitForLoader();
74         }
75
76 }