Skip to content

Commit

Permalink
control center framework review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
priyabhatnagar25 committed Nov 29, 2023
1 parent 1bc944d commit 1c08384
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.cdap.e2e.pages.locators.CdfControlCenterLocators;
import io.cdap.e2e.pages.locators.CdfPluginPropertiesLocators;
import io.cdap.e2e.utils.ConstantsUtil;
import io.cdap.e2e.utils.AssertionHelper;
import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.e2e.utils.SeleniumDriver;
Expand All @@ -37,12 +37,8 @@
public class CdfControlCenterActions {

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

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

/**
* Click on the Hamburger menu icon.
Expand Down Expand Up @@ -239,8 +235,13 @@ public static void clickOnCloseTabDatasetEntity() {
/**
* Click on the Dataset Artifact Message Displayed.
*/
public static void clickOnDatasetApplicationArtifactsMessage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.datasetApplicationsArtifactsMessage);
public static void clickOnDatasetApplicationArtifactsMessage(String allEntitiesDisplayedMessage) {
String allEntitiesDisplayedExpectedMessage = PluginPropertyUtils.pluginProp(allEntitiesDisplayedMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
allEntitiesDisplayedExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ allEntitiesDisplayedExpectedMessage);
}

/**
Expand Down Expand Up @@ -297,29 +298,49 @@ public static void navigateToProgramsTabPage() {
/**
* Check for the displayed message when sorted by Newest.
*/
public static void clickOnNewestOptionMessage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.newestOptionMessage);
public static void clickOnNewestOptionMessage(String newFilterMessage) {
String newestOptionExpectedMessage = PluginPropertyUtils.pluginProp(newFilterMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
newestOptionExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ newestOptionExpectedMessage);
}

/**
* Check for the displayed message when sorted by Oldest.
*/
public static void clickOnOldestOptionMessage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.oldestOptionMessage);
public static void clickOnOldestOptionMessage(String oldestFilterMessage) {
String oldestOptionExpectedMessage = PluginPropertyUtils.pluginProp(oldestFilterMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
oldestOptionExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ oldestOptionExpectedMessage);
}

/**
* Check for the displayed message when sorted by Z To A.
*/
public static void clickOnZToAOptionMessage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.zToAOptionMessage);
public static void clickOnZToAOptionMessage(String zToAFilterMessage) {
String zToAOptionExpectedMessage = PluginPropertyUtils.pluginProp(zToAFilterMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
zToAOptionExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ zToAOptionExpectedMessage);
}

/**
* Check for the displayed message when sorted by A To Z.
*/
public static void clickOnAToZOptionMessage() {
ElementHelper.clickOnElement(CdfControlCenterLocators.aToZOptionMessage);
public static void clickOnAToZOptionMessage(String aToZFilterMessage) {
String aToZOptionExpectedMessage = PluginPropertyUtils.pluginProp(aToZFilterMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
aToZOptionExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ aToZOptionExpectedMessage);
}

/**
Expand Down Expand Up @@ -373,30 +394,41 @@ public static void clickOnCloseIcon() {
/**
* Check for the count when user removes the tag.
*/
public static void tagCountDecreasesDataset() {
ElementHelper.clickOnElement(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage);
public static void tagCountDecreasesDataset(String tagCountDecreaseMessage) {
String tagCountDecreaseExpectedMessage = PluginPropertyUtils.pluginProp(tagCountDecreaseMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage,
tagCountDecreaseExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage
+ " contains text: " + tagCountDecreaseExpectedMessage);
}

/**
* Click on Search tab in control center.
*/
public static void clickOnSearchTagControlCenter(String searchedText) {
public static void enterTextInSearchBarInControlCenter(String searchedText) {
ElementHelper.sendKeys(CdfControlCenterLocators.searchTabControlCenter, searchedText);
ElementHelper.clickOnElement(CdfControlCenterLocators.searchTabControlCenter);
}

/**
* Search for the added tag in control center.
*/
public static void searchedTagDisplayedMessage() {
ElementHelper.isElementDisplayed(CdfControlCenterLocators.searchedTagShowsDisplayedMessage); }
public static void searchedTagDisplayedMessage(String searchedTagDisplayedMessage) {
String searchedTagDisplayedExpectedMessage = PluginPropertyUtils.pluginProp(searchedTagDisplayedMessage);
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
searchedTagDisplayedExpectedMessage);
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
+ searchedTagDisplayedExpectedMessage);
}

/**
* Press Enter Key.
*/
public static void pressEnterKey() {
logger.info("Press Enter Key");
Actions act = new Actions(SeleniumDriver.getDriver());
act.sendKeys(new CharSequence[]{Keys.ENTER}).perform();
}
act.sendKeys(Keys.ENTER).perform();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

public class CdfControlCenterLocators {

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

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

@FindBy(how = How.XPATH, using = "//*[@data-cy='feature-heading'][//div[contains(text(),'Control Center')]]")
Expand All @@ -40,40 +40,24 @@ public class CdfControlCenterLocators {
@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')]]")
@FindBy(how = How.XPATH, using = "//div[@class='entity-card-header datapipeline']")
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']]");
}

public static By clickOnTruncateButton() {
return By.xpath("//div//button[@data-cy='Truncate']");
}

@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']")
@FindBy(how = How.XPATH, using = "//input[@class='search-input form-control']")
public static WebElement searchTabControlCenter;

@FindBy(how = How.XPATH, using = "//div[@class='just-added-entities-list']//button[@class='btn btn-link']" +
"//*['icon-svg icon-wrench']")
public static WebElement setPreferencesIcon;

public static WebElement keyInputField() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@placeholder='key']"));
}

