Skip to content

Commit

Permalink
control center framework steps
Browse files Browse the repository at this point in the history
  • Loading branch information
priyabhatnagar25 committed Oct 27, 2023
1 parent fa28114 commit 0e38678
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright © 2023 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.cdap.e2e.pages.actions;

import io.cdap.e2e.pages.locators.CdfControlCenterLocators;
import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.SeleniumHelper;
import io.cdap.e2e.utils.WaitHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import stepsdesign.PipelineSteps;

/**
* Represents CdfControlCenterActions
*/

public class CdfControlCenterActions {

private static final Logger logger = LoggerFactory.getLogger(CdfControlCenterActions.class);
public static CdfControlCenterLocators cdfNameSpaceAdminLocators;

static {
cdfNameSpaceAdminLocators = SeleniumHelper.getPropertiesLocators(
CdfControlCenterLocators.class);
}

public static void clickOnHamburgerMenu() {
ElementHelper.clickOnElement(CdfControlCenterLocators.hamburgerMenu);
}

public static void clickOnControlCenterTab() {
ElementHelper.clickOnElement(CdfControlCenterLocators.controlCenterMenu);
}

public static void navigateToControlCenter() {
ElementHelper.clickOnElement(CdfControlCenterLocators.pageHeaderControlCenter);
}

public static void clickOnCreateButtonControlCenterPage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.createButtonControlCenter);
}

public static void pipelinePresentControlCenterPage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.dataPipelineControlCenter);
}

public static void clickOnDeleteButtonOnConfirmationBox() {
ElementHelper.clickIfDisplayed(CdfControlCenterLocators.clickOnDeleteButton());
}

public static void deletePipelineControlCenter() {
ElementHelper.clickOnElement(CdfControlCenterLocators.deleteIconControlCenter);
clickOnDeleteButtonOnConfirmationBox();
}

public static void pipelineDeletedIsNotPresent() {
clickOnSearchTabControlCenter(PipelineSteps.pipelineName);
ElementHelper.isElementDisplayed(CdfControlCenterLocators.pipelineDeletedMessage);
}

public static void clickOnSearchTabControlCenter(String message) {
ElementHelper.sendKeys(CdfControlCenterLocators.searchTabControlCenter, message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright © 2023 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package io.cdap.e2e.pages.locators;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;

/**
* Represents CdfControlCenterLocators
*/

public class CdfControlCenterLocators {

@FindBy(how = How.XPATH, using = "//*[@data-cy='navbar-hamburger-icon']")
public static WebElement hamburgerMenu;

@FindBy(how = How.XPATH, using = "//*[@data-cy='navbar-control-center-link']")
public static WebElement controlCenterMenu;

@FindBy(how = How.XPATH, using = "//*[@data-cy='feature-heading'][//div[contains(text(),'Control Center')]]")
public static WebElement pageHeaderControlCenter;

@FindBy(how = How.XPATH, using = "//*[@id='create-pipeline-link']")
public static WebElement createButtonControlCenter;

@FindBy(how = How.XPATH, using = "//span[@class='entity-type'][//span[contains(text(),'Data Pipeline')]]")
public static WebElement dataPipelineControlCenter;

@FindBy(how = How.XPATH, using = "//div[@class='just-added-entities-list']//button[@class='btn btn-link']" +
"//*[@class='icon-svg icon-trash']")
public static WebElement deleteIconControlCenter;
public static By clickOnDeleteButton() {
return By.xpath("//button[@class='btn btn-primary'][//button[@data-cy='Delete']]");
}
@FindBy(how = How.XPATH, using = "//div[@class='empty-message-container']")
public static WebElement pipelineDeletedMessage;
@FindBy(how = How.XPATH, using = "//input[@class='search-input form-control'][@placeholder='Search']")
public static WebElement searchTabControlCenter;
}
64 changes: 64 additions & 0 deletions src/main/java/stepsdesign/ControlCenterSteps.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright © 2023 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package stepsdesign;

import io.cdap.e2e.pages.actions.CdfControlCenterActions;
import io.cdap.e2e.utils.CdfHelper;
import io.cucumber.java.en.Then;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Represents CdfControlCenterSteps
*/
public class ControlCenterSteps implements CdfHelper {

private static final Logger logger = LoggerFactory.getLogger(ControlCenterSteps.class);

@Then("Click on the Hamburger bar on the left panel")
public static void clickOnTheHamburgerIcon() {
CdfControlCenterActions.clickOnHamburgerMenu();
}

@Then("Click on Control Center link from the hamburger menu")
public void openControlCenterPage() {
CdfControlCenterActions.clickOnControlCenterTab();
}

@Then("Verify that the user is navigated to control center page successfully")
public void navigateControlCenterPage() {
CdfControlCenterActions.navigateToControlCenter();
}

@Then("Verify user is able to click on the create button to create a pipeline successfully")
public void createButtonControlCenterPage() {
CdfControlCenterActions.clickOnCreateButtonControlCenterPage();
}
@Then("Verify the pipeline created successfully is present in control center page")
public void pipelinePresentControlCenterPage() {
CdfControlCenterActions.pipelinePresentControlCenterPage();
}
@Then("Click on the delete icon of the created pipeline and pipeline should get deleted successfully")
public void deleteControlCenterPipeline() {
CdfControlCenterActions.deletePipelineControlCenter();
}

@Then("Verify the deleted pipeline is not present in the control center page")
public void pipelineDeletedIsNotPresent() {
CdfControlCenterActions.pipelineDeletedIsNotPresent();
}
}

0 comments on commit 0e38678

Please sign in to comment.