Stroeva #7

Closed
StroevaJ wants to merge 6 commits from Stroeva into master
4 changed files with 136 additions and 0 deletions
Showing only changes of commit 8691d3e1b2 - Show all commits

View File

@ -32,4 +32,58 @@ public class NavigationTests {
page.clickLogo(); page.clickLogo();
Assertions.assertTrue(page.isUserPresent()); Assertions.assertTrue(page.isUserPresent());
} }
@Test
public void testFooter() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickFooter();
HolderPage pageAn = PageFactory.initElements(context.getDriver(), HolderPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
@Test
public void testRating() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickRating();
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
@Test
public void testYear() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickYear();
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
@Test
public void testCountry() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickCountry();
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
@Test
public void testGenre() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickGenre();
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
@Test
public void testMenu() {
context.getDriver().get(APP_URL);
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
page.clickMenu();
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
Assertions.assertTrue(pageAn.isUserPresent());
}
} }

View File

@ -0,0 +1,20 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class FilterPage {
WebDriver driver;
@FindBy(id = "dle-content")
private WebElement ratingElement;
public FilterPage(WebDriver driver) {
this.driver = driver;
}
public boolean isUserPresent() {
return ratingElement.isDisplayed();
}
}

View File

@ -0,0 +1,20 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class HolderPage {
WebDriver driver;
@FindBy(css = ".holder")
private WebElement holderElement;
public HolderPage(WebDriver driver) {
this.driver = driver;
}
public boolean isUserPresent() {
return holderElement.isDisplayed();
}
}

View File

@ -21,6 +21,24 @@ public class MainPage {
@FindBy(css = ".nav-filter") @FindBy(css = ".nav-filter")
private WebElement filterElement; private WebElement filterElement;
@FindBy(css = ".footer-nav")
private WebElement footerElement;
@FindBy(xpath = "//a[@href='/top/']")
private WebElement ratingElement;
@FindBy(xpath = "//a[@href='/filmy_2018/']")
private WebElement yearElement;
@FindBy(xpath = "//a[@href='/britain/']")
private WebElement countryElement;
@FindBy(xpath = "//a[@href='/horror/']")
private WebElement genreElement;
@FindBy(xpath = "//a[@href='/serials/']")
private WebElement menuElement;
public MainPage(WebDriver driver) { public MainPage(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
@ -29,6 +47,30 @@ public class MainPage {
logoElement.click(); logoElement.click();
} }
public void clickFooter() {
footerElement.click();
}
public void clickRating() {
ratingElement.click();
}
public void clickYear() {
yearElement.click();
}
public void clickCountry() {
countryElement.click();
}
public void clickGenre() {
genreElement.click();
}
public void clickMenu() {
menuElement.click();
}
public boolean isUserPresent() { public boolean isUserPresent() {
return filterElement.isDisplayed(); return filterElement.isDisplayed();
} }