diff --git a/src/main/java/io/cdap/e2e/pages/actions/CdfControlCenterActions.java b/src/main/java/io/cdap/e2e/pages/actions/CdfControlCenterActions.java new file mode 100644 index 000000000..416b2abb6 --- /dev/null +++ b/src/main/java/io/cdap/e2e/pages/actions/CdfControlCenterActions.java @@ -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); + } +} diff --git a/src/main/java/io/cdap/e2e/pages/locators/CdfControlCenterLocators.java b/src/main/java/io/cdap/e2e/pages/locators/CdfControlCenterLocators.java new file mode 100644 index 000000000..d3097b98d --- /dev/null +++ b/src/main/java/io/cdap/e2e/pages/locators/CdfControlCenterLocators.java @@ -0,0 +1,58 @@ +/* + * 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; +} diff --git a/src/main/java/stepsdesign/ControlCenterSteps.java b/src/main/java/stepsdesign/ControlCenterSteps.java new file mode 100644 index 000000000..da77dba9e --- /dev/null +++ b/src/main/java/stepsdesign/ControlCenterSteps.java @@ -0,0 +1,66 @@ +/* + * 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(); + } +}