Conversation
|
@SvNov fix spaces and tabs/whitespace characters - no more that one empty line or one tabs/whitespace between elements |
|
@SvNov Don't name variables as |
| { | ||
| class CreateSavedSearchPageTest : BaseTest | ||
| { | ||
| private LoginPage objLoginPage; |
There was a problem hiding this comment.
this method can be simplified if you use parameterized selector:
create method that returns selector for list view item by its name:
private By ListViewItem(string itemName) => By.Xpath($"//span[contains(@class,'lvName-span')][@title='{itemName}']");
then here:
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15));
wait.Until(x => driver.FindElement(ListViewItem(criteria));
)
you can either make this method void - it will throw exception if item is not found - or wrap it into try catch and return true/false (and make assert statement in test)
| objSearchResultsPage = new SearchResultsPage(driver, waiter); | ||
|
|
||
| // performs simple search | ||
| objSearchResultsPage.Search("4819-5337-4080"); |
There was a problem hiding this comment.
test data (strings, ids names etc) needs to be moved out into test class fields with meaningful name. Therefore we can quickly see what hard coded test data test depends on.
| objCreateSavedSearchPage = new CreateSavedSearchPage(driver, waiter); | ||
| objCreateSavedSearchPage.ClickOnContainerOptionsButton(); | ||
|
|
||
| //var docName = objSearchResultsPage.GetSearchResultDocumentName("4819-5337-4080"); |
| private readonly By locator = By.Id("containerOptionsButton"); | ||
| private readonly By okButton = By.Name("okButton"); | ||
|
|
||
| public IWebElement ContainerOptionsButton => |
There was a problem hiding this comment.
you either define Selectors (By) and then find elements in your methods. Or you define web elements (IWebElement) adn use those in your methods but not both - it's unnecessary complication.
| { | ||
| var search = waiter.Until(SeleniumExtras.WaitHelpers | ||
| .ExpectedConditions | ||
| .ElementToBeClickable(By.Id("nd-hsCriteria-input"))); |
| { | ||
| var documentRow = waiter.Until(SeleniumExtras.WaitHelpers | ||
| .ExpectedConditions | ||
| .ElementIsVisible(By.ClassName("id_"+ searchText))); |
There was a problem hiding this comment.
hardcoded selector - change it to parameterized selector:
private By ListViewItem(string itemName) => By.Xpath($"//span[contains(@class,'lvName-span')][@title='{itemName}']");
then here:
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15));
wait.Until(x => driver.FindElement(ListViewItem(criteria));
)
| executeSearch.Click(); | ||
| } | ||
|
|
||
| public string GetSearchResultDocumentName(string searchText) |
There was a problem hiding this comment.
method signature doesn't make sense - you are getting document name by giving this method document name?
change it public bool IsListViewItemDisplayed(string documentName)
|
|
||
| } | ||
|
|
||
| public void ClickOnContainerOptionsButton() |
There was a problem hiding this comment.
change this method to accept string with option name that you need to click
|
|
||
| objCreateSavedSearchPage.ClickSaveSearchSubMenu(); | ||
| objCreateSavedSearchPage.ClickOnOkButton(); | ||
| objCreateSavedSearchPage.WaitSaveSearchPage(); |
There was a problem hiding this comment.
this has to be Assert.IsTrue(UI.SearchResultsPage.IsListViewItemDisplayed(savedSearchName);
|
@SvNov Create separate Create |
|
another change to add (from our Skype conversation):
|
No description provided.