Skalkin #6
156
Skalkin/.gitignore
vendored
Normal file
156
Skalkin/.gitignore
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/intellij,java,maven,gradle,eclipse,netbeans
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
|
||||
*.iml
|
||||
nb-configuration.xml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
.target
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
# .idea/shelf
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
|
||||
|
||||
### Gradle ###
|
||||
.gradle
|
||||
build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
nbactions.xml
|
||||
.nb-gradle/
|
||||
|
||||
*.log
|
||||
|
||||
csv/
|
2
Skalkin/README.md
Normal file
2
Skalkin/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
Selenium WebDriver example project
|
||||
|
49
Skalkin/pom.xml
Normal file
49
Skalkin/pom.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>tis-2017</groupId>
|
||||
<artifactId>tis-2017</artifactId>
|
||||
<version>1.0</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.1.0-RC1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<index>true</index>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
<mainClass>ru.ulstu.tis.Main</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Class-Path>lib/</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
8
Skalkin/src/main/java/ru/ulstu/tis/Main.java
Normal file
8
Skalkin/src/main/java/ru/ulstu/tis/Main.java
Normal file
@ -0,0 +1,8 @@
|
||||
package ru.ulstu.tis;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("666");
|
||||
}
|
||||
}
|
BIN
Skalkin/src/main/resources/drivers/chromedriver
Normal file
BIN
Skalkin/src/main/resources/drivers/chromedriver
Normal file
Binary file not shown.
BIN
Skalkin/src/main/resources/drivers/chromedriver.exe
Normal file
BIN
Skalkin/src/main/resources/drivers/chromedriver.exe
Normal file
Binary file not shown.
BIN
Skalkin/src/main/resources/drivers/geckodriver
Normal file
BIN
Skalkin/src/main/resources/drivers/geckodriver
Normal file
Binary file not shown.
BIN
Skalkin/src/main/resources/drivers/geckodriver.exe
Normal file
BIN
Skalkin/src/main/resources/drivers/geckodriver.exe
Normal file
Binary file not shown.
76
Skalkin/src/test/java/AutorizationTests.java
Normal file
76
Skalkin/src/test/java/AutorizationTests.java
Normal file
@ -0,0 +1,76 @@
|
||||
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 AutorizationTests {
|
||||
private final static String APP_URL = "https://www.kinopoisk.ru/";
|
||||
private final static String APP_URL_MOVIE = "https://www.kinopoisk.ru/film/mstiteli-voyna-beskonechnosti-2018-843649/";
|
||||
|
||||
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(){
|
||||
context.getDriver().get(APP_URL);//Открыта страница фильма
|
||||
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);//Выбрать пункт меню
|
||||
page.clickButtonLogin();
|
||||
page.isFrameLogin();
|
||||
page.frameLogin();
|
||||
page.isButtonVK();
|
||||
page.clickButtonVK();
|
||||
page.frameDefault();
|
||||
|
||||
VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
pageVk.setOldWindow();
|
||||
pageVk.switchToSocial();
|
||||
Assertions.assertTrue(pageVk.isVkPagePresent());
|
||||
pageVk.closeWindow();
|
||||
pageVk.switchToOldWindow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginEmail() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);//Открыта страница фильма
|
||||
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);//Выбрать пункт меню
|
||||
page.clickButtonLogin();
|
||||
page.isFrameLogin();
|
||||
page.frameLogin();
|
||||
page.insertEmail("sefyijupsi@tutye.com");
|
||||
page.insertPassword("q1w2e3r4t5y6");
|
||||
Thread.sleep(500);
|
||||
page.insertSignInEnter();
|
||||
page.frameDefault();
|
||||
|
||||
Assertions.assertTrue(page.isAutorization());
|
||||
context.getDriver().get("https://www.kinopoisk.ru/logout/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLike(){
|
||||
context.getDriver().get(APP_URL_MOVIE);//Открыта страница фильма
|
||||
|
||||
MoviePage page = PageFactory.initElements(context.getDriver(), MoviePage.class);//Выбрать пункт меню
|
||||
page.clickLike();
|
||||
|
||||
Assertions.assertTrue(page.isErrorLike());
|
||||
}
|
||||
}
|
124
Skalkin/src/test/java/NavigationTests.java
Normal file
124
Skalkin/src/test/java/NavigationTests.java
Normal file
@ -0,0 +1,124 @@
|
||||
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 pageAfisha = PageFactory.initElements(context.getDriver(), AfishaPage.class);
|
||||
Assertions.assertTrue(pageAfisha.isTopViewElementPresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogo() {
|
||||
context.getDriver().get(APP_URL);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню
|
||||
page.clickLogo();
|
||||
|
||||
Assertions.assertTrue(page.isMainPagePresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInfoMovie() {
|
||||
context.getDriver().get(APP_URL_MOVIE);//Открыта страница фильма
|
||||
|
||||
MoviePage pageMovie = PageFactory.initElements(context.getDriver(), MoviePage.class);//Выбрать пункт меню
|
||||
pageMovie.clickInfo();
|
||||
|
||||
ActorPage pageActor = PageFactory.initElements(context.getDriver(), ActorPage.class);
|
||||
Assertions.assertTrue(pageActor.isActorPagePresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInfoActor() {
|
||||
context.getDriver().get(APP_URL_ACTOR);//Открыта страница фильма
|
||||
|
||||
ActorPage pageActor = PageFactory.initElements(context.getDriver(), ActorPage.class);//Выбрать пункт меню
|
||||
pageActor.clickInfo();
|
||||
|
||||
MoviePage pageMovie = PageFactory.initElements(context.getDriver(), MoviePage.class);
|
||||
Assertions.assertTrue(pageMovie.isMoviePagePresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@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.isRandomMovieFormPresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRightMenu() {
|
||||
context.getDriver().get(APP_URL);//Открыта страница фильма
|
||||
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню
|
||||
page.clickRightMenu();
|
||||
|
||||
MoviePage pageMovie = PageFactory.initElements(context.getDriver(), MoviePage.class);
|
||||
Assertions.assertTrue(pageMovie.isMoviePagePresent());//Корректно отображена выбранная страница
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSocialMovieMenu() {
|
||||
context.getDriver().get(APP_URL_MOVIE);//Открыта страница фильма
|
||||
|
||||
MoviePage pageMovie = PageFactory.initElements(context.getDriver(), MoviePage.class);//Выбрать пункт меню
|
||||
pageMovie.clickSocial();
|
||||
|
||||
VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
pageVk.setOldWindow();
|
||||
pageVk.switchToSocial();
|
||||
Assertions.assertTrue(pageVk.isVkPagePresent());
|
||||
pageVk.closeWindow();
|
||||
pageVk.switchToOldWindow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSocialActorMenu() {
|
||||
context.getDriver().get(APP_URL_ACTOR);//Открыта страница фильма
|
||||
|
||||
ActorPage pageActor = PageFactory.initElements(context.getDriver(), ActorPage.class);//Выбрать пункт меню
|
||||
pageActor.clickSocial();
|
||||
|
||||
VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
pageVk.setOldWindow();
|
||||
pageVk.switchToSocial();
|
||||
Assertions.assertTrue(pageVk.isVkPagePresent());
|
||||
pageVk.closeWindow();
|
||||
pageVk.switchToOldWindow();
|
||||
}
|
||||
}
|
153
Skalkin/src/test/java/SearchTests.java
Normal file
153
Skalkin/src/test/java/SearchTests.java
Normal file
@ -0,0 +1,153 @@
|
||||
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.isKomaFromResultElementPresent());
|
||||
}
|
||||
|
||||
@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 pageResult = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isKomaFromResultElementPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByCreators() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchByCreatorsPage page = PageFactory.initElements(context.getDriver(), SearchByCreatorsPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Безруков");
|
||||
Thread.sleep(2500);
|
||||
page.clickDown();
|
||||
page.clickEnter();
|
||||
Thread.sleep(1000);
|
||||
page.enterSearch();
|
||||
|
||||
SearchByCreatorsResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchByCreatorsResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isBrigadaFromResultCreatorsPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByPeople() {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchByPeoplePage page = PageFactory.initElements(context.getDriver(), SearchByPeoplePage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Безруков");
|
||||
page.enterSearch();
|
||||
|
||||
SearchExtendedResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isBezrukovFromResultElementPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchInText() {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchInTextPage page = PageFactory.initElements(context.getDriver(), SearchInTextPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Веном");
|
||||
page.enterSearch();
|
||||
|
||||
SearchInTextResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchInTextResultPage.class);//Корректно отображена выбранная страница
|
||||
String str = pageResult.getNewsElementToString();
|
||||
|
||||
Assertions.assertTrue(pageResult.isListElementPresent("Веном"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByUsers() {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchByUsersPage page = PageFactory.initElements(context.getDriver(), SearchByUsersPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Антон");
|
||||
page.enterSearch();
|
||||
|
||||
SearchExtendedResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchExtendedResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isUsersResultElementPresent("Антон"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByKeyword() {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchByKeywordPage page = PageFactory.initElements(context.getDriver(), SearchByKeywordPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Война");
|
||||
page.enterSearch();
|
||||
|
||||
SearchByKeywordResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchByKeywordResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isFirstResultElementPresent("Война"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchMovieByWord() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchMovieByWordPage page = PageFactory.initElements(context.getDriver(), SearchMovieByWordPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Магия");
|
||||
Thread.sleep(500);
|
||||
page.clickDown();
|
||||
Thread.sleep(500);
|
||||
page.clickDown();
|
||||
Thread.sleep(500);
|
||||
page.clickEnter();
|
||||
Thread.sleep(1000);
|
||||
page.enterSearch();
|
||||
|
||||
SearchByCreatorsResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchByCreatorsResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isFirstResultByWordPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByStudio() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL_SEARCH);//Открыта любая страница сайта, кроме специальных
|
||||
|
||||
SearchByStudioPage page = PageFactory.initElements(context.getDriver(), SearchByStudioPage.class);//Выбрать пункт меню
|
||||
page.insertNameSearch("Disney");
|
||||
Thread.sleep(1000);
|
||||
page.enterSearch();
|
||||
|
||||
SearchByKeywordResultPage pageResult = PageFactory.initElements(context.getDriver(), SearchByKeywordResultPage.class);//Корректно отображена выбранная страница
|
||||
Assertions.assertTrue(pageResult.isFirstResultElementPresent("Disney"));
|
||||
}
|
||||
}
|
25
Skalkin/src/test/java/context/ChromeContext.java
Normal file
25
Skalkin/src/test/java/context/ChromeContext.java
Normal file
@ -0,0 +1,25 @@
|
||||
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";
|
||||
private final static String LINUX_DRIVER = "chromedriver";
|
||||
private final static String DRIVER_TYPE = "webdriver.chrome.driver";
|
||||
|
||||
@Override
|
||||
protected void createDriver() {
|
||||
driver = new ChromeDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
43
Skalkin/src/test/java/context/Context.java
Normal file
43
Skalkin/src/test/java/context/Context.java
Normal file
@ -0,0 +1,43 @@
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class Context {
|
||||
private final static String DRIVER_LOCATION = "drivers/%s";
|
||||
protected WebDriver driver;
|
||||
|
||||
public WebDriver getDriver() {
|
||||
if (driver != null) {
|
||||
return driver;
|
||||
}
|
||||
throw new IllegalStateException("WebDriver is not initialized");
|
||||
}
|
||||
|
||||
public void start() {
|
||||
System.setProperty(getDriverType(), getDriverExecutablePath());
|
||||
createDriver();
|
||||
// это плохая инструкция для автотестов, т.к. лучше задавать для конкретного элемента или кейса
|
||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
protected abstract void createDriver();
|
||||
|
||||
protected abstract String getDriverType();
|
||||
|
||||
protected abstract String getDriverExecutable(boolean windows);
|
||||
|
||||
private String getDriverExecutablePath() {
|
||||
return Context.class.getClassLoader().getResource(
|
||||
String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile();
|
||||
}
|
||||
|
||||
private boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
}
|
||||
}
|
24
Skalkin/src/test/java/context/FirefoxContext.java
Normal file
24
Skalkin/src/test/java/context/FirefoxContext.java
Normal file
@ -0,0 +1,24 @@
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
||||
public class FirefoxContext extends Context {
|
||||
private final static String WINDOWS_DRIVER = "geckodriver.exe";
|
||||
private final static String LINUX_DRIVER = "geckodriver";
|
||||
private final static String DRIVER_TYPE = "webdriver.gecko.driver";
|
||||
|
||||
@Override
|
||||
protected void createDriver() {
|
||||
driver = new FirefoxDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
31
Skalkin/src/test/java/page/ActorPage.java
Normal file
31
Skalkin/src/test/java/page/ActorPage.java
Normal file
@ -0,0 +1,31 @@
|
||||
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 ActorPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickInfo() {
|
||||
infoElement.click();
|
||||
}
|
||||
|
||||
public void clickSocial() {
|
||||
socialElement.click();
|
||||
}
|
||||
|
||||
public boolean isActorPagePresent() {
|
||||
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 topViewElement;
|
||||
|
||||
public AfishaPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isTopViewElementPresent() {
|
||||
return topViewElement.isDisplayed();
|
||||
}
|
||||
}
|
112
Skalkin/src/test/java/page/LoginPage.java
Normal file
112
Skalkin/src/test/java/page/LoginPage.java
Normal file
@ -0,0 +1,112 @@
|
||||
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 LoginPage {
|
||||
WebDriver driver;
|
||||
|
||||
@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__avatar")
|
||||
private WebElement elementAvatar;
|
||||
|
||||
@FindBy(name = "login")
|
||||
private WebElement elementEmail;
|
||||
|
||||
@FindBy(name = "password")
|
||||
private WebElement elementPassword;
|
||||
|
||||
@FindBy(css = ".link.link_secondary.auth__signup-link")
|
||||
private WebElement elementRegister;
|
||||
|
||||
@FindBy(css = ".kp2-authapi-iframe")
|
||||
private WebElement signInFrame;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/logout/']")
|
||||
private WebElement buttonLogout;
|
||||
|
||||
public LoginPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickButtonLogin() {
|
||||
buttonLogin.click();
|
||||
}
|
||||
|
||||
public void clickButtonVK() {
|
||||
buttonVK.click();
|
||||
}
|
||||
|
||||
public void clickButtonLogout() {
|
||||
buttonLogout.click();
|
||||
}
|
||||
|
||||
public void insertEmail(String str) {
|
||||
elementEmail.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertPassword(String str) {
|
||||
elementPassword.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertSignInEnter() {
|
||||
elementPassword.sendKeys(Keys.ENTER);
|
||||
}
|
||||
|
||||
public void isButtonVK() {
|
||||
while(true){
|
||||
try{
|
||||
if(driver.findElement(By.cssSelector(".social-auth__item.social-auth__item_code_vk")).isDisplayed()){
|
||||
return;
|
||||
} else {
|
||||
Thread.sleep(500);
|
||||
}
|
||||
}catch(Exception ex){ }
|
||||
}
|
||||
}
|
||||
|
||||
public void isFrameLogin() {
|
||||
while(true){
|
||||
try{
|
||||
if(driver.findElement(By.name("kp2-authapi-iframe")).isDisplayed()){
|
||||
return;
|
||||
} else {
|
||||
Thread.sleep(500);
|
||||
}
|
||||
}catch(Exception ex){ }
|
||||
}
|
||||
}
|
||||
|
||||
public void isButtonLogin() {
|
||||
while(true){
|
||||
try{
|
||||
if(driver.findElement(By.name("kp2-authapi-iframe")).isDisplayed()){
|
||||
return;
|
||||
} else {
|
||||
Thread.sleep(500);
|
||||
}
|
||||
}catch(Exception ex){ }
|
||||
}
|
||||
}
|
||||
|
||||
public void frameDefault(){
|
||||
driver.switchTo().defaultContent();
|
||||
}
|
||||
|
||||
public void frameLogin(){
|
||||
driver.switchTo().frame(signInFrame);
|
||||
}
|
||||
|
||||
public boolean isAutorization() {
|
||||
return elementAvatar.isDisplayed();
|
||||
}
|
||||
}
|
72
Skalkin/src/test/java/page/MainPage.java
Normal file
72
Skalkin/src/test/java/page/MainPage.java
Normal file
@ -0,0 +1,72 @@
|
||||
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.io.Console;
|
||||
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 = "index_news")
|
||||
private WebElement newsBaners;
|
||||
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickSubMenu() {
|
||||
Actions builder = new Actions(driver);
|
||||
builder.moveToElement(mainElement).perform();
|
||||
menuElement.sendKeys(Keys.RETURN);
|
||||
}
|
||||
|
||||
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 boolean isMainPagePresent() {
|
||||
return newsBaners.isDisplayed();
|
||||
}
|
||||
}
|
45
Skalkin/src/test/java/page/MoviePage.java
Normal file
45
Skalkin/src/test/java/page/MoviePage.java
Normal file
@ -0,0 +1,45 @@
|
||||
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;
|
||||
|
||||
@FindBy(id = "btn_fav_film")
|
||||
private WebElement buttonLike;
|
||||
|
||||
@FindBy(id = "ui_notice_container")
|
||||
private WebElement infoError;
|
||||
|
||||
public MoviePage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickInfo() {
|
||||
infoElement.click();
|
||||
}
|
||||
|
||||
public void clickSocial() {
|
||||
socialElement.click();
|
||||
}
|
||||
|
||||
public void clickLike() {
|
||||
buttonLike.click();
|
||||
}
|
||||
|
||||
public boolean isErrorLike() {
|
||||
return infoError.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isMoviePagePresent() {
|
||||
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 randomMovieForm;
|
||||
|
||||
public RandomSearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isRandomMovieFormPresent() {
|
||||
return randomMovieForm.isDisplayed();
|
||||
}
|
||||
}
|
40
Skalkin/src/test/java/page/VKPage.java
Normal file
40
Skalkin/src/test/java/page/VKPage.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 VKPage {
|
||||
WebDriver driver;
|
||||
private String oldWindow;
|
||||
|
||||
@FindBy(id = "login_submit")
|
||||
private WebElement formLoginVk;
|
||||
|
||||
public VKPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void switchToSocial(){
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOldWindow() {
|
||||
this.oldWindow = driver.getWindowHandle();
|
||||
}
|
||||
|
||||
public void switchToOldWindow(){
|
||||
if(oldWindow != "")
|
||||
driver.switchTo().window(oldWindow);
|
||||
}
|
||||
|
||||
public void closeWindow() {
|
||||
driver.close();
|
||||
}
|
||||
|
||||
public boolean isVkPagePresent() {
|
||||
return formLoginVk.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,34 @@
|
||||
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 resultCreatorsElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/film/brigada-2002-77039/sr/1/']")
|
||||
private WebElement brigadaFromResultCreatorsElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/film/garri-potter-i-filosofskiy-kamen-2001-689/sr/1/']")
|
||||
private WebElement firstResultByWordElement;
|
||||
|
||||
public SearchByCreatorsResultPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isFirstResultByWordPresent() {
|
||||
return firstResultByWordElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isBrigadaFromResultCreatorsPresent() {
|
||||
return brigadaFromResultCreatorsElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isResultCreatorsPresent() {
|
||||
return resultCreatorsElement.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,38 @@
|
||||
package page.search;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchByKeywordResultPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".news")
|
||||
private WebElement newsElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\'block_left_pad\']/div/table/tbody/tr/td/table[2]/tbody/tr/td/table[1]/tbody/tr")
|
||||
private List<WebElement> listResultElement;
|
||||
|
||||
public SearchByKeywordResultPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isFirstResultElementPresent(String text) { //
|
||||
boolean matched = true;
|
||||
|
||||
for (int i = 0; i < listResultElement.size()-1; i++) {
|
||||
String str = listResultElement.get(i).getText();
|
||||
if((i-2) % 3 == 0 && !str.toLowerCase().contains(text.toLowerCase())){
|
||||
matched = false;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
public boolean isNewsElementPresent() {
|
||||
return newsElement.isDisplayed();
|
||||
}
|
||||
}
|
27
Skalkin/src/test/java/page/search/SearchByPeoplePage.java
Normal file
27
Skalkin/src/test/java/page/search/SearchByPeoplePage.java
Normal file
@ -0,0 +1,27 @@
|
||||
package page.search;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
27
Skalkin/src/test/java/page/search/SearchByStudioPage.java
Normal file
27
Skalkin/src/test/java/page/search/SearchByStudioPage.java
Normal file
@ -0,0 +1,27 @@
|
||||
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();
|
||||
}
|
||||
}
|
27
Skalkin/src/test/java/page/search/SearchByUsersPage.java
Normal file
27
Skalkin/src/test/java/page/search/SearchByUsersPage.java
Normal file
@ -0,0 +1,27 @@
|
||||
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();
|
||||
}
|
||||
}
|
43
Skalkin/src/test/java/page/search/SearchExtendedPage.java
Normal file
43
Skalkin/src/test/java/page/search/SearchExtendedPage.java
Normal file
@ -0,0 +1,43 @@
|
||||
package page.search;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
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();
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package page.search;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchExtendedResultPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".search_results_top")
|
||||
private WebElement resultTopElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/film/koma-2018-933208/sr/1/']")
|
||||
private WebElement komaFromResultElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/name/224620/sr/1/']")
|
||||
private WebElement bezrukovFromResultElement;
|
||||
|
||||
@FindBy(css = ".element")
|
||||
private List<WebElement> usersListResultElement;
|
||||
|
||||
|
||||
|
||||
public SearchExtendedResultPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isUsersResultElementPresent(String text) {
|
||||
boolean matched = true;
|
||||
|
||||
for (int i = 0; i < usersListResultElement.size(); i++) {
|
||||
if(!usersListResultElement.get(i).getText().toLowerCase().contains(text.toLowerCase())){
|
||||
matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
public boolean isBezrukovFromResultElementPresent() {
|
||||
return bezrukovFromResultElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isKomaFromResultElementPresent() {
|
||||
return komaFromResultElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isResultTopElementPresent() {
|
||||
return resultTopElement.isDisplayed();
|
||||
}
|
||||
}
|
27
Skalkin/src/test/java/page/search/SearchInTextPage.java
Normal file
27
Skalkin/src/test/java/page/search/SearchInTextPage.java
Normal file
@ -0,0 +1,27 @@
|
||||
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,41 @@
|
||||
package page.search;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchInTextResultPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".textorangebig")
|
||||
private WebElement headerElement;
|
||||
|
||||
@FindBy(css = ".news")
|
||||
private WebElement newsElement; //
|
||||
|
||||
@FindBy(xpath = "//*[@id='block_left_pad']/div/table/tbody/tr/td/table[2]/tbody/tr/td/table[2]/tbody/tr")
|
||||
private List<WebElement> listNewsElement;
|
||||
|
||||
public SearchInTextResultPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public String getNewsElementToString(){
|
||||
return newsElement.getText();
|
||||
}
|
||||
|
||||
public boolean isListElementPresent(String text) {
|
||||
boolean matched = true;
|
||||
|
||||
for (int i = 4; i < listNewsElement.size(); i++) {
|
||||
if((i-1) % 3 == 0 && !listNewsElement.get(i).getText().toLowerCase().contains(text.toLowerCase())){
|
||||
matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
}
|
36
Skalkin/src/test/java/page/search/SearchMovieByWordPage.java
Normal file
36
Skalkin/src/test/java/page/search/SearchMovieByWordPage.java
Normal file
@ -0,0 +1,36 @@
|
||||
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