Исправлен поиск
This commit is contained in:
parent
594b41c402
commit
658e827bc6
@ -31,10 +31,10 @@ public class FilterTests {
|
|||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||||
page.clickSearchButton();
|
page.clickSearchButton();
|
||||||
page.insertSearchText("Древние");
|
page.insertSearchText("Супердевушка");
|
||||||
page.insertEnterSearchText();
|
page.insertEnterSearchText();
|
||||||
SearchPage pageAn = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
SearchPage pageAn = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||||
Assertions.assertTrue(pageAn.isSearchPresent("Древние"));
|
Assertions.assertTrue(pageAn.isListSearchPresent("Супердевушка"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -4,12 +4,17 @@ import org.openqa.selenium.WebDriver;
|
|||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SearchPage {
|
public class SearchPage {
|
||||||
WebDriver driver;
|
WebDriver driver;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"serials\"]/div/div[2]/div[1]")
|
@FindBy(xpath = "//*[@id=\"serials\"]/div/div[2]/div[1]")
|
||||||
private WebElement searchElement;
|
private WebElement searchElement;
|
||||||
|
|
||||||
|
@FindBy(css = ".post-title")
|
||||||
|
private List<WebElement> listSearchElement;
|
||||||
|
|
||||||
public SearchPage(WebDriver driver) {
|
public SearchPage(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
@ -17,4 +22,14 @@ public class SearchPage {
|
|||||||
public boolean isSearchPresent(String str) {
|
public boolean isSearchPresent(String str) {
|
||||||
return searchElement.getText().contains(str);
|
return searchElement.getText().contains(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isListSearchPresent(String str) {
|
||||||
|
boolean bl=true;
|
||||||
|
for(int i=0; i<listSearchElement.size();i++){
|
||||||
|
if(bl && !listSearchElement.get(i).getText().toLowerCase().contains(str.toLowerCase())){
|
||||||
|
bl=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user