2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 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=========================================================
20 package org.openecomp.sdc.ci.tests.pages;
22 import org.openqa.selenium.By;
23 import org.openqa.selenium.WebDriver;
24 import org.openqa.selenium.WebElement;
25 import org.openqa.selenium.support.ui.ExpectedConditions;
27 import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.MAIN_DIV;
28 import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.ONBOARD_TAB_DIV;
29 import static org.openecomp.sdc.ci.tests.pages.OnboardHeaderComponent.XpathSelector.WORKSPACE_TAB_DIV;
32 * Handles the Onboard Header Component UI test actions
34 public class OnboardHeaderComponent extends AbstractPageObject {
36 private WebElement wrappingElement;
38 public OnboardHeaderComponent(final WebDriver webDriver) {
43 public void isLoaded() {
44 wrappingElement = getWait()
45 .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(MAIN_DIV.getXpath())));
47 .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(WORKSPACE_TAB_DIV.getXpath())));
49 .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(ONBOARD_TAB_DIV.getXpath())));
53 * Clicks on the workspace tab.
55 public void clickOnWorkspaceTab() {
56 wrappingElement.findElement(By.xpath(WORKSPACE_TAB_DIV.getXpath()));
60 * Clicks on the workspace tab.
62 public void clickOnOnboardTab() {
63 wrappingElement.findElement(By.xpath(ONBOARD_TAB_DIV.getXpath()));
67 * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
69 public enum XpathSelector {
70 MAIN_DIV("onboard-header", "//div[contains(@class, '%s')]"),
71 WORKSPACE_TAB_DIV("onboard-workspace-tab", "//div[@data-test-id='%s']"),
72 ONBOARD_TAB_DIV("onboard-onboard-tab", "//div[@data-test-id='%s']");
74 private final String id;
75 private final String xpathFormat;
77 XpathSelector(final String id, final String xpathFormat) {
79 this.xpathFormat = xpathFormat;
82 public String getId() {
86 public String getXpath() {
87 return String.format(xpathFormat, id);