control center framework steps phase2#232
control center framework steps phase2#232priyabhatnagar25 wants to merge 2 commits intocdapio:developfrom
Conversation
| static { | ||
| cdfNameSpaceAdminLocators = SeleniumHelper.getPropertiesLocators( | ||
| CdfControlCenterLocators.class); | ||
| } |
There was a problem hiding this comment.
Why do we need a static block here ? Could it not be a simple initialization ?
public static CdfControlCenterLocators cdfNameSpaceAdminLocators =
SeleniumHelper.getPropertiesLocators(CdfControlCenterLocators.class);There was a problem hiding this comment.
Hi, I changed it to as above.
| @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; |
There was a problem hiding this comment.
do not use data-cy to locate elements. Use data-testid instead. If data-testid is not present for an element, please add it in cdap-ui.
There was a problem hiding this comment.
I have changed it for 31 and 34 lines , but for 37 that is the only locator available so used as it is and for adding in cdap-ui the development team has to be informed.
| @FindBy(how = How.XPATH, using = "//span[@class='entity-type'][//span[contains(text(),'Data Pipeline')]]") | ||
| public static WebElement dataPipelineControlCenter; |
There was a problem hiding this comment.
do not locate elements using text. Especially in framework codebase. If the copy changes, all of the tests using this locator will start failing, which is not desirable.
There was a problem hiding this comment.
Changed it to div class locator.Please verify the same in the latest commit.
| 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']"); | ||
| } |
There was a problem hiding this comment.
do not use data-cy, use data-testid instead.
There was a problem hiding this comment.
I have used data-testid for both.
| @FindBy(how = How.XPATH, using = "//input[@class='search-input form-control'][@placeholder='Search']") | ||
| public static WebElement searchTabControlCenter; |
There was a problem hiding this comment.
do not locate elements using placeholder text.
There was a problem hiding this comment.
Removed the placeholder from here.
| @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; |
There was a problem hiding this comment.
do not locate elements using text content.
There was a problem hiding this comment.
Changed the locator for all of them.
| public static WebElement selectSortDropdownValue(String option) { | ||
| return SeleniumDriver.getDriver().findElement(By.xpath("//*[contains(text(),'" + option + "')]")); | ||
| } |
There was a problem hiding this comment.
do not locate elements using text content.
There was a problem hiding this comment.
This also dont have any data-testid , so we need to use this to choose the option for sorting
| @FindBy(how = How.XPATH, using = "//*[contains(text(),'Tags (1)')]") | ||
| public static WebElement tagCountIconIncreaseDatasetEntity; |
There was a problem hiding this comment.
do not locate elements using text content.
There was a problem hiding this comment.
Here we are adding the tags , when we are adding it changes to 1 and so on. Its dynamic so we are using above, we dont have anything for this also.
| @FindBy(how = How.XPATH, using = "//i[normalize-space()='No tags found. Click to add a new business tag.']") | ||
| public static WebElement tagCounDecreaseIconDatasetEntityMessage; | ||
|
|
||
| @FindBy(how = How.XPATH, using = "//span[contains(text(),'Search results for \"testingtag\", filtered by Appli')]") | ||
| public static WebElement searchedTagShowsDisplayedMessage; |
There was a problem hiding this comment.
do not locate elements using text content.
There was a problem hiding this comment.
Changed the above both.
| public static void clickOnSearchTagControlCenter(String searchedText) { | ||
| ElementHelper.sendKeys(CdfControlCenterLocators.searchTabControlCenter, searchedText); | ||
| ElementHelper.clickOnElement(CdfControlCenterLocators.searchTabControlCenter); | ||
| } |
There was a problem hiding this comment.
rename this method to make it clear what it does. probably to enterTextInSearchBarInControlCenter
There was a problem hiding this comment.
Renamed it to above .
b9eabdf to
1c08384
Compare
6504d54 to
c63b278
Compare
No description provided.