diff --git a/Skalkin/src/test/java/AutorizationTests.java b/Skalkin/src/test/java/AutorizationTests.java new file mode 100644 index 0000000..5f02501 --- /dev/null +++ b/Skalkin/src/test/java/AutorizationTests.java @@ -0,0 +1,60 @@ +import context.ChromeContext; +import context.Context; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import page.*; + +public class AutorizationTests { + private final static String APP_URL = "https://www.kinopoisk.ru/"; + + private static Context context; + + @BeforeAll + public static void setup() { + context = new ChromeContext(); + context.start(); + context.getDriver().manage().window().setSize(new Dimension(1600, 900)); + } + + @AfterAll + public static void quit() { + //context.close(); + } + + + @Test + public void testLoginSocial() throws InterruptedException { + context.getDriver().get(APP_URL);//Открыта страница фильма + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.clickButtonLogin(); + page.switchToCalcFrame(); + page.isButtonVK(); + //Thread.sleep(20000); + + //page.clickButtonVK(); + VKPage pageTo = PageFactory.initElements(context.getDriver(), VKPage.class); + Assertions.assertTrue(pageTo.isUserPresent()); + + } + + @Test + public void testLoginEmail(){ + context.getDriver().get(APP_URL);//Открыта страница фильма + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.clickButtonLogin(); + page.isButtonVK(); + + page.clickButtonVK(); + + Assertions.assertTrue(page.isAutorization()); + + } +} \ No newline at end of file diff --git a/Skalkin/src/test/java/GithubUserSearch.java b/Skalkin/src/test/java/GithubUserSearch.java deleted file mode 100644 index 68e7ddd..0000000 --- a/Skalkin/src/test/java/GithubUserSearch.java +++ /dev/null @@ -1,40 +0,0 @@ -import context.ChromeContext; -import context.Context; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.openqa.selenium.Dimension; -import org.openqa.selenium.support.PageFactory; -import page.SearchPage; - - -public class GithubUserSearch { - private final static String APP_URL = "https://github.com/"; - - private static Context context; - - @BeforeAll - public static void setup() { - context = new ChromeContext(); - context.start(); - context.getDriver().manage().window().setSize(new Dimension(1600, 900)); - } - - @AfterAll - public static void quit() { - context.close(); - } - - @Test - public void testResultPageHeader() { - context.getDriver().get(APP_URL); - String searchString = "romanov73"; - - SearchPage page = PageFactory.initElements(context.getDriver(), SearchPage.class); - page.setSearchString(searchString); - page.clickSubmitButton(); - page.clickUsersLink(); - Assertions.assertTrue(page.isUserPresent()); - } -} diff --git a/Skalkin/src/test/java/NavigationTests.java b/Skalkin/src/test/java/NavigationTests.java new file mode 100644 index 0000000..2b2f3be --- /dev/null +++ b/Skalkin/src/test/java/NavigationTests.java @@ -0,0 +1,125 @@ +import context.ChromeContext; +import context.Context; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.support.PageFactory; +import page.*; + + +public class NavigationTests { + private final static String APP_URL = "https://www.kinopoisk.ru/"; + private final static String APP_URL_MOVIE = "https://www.kinopoisk.ru/film/koma-2018-933208/"; + private final static String APP_URL_ACTOR = "https://www.kinopoisk.ru/name/1189311/"; + + private static Context context; + + @BeforeAll + public static void setup() { + context = new ChromeContext(); + context.start(); + context.getDriver().manage().window().setSize(new Dimension(1600, 900)); + } + + @AfterAll + public static void quit() { + //context.close(); + } + + @Test + public void testSubPageTop() { + context.getDriver().get(APP_URL);//Открыта любая страница сайта, кроме специальных + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + //Выбрать пункт меню + page.clickSubMenu(); + + AfishaPage pageTo = PageFactory.initElements(context.getDriver(), AfishaPage.class); + + Assertions.assertTrue(pageTo.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testLogo() { + context.getDriver().get(APP_URL);//Открыта любая страница сайта, кроме специальных + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.clickLogo(); + + Assertions.assertTrue(page.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testInfoMovie() { + context.getDriver().get(APP_URL_MOVIE);//Открыта страница фильма + + MoviePage page = PageFactory.initElements(context.getDriver(), MoviePage.class);//Выбрать пункт меню + page.clickInfo(); + + ActorPage pageActor = PageFactory.initElements(context.getDriver(), ActorPage.class); + Assertions.assertTrue(pageActor.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testInfoActor() { + context.getDriver().get(APP_URL_ACTOR);//Открыта страница фильма + + ActorPage page = PageFactory.initElements(context.getDriver(), ActorPage.class);//Выбрать пункт меню + page.clickInfo(); + + MoviePage pageActor = PageFactory.initElements(context.getDriver(), MoviePage.class); + Assertions.assertTrue(pageActor.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testDownMenu() { + context.getDriver().get(APP_URL);//Открыта страница фильма + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.clickDownMenu(); + + RandomSearchPage pageSearch = PageFactory.initElements(context.getDriver(), RandomSearchPage.class); + Assertions.assertTrue(pageSearch.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testRightMenu() { + context.getDriver().get(APP_URL);//Открыта страница фильма + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.clickRightMenu(); + + MoviePage pageSearch = PageFactory.initElements(context.getDriver(), MoviePage.class); + Assertions.assertTrue(pageSearch.isUserPresent());//Корректно отображена выбранная страница + } + + @Test + public void testSocialMovieMenu() { + context.getDriver().get(APP_URL_MOVIE);//Открыта страница фильма + + MoviePage page = PageFactory.initElements(context.getDriver(), MoviePage.class);//Выбрать пункт меню + page.clickSocial(); + + page.switchToSocial(); + + VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class); + Assertions.assertTrue(pageVk.isUserPresent()); + + } + + @Test + public void testSocialActorMenu() { + context.getDriver().get(APP_URL_ACTOR);//Открыта страница фильма + + ActorPage page = PageFactory.initElements(context.getDriver(), ActorPage.class);//Выбрать пункт меню + page.clickSocial(); + + page.switchToSocial(); + + VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class); + Assertions.assertTrue(pageVk.isUserPresent()); + + } +} diff --git a/Skalkin/src/test/java/SearchTests.java b/Skalkin/src/test/java/SearchTests.java new file mode 100644 index 0000000..6767273 --- /dev/null +++ b/Skalkin/src/test/java/SearchTests.java @@ -0,0 +1,148 @@ +import context.ChromeContext; +import context.Context; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.support.PageFactory; +import page.*; +import page.search.*; + + +public class SearchTests { + private final static String APP_URL = "https://www.kinopoisk.ru/"; + private final static String APP_URL_SEARCH = "https://www.kinopoisk.ru/s/"; + + private static Context context; + + @BeforeAll + public static void setup() { + context = new ChromeContext(); + context.start(); + context.getDriver().manage().window().setSize(new Dimension(1600, 900)); + } + + @AfterAll + public static void quit() { + //context.close(); + } + + @Test + public void testSimpleSearch() { + context.getDriver().get(APP_URL);//Открыта любая страница сайта, кроме специальных + + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню + page.insertSearch("Кома"); + page.enterSearch(); + + SearchExtendedResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testExtendedSearch() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchExtendedPage page = PageFactory.initElements(context.getDriver(), SearchExtendedPage.class);//Выбрать пункт меню + page.insertNameSearch("Кома"); + page.openCountry(); + page.clickCountry(); + page.enterSearch(); + + SearchExtendedResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchByCreators() throws InterruptedException { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchByCreatorsPage page = PageFactory.initElements(context.getDriver(), SearchByCreatorsPage.class);//Выбрать пункт меню + page.insertNameSearch("Безруков"); + Thread.sleep(2000); + page.clickDown(); + page.clickEnter(); + Thread.sleep(500); + page.enterSearch(); + + SearchByCreatorsResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchByCreatorsResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchByPeople() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchByPeoplePage page = PageFactory.initElements(context.getDriver(), SearchByPeoplePage.class);//Выбрать пункт меню + page.insertNameSearch("Безруков"); + page.enterSearch(); + + SearchExtendedResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchInText() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchInTextPage page = PageFactory.initElements(context.getDriver(), SearchInTextPage.class);//Выбрать пункт меню + page.insertNameSearch("Веном"); + page.enterSearch(); + + SearchInTextResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchInTextResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchByUsers() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchByUsersPage page = PageFactory.initElements(context.getDriver(), SearchByUsersPage.class);//Выбрать пункт меню + page.insertNameSearch("Антон"); + page.enterSearch(); + + SearchExtendedResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchByKeyword() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchByKeywordPage page = PageFactory.initElements(context.getDriver(), SearchByKeywordPage.class);//Выбрать пункт меню + page.insertNameSearch("Война"); + page.enterSearch(); + + SearchByKeywordResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchByKeywordResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchMovieByWord() throws InterruptedException { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchMovieByWordPage page = PageFactory.initElements(context.getDriver(), SearchMovieByWordPage.class);//Выбрать пункт меню + page.insertNameSearch("Магия"); + page.clickDown(); + page.clickDown(); + page.clickEnter(); + //Thread.sleep(500); + page.enterSearch(); + + SearchByCreatorsResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchByCreatorsResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } + + @Test + public void testSearchByStudio() { + context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных + + SearchByStudioPage page = PageFactory.initElements(context.getDriver(), SearchByStudioPage.class);//Выбрать пункт меню + page.insertNameSearch("Disney"); + page.enterSearch(); + + SearchByKeywordResultPage pageTo = PageFactory.initElements(context.getDriver(), SearchByKeywordResultPage.class);//Корректно отображена выбранная страница + Assertions.assertTrue(pageTo.isUserPresent()); + } +} diff --git a/Skalkin/src/test/java/context/ChromeContext.java b/Skalkin/src/test/java/context/ChromeContext.java index 05d9cde..aa8c420 100644 --- a/Skalkin/src/test/java/context/ChromeContext.java +++ b/Skalkin/src/test/java/context/ChromeContext.java @@ -1,6 +1,7 @@ package context; import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.firefox.FirefoxDriver; public class ChromeContext extends Context { private final static String WINDOWS_DRIVER = "chromedriver.exe"; diff --git a/Skalkin/src/test/java/page/ActorPage.java b/Skalkin/src/test/java/page/ActorPage.java new file mode 100644 index 0000000..6ebd4a1 --- /dev/null +++ b/Skalkin/src/test/java/page/ActorPage.java @@ -0,0 +1,40 @@ +package page; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class ActorPage { + WebDriver driver; + + @FindBy(css = "#BestFilmList a") + private WebElement infoElement; + + @FindBy(css = ".ya-share2__list a") + private WebElement socialElement; + + public void clickInfo() { + infoElement.click(); + + } + + public void clickSocial() { + socialElement.click(); + + } + + public void switchToSocial(){ + + for (String winHandle : driver.getWindowHandles()) { + driver.switchTo().window(winHandle); + } + } + + public ActorPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return infoElement.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/AfishaPage.java b/Skalkin/src/test/java/page/AfishaPage.java new file mode 100644 index 0000000..7faff7f --- /dev/null +++ b/Skalkin/src/test/java/page/AfishaPage.java @@ -0,0 +1,23 @@ +package page; + +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.FindBy; + +public class AfishaPage { + WebDriver driver; + + @FindBy(css = ".tableTopViewSeansMain") + private WebElement topElement; + + public AfishaPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return topElement.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/MainPage.java b/Skalkin/src/test/java/page/MainPage.java new file mode 100644 index 0000000..c143a05 --- /dev/null +++ b/Skalkin/src/test/java/page/MainPage.java @@ -0,0 +1,124 @@ +package page; + +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import java.util.concurrent.TimeUnit; + +public class MainPage { + WebDriver driver; + + @FindBy(css = ".kp-logo-partial-component") + private WebElement logoElement; + + @FindBy(css = ".header-fresh-dropdown-partial-component__sidebar-link") + private WebElement menuElement; + + @FindBy(css = ".header-fresh-partial-component__navigation-item") + private WebElement mainElement; + + @FindBy(css = "#partial_component__footer a") + private WebElement downMenuElement; + + @FindBy(css = "#rigth_box_weekend_rus dd a") + private WebElement rightMenuElement; + + @FindBy(css = ".header-fresh-search-partial-component__field") + private WebElement searchElement; + + @FindBy(id = "top_3banners") + private WebElement topBaners; + + @FindBy(css = ".header-fresh-user-partial-component__login-button") + private WebElement buttonLogin; + + @FindBy(css = ".social-auth__item.social-auth__item_code_vk") + private WebElement buttonVK; + + @FindBy(css = ".header-fresh-user-partial-component__button.header-fresh-user-partial-component__button_selected") + private WebElement elementAvatar; + + public MainPage(WebDriver driver) { + this.driver = driver; + //this.driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); + } + + public void clickSubMenu() { + Actions builder = new Actions(driver); + builder.moveToElement(mainElement).perform(); + + menuElement.sendKeys(Keys.RETURN); + + + //menuElement.click(); + } + + public void clickLogo() { + logoElement.click(); + } + + public void clickDownMenu() { + downMenuElement.click(); + } + + public void clickRightMenu() { + rightMenuElement.click(); + } + + public void insertSearch(String str) { + searchElement.sendKeys(str); + } + + public void enterSearch() { + searchElement.sendKeys(Keys.ENTER); + } + + public void clickButtonLogin() { + buttonLogin.click(); + } + + public void clickButtonVK() { + buttonVK.click(); + } + + public void isButtonVK() { +// WebElement dynamicElement = (new WebDriverWait(driver, 30)) +// .until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".social-auth__item.social-auth__item_code_vk"))); +// dynamicElement.click(); + + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + driver.findElement(By.cssSelector(".social-auth__item_code_vk")).click(); + //dynamicElement.click(); + } + + @FindBy(css = ".kp2-authapi-iframe") + private WebElement signInFrame; + + + public void switchToCalcFrame(){ + driver.switchTo().frame(signInFrame); + driver.switchTo().frame(null); + + } + + + + public boolean isUserPresent() { + return topBaners.isDisplayed(); + } + + public boolean isAutorization() { + return elementAvatar.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/MoviePage.java b/Skalkin/src/test/java/page/MoviePage.java new file mode 100644 index 0000000..d19881b --- /dev/null +++ b/Skalkin/src/test/java/page/MoviePage.java @@ -0,0 +1,41 @@ +package page; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class MoviePage { + WebDriver driver; + + @FindBy(css = "#actorList a") + private WebElement infoElement; + + @FindBy(css = ".ya-share2__list a") + private WebElement socialElement; + + public void clickInfo() { + infoElement.click(); + + } + + public void clickSocial() { + socialElement.click(); + + } + + public void switchToSocial(){ + + for (String winHandle : driver.getWindowHandles()) { + driver.switchTo().window(winHandle); + } + } + + + public MoviePage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return infoElement.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/RandomSearchPage.java b/Skalkin/src/test/java/page/RandomSearchPage.java new file mode 100644 index 0000000..2b0a766 --- /dev/null +++ b/Skalkin/src/test/java/page/RandomSearchPage.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 RandomSearchPage { + WebDriver driver; + + @FindBy(css = ".randomMovie") + private WebElement element; + + public RandomSearchPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/SearchPage.java b/Skalkin/src/test/java/page/SearchPage.java deleted file mode 100644 index 87f5b38..0000000 --- a/Skalkin/src/test/java/page/SearchPage.java +++ /dev/null @@ -1,38 +0,0 @@ -package page; - -import org.openqa.selenium.By; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; - -public class SearchPage { - WebDriver driver; - - @FindBy(css = "input.header-search-input") - private WebElement inputField; - - @FindBy(xpath = "//*[@class='menu border']/a[7]") - private WebElement usersLink; - - public SearchPage(WebDriver driver) { - this.driver = driver; - } - - public SearchPage setSearchString(String text) { - inputField.sendKeys(text); - return this; - } - - public void clickSubmitButton() { - inputField.sendKeys(Keys.RETURN); - } - - public void clickUsersLink() { - usersLink.click(); - } - - public boolean isUserPresent() { - return driver.findElement(By.cssSelector(".user-list-info")).isDisplayed(); - } -} diff --git a/Skalkin/src/test/java/page/VKPage.java b/Skalkin/src/test/java/page/VKPage.java new file mode 100644 index 0000000..0da8f4b --- /dev/null +++ b/Skalkin/src/test/java/page/VKPage.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 VKPage { + WebDriver driver; + + @FindBy(id = "login_submit") + private WebElement element; + + public VKPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchByCreatorsPage.java b/Skalkin/src/test/java/page/search/SearchByCreatorsPage.java new file mode 100644 index 0000000..91a4c07 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByCreatorsPage.java @@ -0,0 +1,42 @@ +package page.search; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import java.util.List; + +public class SearchByCreatorsPage { + WebDriver driver; + + @FindBy(id = "btn_search_6") + private WebElement buttonElement; + + @FindBy(id = "cr_search_field_1") + private WebElement nameElement; + + public SearchByCreatorsPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void clickDown() { + nameElement.sendKeys(Keys.ARROW_DOWN); + } + + public void clickEnter() { + nameElement.sendKeys(Keys.ENTER); + } + + public void enterSearch() { + buttonElement.click(); + } + +// public boolean isUserPresent() { +// return topBaners.isDisplayed(); +// } +} diff --git a/Skalkin/src/test/java/page/search/SearchByCreatorsResultPage.java b/Skalkin/src/test/java/page/search/SearchByCreatorsResultPage.java new file mode 100644 index 0000000..2f64bed --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByCreatorsResultPage.java @@ -0,0 +1,20 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByCreatorsResultPage { + WebDriver driver; + + @FindBy(css = ".search_adv") + private WebElement element; + + public SearchByCreatorsResultPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchByKeywordPage.java b/Skalkin/src/test/java/page/search/SearchByKeywordPage.java new file mode 100644 index 0000000..7f5c343 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByKeywordPage.java @@ -0,0 +1,28 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByKeywordPage { + WebDriver driver; + + @FindBy(css = "#keyword_search .submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "find_keyword") + private WebElement nameElement; + + public SearchByKeywordPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void enterSearch() { + buttonElement.click(); + } + +} diff --git a/Skalkin/src/test/java/page/search/SearchByKeywordResultPage.java b/Skalkin/src/test/java/page/search/SearchByKeywordResultPage.java new file mode 100644 index 0000000..eae8b53 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByKeywordResultPage.java @@ -0,0 +1,20 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByKeywordResultPage { + WebDriver driver; + + @FindBy(css = ".news") + private WebElement element; + + public SearchByKeywordResultPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchByPeoplePage.java b/Skalkin/src/test/java/page/search/SearchByPeoplePage.java new file mode 100644 index 0000000..a538e01 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByPeoplePage.java @@ -0,0 +1,32 @@ +package page.search; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByPeoplePage { + WebDriver driver; + + @FindBy(css = ".el_8.submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "find_people") + private WebElement nameElement; + + public SearchByPeoplePage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void enterSearch() { + buttonElement.click(); + } + +// public boolean isUserPresent() { +// return topBaners.isDisplayed(); +// } +} diff --git a/Skalkin/src/test/java/page/search/SearchByStudioPage.java b/Skalkin/src/test/java/page/search/SearchByStudioPage.java new file mode 100644 index 0000000..fd72b55 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByStudioPage.java @@ -0,0 +1,28 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByStudioPage { + WebDriver driver; + + @FindBy(css = "#studio_search .submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "find_studio") + private WebElement nameElement; + + public SearchByStudioPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void enterSearch() { + buttonElement.click(); + } + +} diff --git a/Skalkin/src/test/java/page/search/SearchByUsersPage.java b/Skalkin/src/test/java/page/search/SearchByUsersPage.java new file mode 100644 index 0000000..09e71a8 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByUsersPage.java @@ -0,0 +1,28 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByUsersPage { + WebDriver driver; + + @FindBy(css = ".el_9.submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "name") + private WebElement nameElement; + + public SearchByUsersPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void enterSearch() { + buttonElement.click(); + } + +} diff --git a/Skalkin/src/test/java/page/search/SearchByUsersResultPage.java b/Skalkin/src/test/java/page/search/SearchByUsersResultPage.java new file mode 100644 index 0000000..0c1a87e --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchByUsersResultPage.java @@ -0,0 +1,20 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchByUsersResultPage { + WebDriver driver; + + @FindBy(id = "profileInfoWrap") + private WebElement element; + + public SearchByUsersResultPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchExtendedPage.java b/Skalkin/src/test/java/page/search/SearchExtendedPage.java new file mode 100644 index 0000000..6371323 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchExtendedPage.java @@ -0,0 +1,49 @@ +package page.search; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.FindBy; + +import java.util.List; + +public class SearchExtendedPage { + WebDriver driver; + + @FindBy(css = ".el_18.submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "find_film") + private WebElement nameElement; + + @FindBy(id = "country") + private WebElement countryElement; + + @FindBy(css = "#country option") + private List countryToElement; + + public SearchExtendedPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void openCountry() { + countryElement.click(); + } + + public void clickCountry() { + countryToElement.get(1).click(); + } + + public void enterSearch() { + buttonElement.click(); + } + +// public boolean isUserPresent() { +// return topBaners.isDisplayed(); +// } +} diff --git a/Skalkin/src/test/java/page/search/SearchExtendedResultPage.java b/Skalkin/src/test/java/page/search/SearchExtendedResultPage.java new file mode 100644 index 0000000..5e94e10 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchExtendedResultPage.java @@ -0,0 +1,20 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchExtendedResultPage { + WebDriver driver; + + @FindBy(css = ".search_results_top") + private WebElement element; + + public SearchExtendedResultPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchInTextPage.java b/Skalkin/src/test/java/page/search/SearchInTextPage.java new file mode 100644 index 0000000..5ed41d1 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchInTextPage.java @@ -0,0 +1,28 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchInTextPage { + WebDriver driver; + + @FindBy(css = ".el_12.submit.nice_button") + private WebElement buttonElement; + + @FindBy(id = "txt_search_input") + private WebElement nameElement; + + public SearchInTextPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void enterSearch() { + buttonElement.click(); + } + +} diff --git a/Skalkin/src/test/java/page/search/SearchInTextResultPage.java b/Skalkin/src/test/java/page/search/SearchInTextResultPage.java new file mode 100644 index 0000000..7518223 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchInTextResultPage.java @@ -0,0 +1,20 @@ +package page.search; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchInTextResultPage { + WebDriver driver; + + @FindBy(css = ".textorangebig") + private WebElement element; + + public SearchInTextResultPage(WebDriver driver) { + this.driver = driver; + } + + public boolean isUserPresent() { + return element.isDisplayed(); + } +} diff --git a/Skalkin/src/test/java/page/search/SearchMovieByWordPage.java b/Skalkin/src/test/java/page/search/SearchMovieByWordPage.java new file mode 100644 index 0000000..f7be826 --- /dev/null +++ b/Skalkin/src/test/java/page/search/SearchMovieByWordPage.java @@ -0,0 +1,37 @@ +package page.search; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class SearchMovieByWordPage { + WebDriver driver; + + @FindBy(id = "search_button") + private WebElement buttonElement; + + @FindBy(id = "search_field_1") + private WebElement nameElement; + + public SearchMovieByWordPage(WebDriver driver) { + this.driver = driver; + } + + public void insertNameSearch(String str) { + nameElement.sendKeys(str); + } + + public void clickDown() { + nameElement.sendKeys(Keys.ARROW_DOWN); + } + + public void clickEnter() { + nameElement.sendKeys(Keys.ENTER); + } + + public void enterSearch() { + buttonElement.click(); + } + +}