Сделана большая часть работы. Закончены навигация и поиск. Осталась авторизация
This commit is contained in:
parent
673fb05473
commit
5d0024dc22
60
Skalkin/src/test/java/AutorizationTests.java
Normal file
60
Skalkin/src/test/java/AutorizationTests.java
Normal file
@ -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());
|
||||
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
125
Skalkin/src/test/java/NavigationTests.java
Normal file
125
Skalkin/src/test/java/NavigationTests.java
Normal file
@ -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());
|
||||
|
||||
}
|
||||
}
|
148
Skalkin/src/test/java/SearchTests.java
Normal file
148
Skalkin/src/test/java/SearchTests.java
Normal file
@ -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());
|
||||
}
|
||||
}
|
@ -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";
|
||||
|
40
Skalkin/src/test/java/page/ActorPage.java
Normal file
40
Skalkin/src/test/java/page/ActorPage.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
23
Skalkin/src/test/java/page/AfishaPage.java
Normal file
23
Skalkin/src/test/java/page/AfishaPage.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
124
Skalkin/src/test/java/page/MainPage.java
Normal file
124
Skalkin/src/test/java/page/MainPage.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
41
Skalkin/src/test/java/page/MoviePage.java
Normal file
41
Skalkin/src/test/java/page/MoviePage.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
20
Skalkin/src/test/java/page/RandomSearchPage.java
Normal file
20
Skalkin/src/test/java/page/RandomSearchPage.java
Normal 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 RandomSearchPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".randomMovie")
|
||||
private WebElement element;
|
||||
|
||||
public RandomSearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return element.isDisplayed();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
20
Skalkin/src/test/java/page/VKPage.java
Normal file
20
Skalkin/src/test/java/page/VKPage.java
Normal 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 VKPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "login_submit")
|
||||
private WebElement element;
|
||||
|
||||
public VKPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return element.isDisplayed();
|
||||
}
|
||||
}
|
42
Skalkin/src/test/java/page/search/SearchByCreatorsPage.java
Normal file
42
Skalkin/src/test/java/page/search/SearchByCreatorsPage.java
Normal file
@ -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();
|
||||
// }
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
28
Skalkin/src/test/java/page/search/SearchByKeywordPage.java
Normal file
28
Skalkin/src/test/java/page/search/SearchByKeywordPage.java
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
32
Skalkin/src/test/java/page/search/SearchByPeoplePage.java
Normal file
32
Skalkin/src/test/java/page/search/SearchByPeoplePage.java
Normal file
@ -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();
|
||||
// }
|
||||
}
|
28
Skalkin/src/test/java/page/search/SearchByStudioPage.java
Normal file
28
Skalkin/src/test/java/page/search/SearchByStudioPage.java
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
28
Skalkin/src/test/java/page/search/SearchByUsersPage.java
Normal file
28
Skalkin/src/test/java/page/search/SearchByUsersPage.java
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
49
Skalkin/src/test/java/page/search/SearchExtendedPage.java
Normal file
49
Skalkin/src/test/java/page/search/SearchExtendedPage.java
Normal file
@ -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<WebElement> 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();
|
||||
// }
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
28
Skalkin/src/test/java/page/search/SearchInTextPage.java
Normal file
28
Skalkin/src/test/java/page/search/SearchInTextPage.java
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
37
Skalkin/src/test/java/page/search/SearchMovieByWordPage.java
Normal file
37
Skalkin/src/test/java/page/search/SearchMovieByWordPage.java
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user