From 8691d3e1b27e07914a9cac1c9e33974d4072c45b Mon Sep 17 00:00:00 2001 From: StroevaJ Date: Sun, 6 May 2018 16:48:31 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=20test=20s?= =?UTF-8?q?uite=20=D0=9D=D0=B0=D0=B2=D0=B8=D0=B3=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Stroeva/src/test/java/NavigationTests.java | 54 ++++++++++++++++++++++ Stroeva/src/test/java/page/FilterPage.java | 20 ++++++++ Stroeva/src/test/java/page/HolderPage.java | 20 ++++++++ Stroeva/src/test/java/page/MainPage.java | 42 +++++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 Stroeva/src/test/java/page/FilterPage.java create mode 100644 Stroeva/src/test/java/page/HolderPage.java diff --git a/Stroeva/src/test/java/NavigationTests.java b/Stroeva/src/test/java/NavigationTests.java index 6d9bbd9..04eb4cf 100644 --- a/Stroeva/src/test/java/NavigationTests.java +++ b/Stroeva/src/test/java/NavigationTests.java @@ -32,4 +32,58 @@ public class NavigationTests { page.clickLogo(); 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()); + } } diff --git a/Stroeva/src/test/java/page/FilterPage.java b/Stroeva/src/test/java/page/FilterPage.java new file mode 100644 index 0000000..e1bea9b --- /dev/null +++ b/Stroeva/src/test/java/page/FilterPage.java @@ -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(); + } +} diff --git a/Stroeva/src/test/java/page/HolderPage.java b/Stroeva/src/test/java/page/HolderPage.java new file mode 100644 index 0000000..e2b5d51 --- /dev/null +++ b/Stroeva/src/test/java/page/HolderPage.java @@ -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(); + } +} diff --git a/Stroeva/src/test/java/page/MainPage.java b/Stroeva/src/test/java/page/MainPage.java index 9d04b22..2761e52 100644 --- a/Stroeva/src/test/java/page/MainPage.java +++ b/Stroeva/src/test/java/page/MainPage.java @@ -21,6 +21,24 @@ public class MainPage { @FindBy(css = ".nav-filter") 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) { this.driver = driver; } @@ -29,6 +47,30 @@ public class MainPage { 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() { return filterElement.isDisplayed(); }