public static WebElement valueInputField() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@placeholder='value']"));
}

@FindBy(how = How.XPATH, using = "//button[@data-cy='save-prefs-btn']")
@FindBy(how = How.XPATH, using = "//button[@data-testid='save-prefs-btn']")
public static WebElement saveAndCloseButton;

@FindBy(how = How.XPATH, using = "//div[@class='just-added-entities-list']" +
Expand All @@ -99,7 +83,7 @@ public static WebElement valueInputField() {
@FindBy(how = How.XPATH, using = "//a[@class='link-to-detail']")
public static WebElement viewDetailsTabDatasetEntity;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Dataset')]")
@FindBy(how = How.XPATH, using = "//*[@class='icon-svg icon-datasets']")
public static WebElement navigateOnViewDetailsPageDatasetEntity;

@FindBy(how = How.XPATH, using = "//a[contains(text(),'Back')]")
Expand All @@ -108,13 +92,6 @@ public static WebElement valueInputField() {
@FindBy(how = How.XPATH, using = "//*[@class='icon-svg icon-close']")
public static WebElement closeTabDatasetEntity;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying all entities, sorted by Newest')]")
public static WebElement datasetApplicationsArtifactsMessage;

public static By locateDropdownListItem(String option) {
return By.xpath("//input[@data-cy='" + option + "']");
}

@FindBy(how = How.XPATH, using = "//a[contains(text(),'Schema')]")
public static WebElement schemaTabDatasetEntity;

Expand All @@ -127,41 +104,50 @@ public static By locateDropdownListItem(String option) {
@FindBy(how = How.XPATH, using = "//div[@class='program-tab clearfix']")
public static WebElement programsTabDatasetEntityPage;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Newest')]")
public static WebElement newestOptionMessage;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Oldest')]")
public static WebElement oldestOptionMessage;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Z - A')]")
public static WebElement zToAOptionMessage;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by A - Z')]")
public static WebElement aToZOptionMessage;
@FindBy(how = How.XPATH, using = "//div[@class='list-view-header subtitle']")
public static WebElement filterOptionMessage;

@FindBy(how = How.XPATH, using = "//div[@id='filter-tooltip-target-id']")
public static WebElement sortDropdown;

public static WebElement selectSortDropdownValue(String option) {
return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + option + "')]"));
}

@FindBy(how = How.XPATH, using = "//span[@data-testid='tag-plus-button']")
public static WebElement addTagIconDatasetEntity;

public static WebElement enterAddTagIconDatasetEntityValue() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@data-testid='tag-input']"));
}

@FindBy(how = How.XPATH, using = "//*[contains(text(),'Tags (1)')]")
public static WebElement tagCountIconIncreaseDatasetEntity;

@FindBy(how = How.XPATH, using = "//span[@class='tag-content']//*[@class='icon-svg icon-close']")
public static WebElement closeTagIconDatasetEntity;

@FindBy(how = How.XPATH, using = "//i[normalize-space()='No tags found. Click to add a new business tag.']")
@FindBy(how = How.XPATH, using = "//div[@class='tags-holder']")
public static WebElement tagCounDecreaseIconDatasetEntityMessage;

@FindBy(how = How.XPATH, using = "//span[contains(text(),'Search results for \"testingtag\", filtered by Appli')]")
public static WebElement searchedTagShowsDisplayedMessage;
public static By clickOnDeleteButton() {
return By.xpath("//button[@class='btn btn-primary'][//button[@data-testid='Delete']]");
}

public static By clickOnTruncateButton() {
return By.xpath("//div//button[@data-testid='Truncate']");
}

public static WebElement keyInputField() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@class='form-control key-input']"));
}

public static WebElement valueInputField() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@class='form-control value-input']"));
}

