Skip to content

Commit c63b278

Browse files
control center framework review comments
1 parent 830e420 commit c63b278

File tree

3 files changed

+119
-98
lines changed

3 files changed

+119
-98
lines changed

src/main/java/io/cdap/e2e/pages/actions/CdfControlCenterActions.java

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import io.cdap.e2e.pages.locators.CdfControlCenterLocators;
1919
import io.cdap.e2e.pages.locators.CdfPluginPropertiesLocators;
20-
import io.cdap.e2e.utils.ConstantsUtil;
20+
import io.cdap.e2e.utils.AssertionHelper;
2121
import io.cdap.e2e.utils.ElementHelper;
2222
import io.cdap.e2e.utils.PluginPropertyUtils;
2323
import io.cdap.e2e.utils.SeleniumDriver;
@@ -37,12 +37,8 @@
3737
public class CdfControlCenterActions {
3838

3939
private static final Logger logger = LoggerFactory.getLogger(CdfControlCenterActions.class);
40-
public static CdfControlCenterLocators cdfNameSpaceAdminLocators;
41-
42-
static {
43-
cdfNameSpaceAdminLocators = SeleniumHelper.getPropertiesLocators(
44-
CdfControlCenterLocators.class);
45-
}
40+
public static CdfControlCenterLocators cdfControlCenterLocators =
41+
SeleniumHelper.getPropertiesLocators(CdfControlCenterLocators.class);
4642

4743
/**
4844
* Click on the Hamburger menu icon.
@@ -239,8 +235,13 @@ public static void clickOnCloseTabDatasetEntity() {
239235
/**
240236
* Click on the Dataset Artifact Message Displayed.
241237
*/
242-
public static void clickOnDatasetApplicationArtifactsMessage() {
243-
ElementHelper.clickOnElement(CdfControlCenterLocators.datasetApplicationsArtifactsMessage);
238+
public static void clickOnDatasetApplicationArtifactsMessage(String allEntitiesDisplayedMessage) {
239+
String allEntitiesDisplayedExpectedMessage = PluginPropertyUtils.pluginProp(allEntitiesDisplayedMessage);
240+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
241+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
242+
allEntitiesDisplayedExpectedMessage);
243+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
244+
+ allEntitiesDisplayedExpectedMessage);
244245
}
245246

246247
/**
@@ -297,29 +298,49 @@ public static void navigateToProgramsTabPage() {
297298
/**
298299
* Check for the displayed message when sorted by Newest.
299300
*/
300-
public static void clickOnNewestOptionMessage() {
301-
ElementHelper.clickOnElement(CdfControlCenterLocators.newestOptionMessage);
301+
public static void clickOnNewestOptionMessage(String newFilterMessage) {
302+
String newestOptionExpectedMessage = PluginPropertyUtils.pluginProp(newFilterMessage);
303+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
304+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
305+
newestOptionExpectedMessage);
306+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
307+
+ newestOptionExpectedMessage);
302308
}
303309

304310
/**
305311
* Check for the displayed message when sorted by Oldest.
306312
*/
307-
public static void clickOnOldestOptionMessage() {
308-
ElementHelper.clickOnElement(CdfControlCenterLocators.oldestOptionMessage);
313+
public static void clickOnOldestOptionMessage(String oldestFilterMessage) {
314+
String oldestOptionExpectedMessage = PluginPropertyUtils.pluginProp(oldestFilterMessage);
315+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
316+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
317+
oldestOptionExpectedMessage);
318+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
319+
+ oldestOptionExpectedMessage);
309320
}
310321

311322
/**
312323
* Check for the displayed message when sorted by Z To A.
313324
*/
314-
public static void clickOnZToAOptionMessage() {
315-
ElementHelper.clickOnElement(CdfControlCenterLocators.zToAOptionMessage);
325+
public static void clickOnZToAOptionMessage(String zToAFilterMessage) {
326+
String zToAOptionExpectedMessage = PluginPropertyUtils.pluginProp(zToAFilterMessage);
327+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
328+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
329+
zToAOptionExpectedMessage);
330+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
331+
+ zToAOptionExpectedMessage);
316332
}
317333

318334
/**
319335
* Check for the displayed message when sorted by A To Z.
320336
*/
321-
public static void clickOnAToZOptionMessage() {
322-
ElementHelper.clickOnElement(CdfControlCenterLocators.aToZOptionMessage);
337+
public static void clickOnAToZOptionMessage(String aToZFilterMessage) {
338+
String aToZOptionExpectedMessage = PluginPropertyUtils.pluginProp(aToZFilterMessage);
339+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
340+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
341+
aToZOptionExpectedMessage);
342+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
343+
+ aToZOptionExpectedMessage);
323344
}
324345

325346
/**
@@ -373,30 +394,41 @@ public static void clickOnCloseIcon() {
373394
/**
374395
* Check for the count when user removes the tag.
375396
*/
376-
public static void tagCountDecreasesDataset() {
377-
ElementHelper.clickOnElement(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage);
397+
public static void tagCountDecreasesDataset(String tagCountDecreaseMessage) {
398+
String tagCountDecreaseExpectedMessage = PluginPropertyUtils.pluginProp(tagCountDecreaseMessage);
399+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage);
400+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage,
401+
tagCountDecreaseExpectedMessage);
402+
logger.info("Verifying that the element: " + CdfControlCenterLocators.tagCounDecreaseIconDatasetEntityMessage
403+
+ " contains text: " + tagCountDecreaseExpectedMessage);
378404
}
379405

