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 org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
24 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
25 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
27 import com.aventstack.extentreports.Status;
29 public class TesterOperationPage {
31 public TesterOperationPage() {
35 public static void certifyComponent(String componentName) throws Exception{
36 clickStartTestingButton();
37 clickAccpetCertificationButton(componentName);
40 public static void clickAccpetCertificationButton(String componentName) throws Exception {
41 ExtentTestActions.log(Status.INFO, "Accepting certifiction of " + componentName);
42 String actionDuration = GeneralUIUtils.getActionDuration(() ->
45 clickAccpetCertificationButtonWithoutDuration(componentName);
46 } catch (Exception e) {
50 ExtentTestActions.log(Status.INFO, componentName + " is certifed", actionDuration);
54 public static void clickStartTestingButton() throws Exception{
55 ExtentTestActions.log(Status.INFO, "Starting to test");
56 String actionDuration = GeneralUIUtils.getActionDuration(() -> {
58 clickStartTestingButtonWithoutDuration();
59 } catch (Exception e) {
63 ExtentTestActions.log(Status.INFO, "Ready for certification", actionDuration);
67 private static void certifyComponentWithoutDuration(String componentName) throws Exception {
68 clickStartTestingButtonWithoutDuration();
69 clickAccpetCertificationButtonWithoutDuration(componentName);
73 private static void clickAccpetCertificationButtonWithoutDuration(String componentName) throws Exception {
75 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
76 GeneralUIUtils.ultimateWait();
77 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys(componentName + " tested successfuly");
78 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
79 GeneralUIUtils.ultimateWait();
80 GeneralUIUtils.sleep(2000);
81 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
84 throw new Exception("Accepting certification of " + componentName + " falied");
88 private static void clickStartTestingButtonWithoutDuration() throws Exception {
90 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue());
91 // GeneralUIUtils.ultimateWait();
92 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
93 // GeneralUIUtils.ultimateWait();
94 // GeneralUIUtils.sleep(1000);
97 throw new Exception("Start testing falied");