Added oparent to sdc main
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / pages / VspValidationResultsPage.java
1 /**
2  * Copyright (c) 2019 Vodafone Group
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.ci.tests.pages;
18
19 import com.aventstack.extentreports.Status;
20 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
21 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
22 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
23 import org.openqa.selenium.WebElement;
24 import org.testng.AssertJUnit;
25
26 import java.util.List;
27
28 public class VspValidationResultsPage extends GeneralPageElements {
29
30     public VspValidationResultsPage() { super(); }
31
32     public static void navigateToVspValidationResultsPageUsingNavbar() throws Exception {
33         clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR);
34     }
35
36     public static void navigateToVspValidationResultsPageUsingBreadcrumbs() throws Exception {
37         clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_BREADCRUMBS);
38     }
39
40     public static boolean checkResultsExist() throws Exception {
41         List<WebElement> results = GeneralUIUtils.findElementsByXpath("//h4[contains(text(),'No Validation Checks Performed')]");
42         return results.size() == 0;
43     }
44
45     public static void clickOnElementUsingTestId(DataTestIdEnum.VspValidationResultsPage elementTestId) throws Exception {
46         SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", elementTestId.name()));
47         GeneralUIUtils.getWebElementByTestID(elementTestId.getValue()).click();
48         GeneralUIUtils.ultimateWait();
49     }
50 }