Provide user to specify the ouput name while declaring the atrributes
[sdc.git] / integration-tests / src / test / java / org / onap / sdc / frontend / ci / tests / pages / ComponentPage.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 Nordix Foundation
4  *  ================================================================================
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
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  *  SPDX-License-Identifier: Apache-2.0
17  *  ============LICENSE_END=========================================================
18  */
19 package org.onap.sdc.frontend.ci.tests.pages;
20
21 import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum;
22 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage;
23 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage;
24 import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage;
25 import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
26 import org.onap.sdc.frontend.ci.tests.utilities.LoaderHelper;
27 import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent;
28 import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.NotificationType;
29 import org.openqa.selenium.WebDriver;
30
31 public class ComponentPage extends AbstractPageObject {
32
33     protected final TopNavComponent topNavComponent;
34     protected final ResourceLeftSideMenu resourceLeftSideMenu;
35     protected final ResourceWorkspaceTopBarComponent workspaceTopBarComponent;
36     protected final LoaderHelper loaderHelper;
37     protected final NotificationComponent notificationComponent;
38
39     public ComponentPage(final WebDriver webDriver) {
40         super(webDriver);
41         topNavComponent = new TopNavComponent(webDriver);
42         resourceLeftSideMenu = new ResourceLeftSideMenu(webDriver);
43         workspaceTopBarComponent = new ResourceWorkspaceTopBarComponent(webDriver);
44         loaderHelper = new LoaderHelper(webDriver);
45         notificationComponent = new NotificationComponent(webDriver);
46     }
47
48     @Override
49     public void isLoaded() {
50         topNavComponent.isLoaded();
51         resourceLeftSideMenu.isLoaded();
52         workspaceTopBarComponent.isLoaded();
53     }
54
55     public HomePage goToHomePage() {
56         return topNavComponent.clickOnHome();
57     }
58
59     public ToscaArtifactsPage goToToscaArtifacts() {
60         return resourceLeftSideMenu.clickOnToscaArtifactsMenuItem();
61     }
62
63     public InterfaceDefinitionPage goToInterfaceDefinition() {
64         return resourceLeftSideMenu.clickOnInterfaceDefinitionMenuItem();
65     }
66
67     public CompositionPage goToComposition() {
68         return resourceLeftSideMenu.clickOnCompositionMenuItem();
69     }
70
71     /**
72      * Certifies the resource and wait for success notification.
73      */
74     public void certifyComponent() {
75         workspaceTopBarComponent.certifyResource();
76     }
77
78     /**
79      * Creates the resource and wait for success notification.
80      */
81     public void clickOnCreate() {
82         workspaceTopBarComponent.clickOnCreate();
83         loaderHelper.waitForLoader(20);
84         notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
85     }
86
87     public String getLifecycleState() {
88         return workspaceTopBarComponent.getLifecycleState();
89     }
90
91     public boolean isInDesign() {
92         return LifeCycleStateEnum.IN_DESIGN.getValue().equalsIgnoreCase(getLifecycleState());
93     }
94
95     public AttributesOutputsPage goToAttributesOutputs() {
96         return resourceLeftSideMenu.clickOnAttributesOutputsMenuItem();
97     }
98
99     public AttributesPage goToAttributes() {
100         return resourceLeftSideMenu.clickOnAttributesMenuItem();
101     }
102
103     public <T extends ComponentPage> T clickOnGeneralMenuItem(Class<? extends T> clazz) {
104         return resourceLeftSideMenu.clickOnGeneralMenuItem(clazz);
105     }
106
107     public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
108         return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
109     }
110
111     public ResourcePropertiesPage goToProperties() {
112         return resourceLeftSideMenu.clickOnPropertiesMenuItem();
113     }
114 }