diff options
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java')
-rw-r--r-- | ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java | 155 |
1 files changed, 72 insertions, 83 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java index fb8ead33d7..d8007c013b 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java @@ -7,9 +7,9 @@ * 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. @@ -32,76 +32,65 @@ import java.io.File; public class UploadArtifactPopup { - boolean isCompositionPage; - - public UploadArtifactPopup(boolean isCompositionPage) { - super(); - this.isCompositionPage = isCompositionPage; - } - - public UploadArtifactPopup() { - super(); - } - - public WebElement getArtifactDescriptionWebElement(){ - return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue()); - } - - public void loadFile(String path, String filename) { - final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue()); -// browseWebElement.sendKeys(path + filename); - browseWebElement.sendKeys(path + File.separator + filename); - GeneralUIUtils.ultimateWait(); - -// if (!browseWebElement.getAttribute("value").equals(filename)) -// { -// throw new TestException("File named " + filename + " does not presented"); -// } - } - - - - public void insertDescription(String artifactDescriptoin) { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin)); - WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement(); - artifactDescriptionTextbox.clear(); - artifactDescriptionTextbox.sendKeys(artifactDescriptoin); - - GeneralUIUtils.ultimateWait();; - } - - public Select defineArtifactLabel(String requiredArtifactLabel) { - Select selectList = null; - WebElement artifactLabelWebElement = null; - -// if (isCompositionPage){ - artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); -// } -// else{ -// selectList = GeneralUIUtils.getSelectList("Create New Artifact", DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); -// artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue())); -// } - - artifactLabelWebElement.clear(); - artifactLabelWebElement.sendKeys(requiredArtifactLabel); - return selectList; - } - - public Select selectArtifactType(String artifactType) { - return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue()); - } - - public void clickDoneButton() throws Exception { - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue()); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), 10); - } - - public void clickCancelButton() throws Exception { - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact"); - } + private static final int WAITING_FOR_ELEMENT_TIME_OUT = 10; + private boolean isCompositionPage; + + public UploadArtifactPopup(boolean isCompositionPage) { + super(); + this.isCompositionPage = isCompositionPage; + } + + public UploadArtifactPopup() { + super(); + } + + private WebElement getArtifactDescriptionWebElement() { + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue()); + } + + public void loadFile(String path, String filename) { + final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue()); + browseWebElement.sendKeys(path + File.separator + filename); + GeneralUIUtils.ultimateWait(); + } + + + public void insertDescription(String artifactDescriptoin) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin)); + WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement(); + artifactDescriptionTextbox.clear(); + artifactDescriptionTextbox.sendKeys(artifactDescriptoin); + + GeneralUIUtils.ultimateWait(); + } + + public Select defineArtifactLabel(String requiredArtifactLabel) { + Select selectList = null; + WebElement artifactLabelWebElement; + + artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()); + + + artifactLabelWebElement.clear(); + artifactLabelWebElement.sendKeys(requiredArtifactLabel); + return selectList; + } + + public Select selectArtifactType(String artifactType) { + return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue()); + } + + public void clickDoneButton() throws Exception { + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), WAITING_FOR_ELEMENT_TIME_OUT); + } + + public void clickCancelButton() throws Exception { + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact"); + } // public void clickUpdateButton() throws Exception { // clickAddButton(); @@ -109,16 +98,16 @@ public class UploadArtifactPopup { // GeneralUIUtils.waitForLoader(); // GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("sdc-add-artifact"), 50); // } - - public void insertURL(String artifactDescriptoin) throws Exception { - WebElement artifactDescriptionTextbox = getArtifactURLWebElement(); - artifactDescriptionTextbox.clear(); - artifactDescriptionTextbox. sendKeys(artifactDescriptoin); - } - - public WebElement getArtifactURLWebElement(){ - return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue()))); - } - + + public void insertURL(String artifactDescriptoin) throws Exception { + WebElement artifactDescriptionTextbox = getArtifactURLWebElement(); + artifactDescriptionTextbox.clear(); + artifactDescriptionTextbox.sendKeys(artifactDescriptoin); + } + + public WebElement getArtifactURLWebElement() { + return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue()))); + } + } |