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
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.
16 * SPDX-License-Identifier: Apache-2.0
17 * ============LICENSE_END=========================================================
19 package org.onap.sdc.frontend.ci.tests.pages;
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;
31 public class ComponentPage extends AbstractPageObject {
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;
39 public ComponentPage(final WebDriver 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);
49 public void isLoaded() {
50 topNavComponent.isLoaded();
51 resourceLeftSideMenu.isLoaded();
52 workspaceTopBarComponent.isLoaded();
55 public HomePage goToHomePage() {
56 return topNavComponent.clickOnHome();
59 public ToscaArtifactsPage goToToscaArtifacts() {
60 return resourceLeftSideMenu.clickOnToscaArtifactsMenuItem();
63 public InterfaceDefinitionPage goToInterfaceDefinition() {
64 return resourceLeftSideMenu.clickOnInterfaceDefinitionMenuItem();
67 public CompositionPage goToComposition() {
68 return resourceLeftSideMenu.clickOnCompositionMenuItem();
72 * Certifies the resource and wait for success notification.
74 public void certifyComponent() {
75 workspaceTopBarComponent.certifyResource();
79 * Creates the resource and wait for success notification.
81 public void clickOnCreate() {
82 workspaceTopBarComponent.clickOnCreate();
83 loaderHelper.waitForLoader(20);
84 notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
87 public String getLifecycleState() {
88 return workspaceTopBarComponent.getLifecycleState();
91 public boolean isInDesign() {
92 return LifeCycleStateEnum.IN_DESIGN.getValue().equalsIgnoreCase(getLifecycleState());
95 public AttributesOutputsPage goToAttributesOutputs() {
96 return resourceLeftSideMenu.clickOnAttributesOutputsMenuItem();
99 public AttributesPage goToAttributes() {
100 return resourceLeftSideMenu.clickOnAttributesMenuItem();
103 public <T extends ComponentPage> T clickOnGeneralMenuItem(Class<? extends T> clazz) {
104 return resourceLeftSideMenu.clickOnGeneralMenuItem(clazz);
107 public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
108 return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
111 public ResourcePropertiesPage goToProperties() {
112 return resourceLeftSideMenu.clickOnPropertiesMenuItem();