380406
/**
381407
* Click on Search tab in control center.
382408
*/
383-
public static void clickOnSearchTagControlCenter(String searchedText) {
409+
public static void enterTextInSearchBarInControlCenter(String searchedText) {
384410
ElementHelper.sendKeys(CdfControlCenterLocators.searchTabControlCenter, searchedText);
385411
ElementHelper.clickOnElement(CdfControlCenterLocators.searchTabControlCenter);
386412
}
387413

388414
/**
389415
* Search for the added tag in control center.
390416
*/
391-
public static void searchedTagDisplayedMessage() {
392-
ElementHelper.isElementDisplayed(CdfControlCenterLocators.searchedTagShowsDisplayedMessage); }
417+
public static void searchedTagDisplayedMessage(String searchedTagDisplayedMessage) {
418+
String searchedTagDisplayedExpectedMessage = PluginPropertyUtils.pluginProp(searchedTagDisplayedMessage);
419+
WaitHelper.waitForElementToBeDisplayed(CdfControlCenterLocators.filterOptionMessage);
420+
AssertionHelper.verifyElementContainsText(CdfControlCenterLocators.filterOptionMessage,
421+
searchedTagDisplayedExpectedMessage);
422+
logger.info("Verifying that the element: " + CdfControlCenterLocators.filterOptionMessage + " contains text: "
423+
+ searchedTagDisplayedExpectedMessage);
424+
}
393425

394426
/**
395427
* Press Enter Key.
396428
*/
397429
public static void pressEnterKey() {
398430
logger.info("Press Enter Key");
399431
Actions act = new Actions(SeleniumDriver.getDriver());
400-
act.sendKeys(new CharSequence[]{Keys.ENTER}).perform();
401-
}
432+
act.sendKeys(Keys.ENTER).perform();
402433
}
434+
}

src/main/java/io/cdap/e2e/pages/locators/CdfControlCenterLocators.java

Lines changed: 37 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828

2929
public class CdfControlCenterLocators {
3030

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

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

3737
@FindBy(how = How.XPATH, using = "//*[@data-cy='feature-heading'][//div[contains(text(),'Control Center')]]")
@@ -40,40 +40,24 @@ public class CdfControlCenterLocators {
4040
@FindBy(how = How.XPATH, using = "//*[@id='create-pipeline-link']")
4141
public static WebElement createButtonControlCenter;
4242

43-
@FindBy(how = How.XPATH, using = "//span[@class='entity-type'][//span[contains(text(),'Data Pipeline')]]")
43+
@FindBy(how = How.XPATH, using = "//div[@class='entity-card-header datapipeline']")
4444
public static WebElement dataPipelineControlCenter;
4545

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

50-
public static By clickOnDeleteButton() {
51-
return By.xpath("//button[@class='btn btn-primary'][//button[@data-cy='Delete']]");
52-
}
53-
54-
public static By clickOnTruncateButton() {
55-
return By.xpath("//div//button[@data-cy='Truncate']");
56-
}
57-
5850
@FindBy(how = How.XPATH, using = "//div[@class='empty-message-container']")
5951
public static WebElement pipelineDeletedMessage;
6052

61-
@FindBy(how = How.XPATH, using = "//input[@class='search-input form-control'][@placeholder='Search']")
53+
@FindBy(how = How.XPATH, using = "//input[@class='search-input form-control']")
6254
public static WebElement searchTabControlCenter;
6355

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

68-
public static WebElement keyInputField() {
69-
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@placeholder='key']"));
70-
}
71-
72-
public static WebElement valueInputField() {
73-
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@placeholder='value']"));
74-
}
75-
76-
@FindBy(how = How.XPATH, using = "//button[@data-cy='save-prefs-btn']")
60+
@FindBy(how = How.XPATH, using = "//button[@data-testid='save-prefs-btn']")
7761
public static WebElement saveAndCloseButton;
7862

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

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

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

111-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying all entities, sorted by Newest')]")
112-
public static WebElement datasetApplicationsArtifactsMessage;
113-
114-
public static By locateDropdownListItem(String option) {
115-
return By.xpath("//input[@data-cy='" + option + "']");
116-
}
117-
11895
@FindBy(how = How.XPATH, using = "//a[contains(text(),'Schema')]")
11996
public static WebElement schemaTabDatasetEntity;
12097

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

130-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Newest')]")
131-
public static WebElement newestOptionMessage;
132-
133-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Oldest')]")
134-
public static WebElement oldestOptionMessage;
135-
136-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by Z - A')]")
137-
public static WebElement zToAOptionMessage;
138-
139-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Displaying Applications, Datasets, sorted by A - Z')]")
140-
public static WebElement aToZOptionMessage;
107+
@FindBy(how = How.XPATH, using = "//div[@class='list-view-header subtitle']")
108+
public static WebElement filterOptionMessage;
141109

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

