Исправлены замечания
This commit is contained in:
parent
f7ab019a6e
commit
594b41c402
@ -34,7 +34,7 @@ public class FilterTests {
|
||||
page.insertSearchText("Древние");
|
||||
page.insertEnterSearchText();
|
||||
SearchPage pageAn = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
Assertions.assertTrue(pageAn.isSearchPresent());
|
||||
Assertions.assertTrue(pageAn.isSearchPresent("Древние"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -46,44 +46,49 @@ public class NavigationTests {
|
||||
public void testRating() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getRating();
|
||||
page.clickRating();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent());
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYear() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getYear();
|
||||
page.clickYear();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent());
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountry() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getCountry();
|
||||
page.clickCountry();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent());
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenre() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getGenre();
|
||||
page.clickGenre();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent());
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMenu() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getElementMenu();
|
||||
page.clickMenu();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent());
|
||||
Assertions.assertTrue(pageAn.isPagePresent(str));
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,26 @@ public class MainPage {
|
||||
menuElement.click();
|
||||
}
|
||||
|
||||
public String getRating(){
|
||||
return ratingElement.getText();
|
||||
}
|
||||
|
||||
public String getYear(){
|
||||
return yearElement.getText();
|
||||
}
|
||||
|
||||
public String getCountry(){
|
||||
return countryElement.getText();
|
||||
}
|
||||
|
||||
public String getGenre(){
|
||||
return genreElement.getText();
|
||||
}
|
||||
|
||||
public String getElementMenu(){
|
||||
return menuElement.getText();
|
||||
}
|
||||
|
||||
public boolean isFilterPresent() {
|
||||
return filterElement.isDisplayed();
|
||||
}
|
||||
|
@ -7,14 +7,18 @@ import org.openqa.selenium.support.FindBy;
|
||||
public class NavFilterPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "dle-content")
|
||||
private WebElement contentElement;
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[2]/h1")
|
||||
private WebElement title;
|
||||
|
||||
public NavFilterPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isContentPresent() {
|
||||
return contentElement.isDisplayed();
|
||||
public boolean isPagePresent(String str) {
|
||||
return driver.getTitle().toUpperCase().contains(str.toUpperCase());
|
||||
}
|
||||
|
||||
public boolean isContentPresent(String str) {
|
||||
return title.getText().toUpperCase().contains(str.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import org.openqa.selenium.support.FindBy;
|
||||
public class SearchPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".res-search")
|
||||
@FindBy(xpath = "//*[@id=\"serials\"]/div/div[2]/div[1]")
|
||||
private WebElement searchElement;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isSearchPresent() {
|
||||
return searchElement.isDisplayed();
|
||||
public boolean isSearchPresent(String str) {
|
||||
return searchElement.getText().contains(str);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user