-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framework steps for Hub phase 2 #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
/* | ||
* 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.CdfHubLocators; | ||
import io.cdap.e2e.utils.AssertionHelper; | ||
import io.cdap.e2e.utils.ElementHelper; | ||
import io.cdap.e2e.utils.PluginPropertyUtils; | ||
import io.cdap.e2e.utils.SeleniumHelper; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* CDF hub related actions. | ||
*/ | ||
public class CdfHubActions { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(CdfHubActions.class); | ||
static { | ||
SeleniumHelper.getPropertiesLocators(CdfHubLocators.class); | ||
} | ||
|
||
/** | ||
* Click on Hub option from the top panel. | ||
*/ | ||
public static void clickOnHub() { | ||
ElementHelper.clickOnElement(CdfHubLocators.hubPage); | ||
} | ||
|
||
/** | ||
* Click on differnt options from the hub. | ||
* @param option Plugins pipelines Drivers etc. | ||
*/ | ||
public static void clickOnOptionsFromHub(String option) { | ||
ElementHelper.clickOnElement(CdfHubLocators.locateArtifact(option)); | ||
} | ||
|
||
/** | ||
* Click on the different buttons in hub or studio. | ||
*/ | ||
public static void clickOnButton(String buttonName) { | ||
ElementHelper.clickOnElement(CdfHubLocators.locateButton(buttonName)); | ||
} | ||
|
||
/** | ||
* Verify that the pipeline is saved in drafts. | ||
*/ | ||
public static void verifyPipelineStatus(String pipelineName) { | ||
ElementHelper.isElementDisplayed(CdfHubLocators.locateButton(pipelineName)); | ||
} | ||
|
||
/** | ||
* Click on Deploy button to deploy the plugin Or create the pipeline. | ||
*/ | ||
public static void clickOnDeploy() { | ||
ElementHelper.clickOnElement(CdfHubLocators.deployButton); | ||
} | ||
|
||
/** | ||
* Click on Finish button to deploy the plugin Or create the pipeline. | ||
*/ | ||
public static void clickOnFinish() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Provide some info in comment before starting of actions that what is doing .
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ElementHelper.clickOnElement(CdfHubLocators.finishButton); | ||
} | ||
|
||
/** | ||
* Click on the different options from hub from the left panel . | ||
*/ | ||
public static void clickOnOptions(String option) { | ||
ElementHelper.clickOnElement(CdfHubLocators.locateOptions(option)); | ||
} | ||
|
||
/** | ||
* Click on Close button to close the hub page . | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should not be any space in 89 and * should be present before start of sentence There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed done. |
||
public static void clickOnCloseButton() { | ||
ElementHelper.clickOnElement(CdfHubLocators.closeButton); | ||
} | ||
|
||
/** | ||
* Click on Search tab in hub to search for artifacts or pipelines. | ||
*/ | ||
public static void clickOnSearchTab(String searchedText) { | ||
ElementHelper.sendKeys(CdfHubLocators.searchTabHub, searchedText); | ||
} | ||
|
||
/** | ||
* To verify the error message from the hub page . | ||
*/ | ||
public static void verifyErrorMessage(String errorMessageLocation) { | ||
String expectedErrorMessage = PluginPropertyUtils.errorProp(errorMessageLocation); | ||
AssertionHelper.verifyElementContainsText(CdfHubLocators. | ||
locateErrorMessage(expectedErrorMessage), expectedErrorMessage); | ||
} | ||
|
||
/** | ||
To verify whether the element is displayed or not . | ||
*/ | ||
public static void verifyElementIsDisplayed() { | ||
ElementHelper.isElementDisplayed(CdfHubLocators.locateHub); | ||
} | ||
|
||
/** | ||
To verify the plugin is deleted from the control center. | ||
*/ | ||
public static void verifyPluginIsDeleted() { | ||
ElementHelper.isElementDisplayed(CdfHubLocators.deletedElementStatus); | ||
} | ||
|
||
/** | ||
* Click on Delete button to delete the plugin from control center. | ||
*/ | ||
public static void clickOnDeleteButton() { | ||
ElementHelper.clickOnElement(CdfHubLocators.deleteButton); | ||
} | ||
|
||
/** | ||
* To delete the plugin in control center. | ||
*/ | ||
public static void deletePluginControlCenter() { | ||
ElementHelper.clickOnElement(CdfHubLocators.deleteIconControlCenter); | ||
clickOnDeleteButton(); | ||
} | ||
|
||
/** | ||
* To verify whether the plugin is successfully deployed. | ||
*/ | ||
public static void verifyPluginIsDeployed(String pluginName) { | ||
String pluginPropertyDataCyAttribute = PluginPropertyUtils.getPluginPropertyDataCyAttribute(pluginName); | ||
if (pluginPropertyDataCyAttribute == null) { | ||
pluginPropertyDataCyAttribute = pluginName; | ||
} | ||
ElementHelper.isElementDisplayed(CdfHubLocators.locateArtifact(pluginPropertyDataCyAttribute)); | ||
} | ||
|
||
/** | ||
* Click on the different options from the hamburger menu . | ||
* @param option Home List Studio Wrangler Replication Metadata etc. | ||
*/ | ||
public static void clickOnOptionFromHamburgerMenu(String option) { | ||
String pluginPropertyDataCyAttribute = PluginPropertyUtils.getPluginPropertyDataCyAttribute(option); | ||
if (pluginPropertyDataCyAttribute == null) { | ||
pluginPropertyDataCyAttribute = option; | ||
} | ||
ElementHelper.clickOnElement(CdfHubLocators.locateHamburgerOption(pluginPropertyDataCyAttribute)); | ||
} | ||
|
||
/** | ||
* Click on Create button to create a pipeline from hub . | ||
*/ | ||
public static void clickOnCreateButton() { | ||
ElementHelper.clickOnElement(CdfHubLocators.createButton); | ||
} | ||
|
||
/** | ||
* To verify whether the plugin is present in studio. | ||
*/ | ||
public static void verifyPluginInStudio(String pluginName) { | ||
ElementHelper.isElementDisplayed(CdfHubLocators.locateArtifact(pluginName)); | ||
} | ||
|
||
/** | ||
* To verify whether the plugin is displayed on the Hub page. | ||
*/ | ||
public static void verifyPluginIsDisplayed(String pluginName) { | ||
ElementHelper.isElementDisplayed(CdfHubLocators.locateArtifact(pluginName)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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 io.cdap.e2e.utils.SeleniumDriver; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.How; | ||
|
||
/** | ||
* CDF hub related locators. | ||
*/ | ||
public class CdfHubLocators { | ||
|
||
@FindBy(how = How.XPATH, using = "//input[@placeholder='Search by name']") | ||
public static WebElement searchTabHub; | ||
@FindBy(how = How.XPATH, using = "//*[@data-cy='hub-close-btn']") | ||
public static WebElement closeButton; | ||
@FindBy(how = How.XPATH, using = "//button[@data-cy='one_step_deploy_plugin-btn']") | ||
public static WebElement deployButton; | ||
@FindBy(how = How.XPATH, using = "//button[@data-cy='create_pipeline_draft-btn']") | ||
public static WebElement createButton; | ||
@FindBy(how = How.XPATH, using = "//button[@data-cy='wizard-finish-btn']") | ||
public static WebElement finishButton; | ||
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Hub')]") | ||
public static WebElement locateHub; | ||
@FindBy(how = How.XPATH, using = "//button[@data-cy='Delete']") | ||
public static WebElement deleteButton; | ||
@FindBy(how = How.XPATH, using = "//button[@id='navbar-hub']") | ||
public static WebElement hubPage; | ||
@FindBy(how = How.XPATH, using = "//*[contains(text(),'No entities found in namespace \"default\"')]") | ||
public static WebElement deletedElementStatus; | ||
@FindBy(how = How.XPATH, using = "//div[@class='entities-all-list-container']//button[@class='btn btn-link']" + | ||
"//*[@class='icon-svg icon-trash']") | ||
public static WebElement deleteIconControlCenter; | ||
|
||
public static WebElement locateArtifact(String option) { | ||
return SeleniumDriver.getDriver() | ||
.findElement(By.xpath("//*[contains(text(),'" + option + "')]")); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add space after each methods There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line number 58,62,65,68,71,74 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
public static WebElement locateButton(String buttonName) { | ||
return SeleniumDriver.getDriver() | ||
.findElement(By.xpath("//*[contains(text(),'" + buttonName + "')]")); | ||
} | ||
|
||
public static WebElement locateOptions(String featureName) { | ||
return SeleniumDriver.getDriver().findElement(By.xpath("//span[@title='" + featureName + "']")); | ||
} | ||
|
||
public static WebElement locateHamburgerOption(String option) { | ||
return SeleniumDriver.getDriver().findElement(By.xpath("//*[@data-cy='" + option + "']")); | ||
} | ||
|
||
public static WebElement locateErrorMessage(String errorMessage) { | ||
return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + errorMessage + "')]")); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* 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.CdfHubActions; | ||
import io.cdap.e2e.pages.locators.CdfHubLocators; | ||
import io.cdap.e2e.utils.CdfHelper; | ||
import io.cdap.e2e.utils.SeleniumHelper; | ||
import io.cucumber.java.en.Then; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* CDF hub related step design. | ||
*/ | ||
public class CdfHubSteps implements CdfHelper { | ||
private static final Logger logger = LoggerFactory.getLogger(CdfHubSteps.class); | ||
static { | ||
SeleniumHelper.getPropertiesLocators(CdfHubLocators.class); | ||
} | ||
|
||
@Then("Click on Hub Menu") | ||
public static void openHub() { | ||
CdfHubActions.clickOnHub(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add space post each actions is declared . line number 39,43,47 and so on .. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
@Then("Click on {string} plugin") | ||
public static void openPlugin(String pluginName) { | ||
CdfHubActions.clickOnOptionsFromHub(pluginName); | ||
} | ||
|
||
@Then("Click on {string} pipeline") | ||
public static void openPipeline(String pipelineName) { | ||
CdfHubActions.clickOnOptionsFromHub(pipelineName); | ||
} | ||
|
||
@Then("Click on {string} option") | ||
public static void openOptions(String option) { | ||
CdfHubActions.clickOnOptions(option); | ||
} | ||
|
||
@Then("Click on close button") | ||
public static void closeButton() { | ||
CdfHubActions.clickOnCloseButton(); | ||
} | ||
|
||
@Then("Deploy the plugin") | ||
public static void deployPlugin() { | ||
CdfHubActions.clickOnDeploy(); | ||
CdfHubActions.clickOnFinish(); | ||
} | ||
|
||
@Then("Enter the text in search tab {string}") | ||
public static void openSearch(String value) { | ||
CdfHubActions.clickOnSearchTab(value); | ||
} | ||
|
||
@Then("Verify that user is getting an error message: {string}") | ||
public void verifyErrorMessageDisplayedOnPluginHeader(String errorMessageLocation) { | ||
CdfHubActions.verifyErrorMessage(errorMessageLocation); | ||
} | ||
|
||
@Then("Verify that user is navigated to hub page successfully") | ||
public void verifyThatHubPageIsSuccessfullyOpened() { | ||
CdfHubActions.verifyElementIsDisplayed(); | ||
} | ||
|
||
@Then("Verify that {string} plugin is successfully deployed") | ||
public void verifyThatPluginIsSuccessfullyDeployed(String pluginName) { | ||
CdfHubActions.verifyPluginIsDeployed(pluginName); | ||
} | ||
|
||
@Then("Click on delete button to delete the plugin") | ||
public void deleteControlCenterPlugin() { | ||
CdfHubActions.deletePluginControlCenter(); | ||
} | ||
|
||
@Then("Verify that plugin is successfully deleted") | ||
public static void verifyPluginIsDeleted() { | ||
CdfHubActions.verifyPluginIsDeleted(); | ||
} | ||
|
||
@Then("Click on {string} button") | ||
public static void clickOnButton(String buttonName) { | ||
CdfHubActions.clickOnButton(buttonName); | ||
} | ||
|
||
@Then("Verify that {string} plugin is successfully verified in studio") | ||
public static void verifyPluginInStudio(String pluginName) { | ||
CdfHubActions.verifyPluginInStudio(pluginName); | ||
} | ||
|
||
@Then("Verify that {string} plugin is displayed on the Hub page") | ||
public static void verifyPluginIsDisplayedInHub(String pluginName) { | ||
CdfHubActions.verifyPluginIsDisplayed(pluginName); | ||
} | ||
|
||
@Then("Create the pipeline") | ||
public static void createPipeline() { | ||
CdfHubActions.clickOnCreateButton(); | ||
CdfHubActions.clickOnFinish(); | ||
} | ||
|
||
@Then("Click on the {string} from the left panel") | ||
public static void clickOnTheOptionsFromHamburgerMenu(String option) { | ||
CdfHubActions.clickOnOptionFromHamburgerMenu(option); | ||
} | ||
|
||
@Then("Click on the {string} option from the list panel") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these both steps referring to the same or you are achieving two different actions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, these both steps are referring to two different actions. |
||
public static void clickOnTheOption(String button) { | ||
CdfHubActions.clickOnButton(button); | ||
} | ||
|
||
@Then("Verify that {string} pipeline is saved in drafts") | ||
public static void verifyPipelineStatus(String pipelineName) { | ||
CdfHubActions.verifyPipelineStatus(pipelineName); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space post this line and post subsequesnt closing lines for all other methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added