145-
public static WebElement selectSortDropdownValue(String option) {
146-
return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + option + "')]"));
147-
}
148-
149113
@FindBy(how = How.XPATH, using = "//span[@data-testid='tag-plus-button']")
150114
public static WebElement addTagIconDatasetEntity;
151115

152-
public static WebElement enterAddTagIconDatasetEntityValue() {
153-
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@data-testid='tag-input']"));
154-
}
155-
156116
@FindBy(how = How.XPATH, using = "//*[contains(text(),'Tags (1)')]")
157117
public static WebElement tagCountIconIncreaseDatasetEntity;
158118

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

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

165-
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Search results for \"testingtag\", filtered by Appli')]")
166-
public static WebElement searchedTagShowsDisplayedMessage;
125+
public static By clickOnDeleteButton() {
126+
return By.xpath("//button[@class='btn btn-primary'][//button[@data-testid='Delete']]");
127+
}
128+
129+
public static By clickOnTruncateButton() {
130+
return By.xpath("//div//button[@data-testid='Truncate']");
131+
}
132+
133+
public static WebElement keyInputField() {
134+
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@class='form-control key-input']"));
135+
}
136+
137+
public static WebElement valueInputField() {
138+
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@class='form-control value-input']"));
139+
}
140+
141+
public static By locateDropdownListItem(String option) {
142+
return By.xpath
143+
("//input[@data-testid='" + option + "']");
144+
}
145+
146+
public static WebElement selectSortDropdownValue(String option) {
147+
return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + option + "')]"));
148+
}
149+
150+
public static WebElement enterAddTagIconDatasetEntityValue() {
151+
return SeleniumDriver.getDriver().findElement(By.xpath("//input[@data-testid='tag-input']"));
152+
}
167153
}

src/main/java/stepsdesign/ControlCenterSteps.java

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public static void clickOnTheHamburgerIcon() {
3636

3737
@Then("Enter the text in search tab {string} in control center")
3838
public static void openSearchControlCenter(String value) {
39-
CdfControlCenterActions.clickOnSearchTagControlCenter(value);
39+
CdfControlCenterActions.enterTextInSearchBarInControlCenter(value);
4040
}
4141

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

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

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

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

188-
@Then("Verify the entities are sorted by the newest option")
189-
public void clickOnNewestOptionMessage() {
190-
CdfControlCenterActions.clickOnNewestOptionMessage();
188+
@Then("Verify the entities are sorted by the newest option: {string}")
189+
public void clickOnNewestOptionMessage(String newFilterMessage) {
190+
CdfControlCenterActions.clickOnNewestOptionMessage(newFilterMessage);
191191
}
192192

193-
@Then("Verify the entities are sorted by the oldest option")
194-
public void clickOnOldestOptionMessage() {
195-
CdfControlCenterActions.clickOnOldestOptionMessage();
193+
@Then("Verify the entities are sorted by the oldest option: {string}")
194+
public void clickOnOldestOptionMessage(String oldestFilterMessage) {
195+
CdfControlCenterActions.clickOnOldestOptionMessage(oldestFilterMessage);
196196
}
197197

198-
@Then("Verify the entities are sorted by the Z to A option")
199-
public void clickOnZToAOptionMessage() {
200-
CdfControlCenterActions.clickOnZToAOptionMessage();
198+
@Then("Verify the entities are sorted by the Z to A option: {string}")
199+
public void clickOnZToAOptionMessage(String zToAFilterMessage) {
200+
CdfControlCenterActions.clickOnZToAOptionMessage(zToAFilterMessage);
201201
}
202202

203-
@Then("Verify the entities are sorted by the A to Z option")
204-
public void clickOnAToZOptionMessage() {
205-
CdfControlCenterActions.clickOnAToZOptionMessage();
203+
@Then("Verify the entities are sorted by the A to Z option: {string}")
204+
public void clickOnAToZOptionMessage(String aToZFilterMessage) {
205+
CdfControlCenterActions.clickOnAToZOptionMessage(aToZFilterMessage);
206206
}
207207

208208
@Then("Click on the plus button to add the tag for a dataset entity")
@@ -221,10 +221,13 @@ public void tagCountIncreasesDataset() {
221221
CdfControlCenterActions.tagCountIncreasesDataset();
222222
}
223223

224-
@Then("Click on the close icon of tag added and verify the tag count decreases")
224+
@Then("Click on the close icon of tag added")
225225
public void clickOnCloseIconAndTagCountDecreases() {
226-
CdfControlCenterActions.clickOnCloseIcon(); {
227-
CdfControlCenterActions.tagCountDecreasesDataset();
228-
}
226+
CdfControlCenterActions.clickOnCloseIcon();
227+
}
228+
229+
@Then("Verify the tag count of dataset entity decreases message: {string}")
230+
public void tagCountDecreasesDataset(String tagCountDecreaseMessage) {
231+
CdfControlCenterActions.tagCountDecreasesDataset(tagCountDecreaseMessage);
229232
}
230233
}

0 commit comments

Comments
 (0)