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.ToscaArtifactsPage;
24 import org.onap.sdc.frontend.ci.tests.pages.home.HomePage;
25 import org.onap.sdc.frontend.ci.tests.utilities.LoaderHelper;
26 import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent;
27 import org.onap.sdc.frontend.ci.tests.utilities.NotificationComponent.NotificationType;
28 import org.openqa.selenium.WebDriver;
30 public class ComponentPage extends AbstractPageObject {
32 protected final TopNavComponent topNavComponent;
33 protected final ResourceLeftSideMenu resourceLeftSideMenu;
34 protected final ResourceWorkspaceTopBarComponent workspaceTopBarComponent;
35 protected final LoaderHelper loaderHelper;
36 protected final NotificationComponent notificationComponent;
38 public ComponentPage(final WebDriver webDriver) {
40 topNavComponent = new TopNavComponent(webDriver);
41 resourceLeftSideMenu = new ResourceLeftSideMenu(webDriver);
42 workspaceTopBarComponent = new ResourceWorkspaceTopBarComponent(webDriver);
43 loaderHelper = new LoaderHelper(webDriver);
44 notificationComponent = new NotificationComponent(webDriver);
48 public void isLoaded() {
49 topNavComponent.isLoaded();
50 resourceLeftSideMenu.isLoaded();
51 workspaceTopBarComponent.isLoaded();
54 public HomePage goToHomePage() {
55 return topNavComponent.clickOnHome();
58 public ToscaArtifactsPage goToToscaArtifacts() {
59 return resourceLeftSideMenu.clickOnToscaArtifactsMenuItem();
62 public CompositionPage goToComposition() {
63 return resourceLeftSideMenu.clickOnCompositionMenuItem();
67 * Certifies the resource and wait for success notification.
69 public void certifyComponent() {
70 workspaceTopBarComponent.certifyResource();
74 * Creates the resource and wait for success notification.
76 public void clickOnCreate() {
77 workspaceTopBarComponent.clickOnCreate();
78 loaderHelper.waitForLoader(20);
79 notificationComponent.waitForNotification(NotificationType.SUCCESS, 20);
82 public String getLifecycleState() {
83 return workspaceTopBarComponent.getLifecycleState();
86 public boolean isInDesign() {
87 return LifeCycleStateEnum.IN_DESIGN.getValue().equalsIgnoreCase(getLifecycleState());
90 public AttributesOutputsPage goToAttributesOutputs() {
91 return resourceLeftSideMenu.clickOnAttributesOutputsMenuItem();
94 public AttributesPage goToAttributes() {
95 return resourceLeftSideMenu.clickOnAttributesMenuItem();
98 public <T extends ComponentPage> T clickOnGeneralMenuItem(Class<? extends T> clazz) {
99 return resourceLeftSideMenu.clickOnGeneralMenuItem(clazz);
102 public ResourcePropertiesAssignmentPage goToPropertiesAssignment() {
103 return resourceLeftSideMenu.clickOnPropertiesAssignmentMenuItem();
106 public ResourcePropertiesPage goToProperties() {
107 return resourceLeftSideMenu.clickOnPropertiesMenuItem();