public static By locateDropdownListItem(String option) {
return By.xpath
("//input[@data-testid='" + option + "']");
}

public static WebElement selectSortDropdownValue(String option) {
return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + option + "')]"));
}

public static WebElement enterAddTagIconDatasetEntityValue() {
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@data-testid='tag-input']"));
}
}
49 changes: 27 additions & 22 deletions src/main/java/stepsdesign/ControlCenterSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public static void clickOnTheHamburgerIcon() {

@Then("Enter the text in search tab {string} in control center")
public static void openSearchControlCenter(String value) {
CdfControlCenterActions.clickOnSearchTagControlCenter(value);
CdfControlCenterActions.enterTextInSearchBarInControlCenter(value);
}

@Then("Verify the searched tag is displayed successfully on control center page")
public static void searchedTagDisplayedMessage() {
CdfControlCenterActions.searchedTagDisplayedMessage();
@Then("Verify the searched tag is displayed successfully on control center page: {string}")
public static void searchedTagDisplayedMessage(String searchedTagDisplayedMessage) {
CdfControlCenterActions.searchedTagDisplayedMessage(searchedTagDisplayedMessage);
}

@Then("Click on Control Center link from the hamburger menu")
Expand Down Expand Up @@ -154,9 +154,9 @@ public void selectDropdownFilterOptionValue(String pluginProperty, String option
CdfControlCenterActions.selectFilterDropdownOption(pluginProperty, option);
}

@Then("Verify the all entities message is displayed with the filter selection")
public void displayFilterDatasetApplicationArtifactsMessage() {
CdfControlCenterActions.clickOnDatasetApplicationArtifactsMessage();
@Then("Verify the all entities message is displayed with the filter selection: {string}")
public void displayFilterDatasetApplicationArtifactsMessage(String allEntitiesDisplayedMessage) {
CdfControlCenterActions.clickOnDatasetApplicationArtifactsMessage(allEntitiesDisplayedMessage);
}

@Then("Click on the schema link of the dataset entity details page")
Expand Down Expand Up @@ -185,24 +185,24 @@ public void selectDropdownSortOptionValue(String option) {
CdfControlCenterActions.selectSortDropdownOptionValue(option);
}

@Then("Verify the entities are sorted by the newest option")
public void clickOnNewestOptionMessage() {
CdfControlCenterActions.clickOnNewestOptionMessage();
@Then("Verify the entities are sorted by the newest option: {string}")
public void clickOnNewestOptionMessage(String newFilterMessage) {
CdfControlCenterActions.clickOnNewestOptionMessage(newFilterMessage);
}

@Then("Verify the entities are sorted by the oldest option")
public void clickOnOldestOptionMessage() {
CdfControlCenterActions.clickOnOldestOptionMessage();
@Then("Verify the entities are sorted by the oldest option: {string}")
public void clickOnOldestOptionMessage(String oldestFilterMessage) {
CdfControlCenterActions.clickOnOldestOptionMessage(oldestFilterMessage);
}

@Then("Verify the entities are sorted by the Z to A option")
public void clickOnZToAOptionMessage() {
CdfControlCenterActions.clickOnZToAOptionMessage();
@Then("Verify the entities are sorted by the Z to A option: {string}")
public void clickOnZToAOptionMessage(String zToAFilterMessage) {
CdfControlCenterActions.clickOnZToAOptionMessage(zToAFilterMessage);
}

@Then("Verify the entities are sorted by the A to Z option")
public void clickOnAToZOptionMessage() {
CdfControlCenterActions.clickOnAToZOptionMessage();
@Then("Verify the entities are sorted by the A to Z option: {string}")
public void clickOnAToZOptionMessage(String aToZFilterMessage) {
CdfControlCenterActions.clickOnAToZOptionMessage(aToZFilterMessage);
}

@Then("Click on the plus button to add the tag for a dataset entity")
Expand All @@ -221,10 +221,15 @@ public void tagCountIncreasesDataset() {
CdfControlCenterActions.tagCountIncreasesDataset();
}

@Then("Click on the close icon of tag added and verify the tag count decreases")
@Then("Click on the close icon of tag added")
public void clickOnCloseIconAndTagCountDecreases() {
CdfControlCenterActions.clickOnCloseIcon(); {
CdfControlCenterActions.tagCountDecreasesDataset();
CdfControlCenterActions.clickOnCloseIcon();
{
}
}

@Then("Verify the tag count of dataset entity decreases message: {string}")
public void tagCountDecreasesDataset(String tagCountDecreaseMessage) {
CdfControlCenterActions.tagCountDecreasesDataset(tagCountDecreaseMessage);
}
}

0 comments on commit 1c08384

Please sign in to comment.