Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
658e827bc6 | ||
|
594b41c402 | ||
|
f7ab019a6e | ||
|
54217223b6 | ||
|
8691d3e1b2 | ||
|
5d353dcd45 |
156
Stroeva/.gitignore
vendored
Normal file
156
Stroeva/.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
Stroeva/README.md
Normal file
2
Stroeva/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
Selenium WebDriver example project
|
||||
|
49
Stroeva/pom.xml
Normal file
49
Stroeva/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
Stroeva/src/main/java/ru/ulstu/tis/Main.java
Normal file
8
Stroeva/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
Stroeva/src/main/resources/drivers/chromedriver
Normal file
BIN
Stroeva/src/main/resources/drivers/chromedriver
Normal file
Binary file not shown.
BIN
Stroeva/src/main/resources/drivers/chromedriver.exe
Normal file
BIN
Stroeva/src/main/resources/drivers/chromedriver.exe
Normal file
Binary file not shown.
BIN
Stroeva/src/main/resources/drivers/geckodriver
Normal file
BIN
Stroeva/src/main/resources/drivers/geckodriver
Normal file
Binary file not shown.
BIN
Stroeva/src/main/resources/drivers/geckodriver.exe
Normal file
BIN
Stroeva/src/main/resources/drivers/geckodriver.exe
Normal file
Binary file not shown.
94
Stroeva/src/test/java/AccountTests.java
Normal file
94
Stroeva/src/test/java/AccountTests.java
Normal file
@ -0,0 +1,94 @@
|
||||
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 AccountTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials_2017/5812-mertv-na-99.html";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignIn() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
Assertions.assertTrue(page.isUserPresent());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignInVK() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.clickSignIn();
|
||||
page.clickVkButton();
|
||||
VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
String str = context.getDriver().getWindowHandle();
|
||||
pageVk.switchToSocial();
|
||||
Assertions.assertTrue(pageVk.isUserPresent());
|
||||
pageVk.closeSocial();
|
||||
pageVk.switchToOld(str);
|
||||
Thread.sleep(1000);
|
||||
page.clickToCloseFormButton();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEditAcc() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clearEmail();
|
||||
pageAn.editEmail("Test2018t@mail.ru");
|
||||
pageAn.clickToButtonSave();
|
||||
Assertions.assertTrue(pageAn.checkEmail("Test2018t@mail.ru"));
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFavoritePage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clickToFavorite();
|
||||
Assertions.assertTrue(pageAn.isListPage());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFuturePage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clickToFuture();
|
||||
Assertions.assertTrue(pageAn.isListPage());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
}
|
61
Stroeva/src/test/java/FilterTests.java
Normal file
61
Stroeva/src/test/java/FilterTests.java
Normal file
@ -0,0 +1,61 @@
|
||||
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.By;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.*;
|
||||
|
||||
public class FilterTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials/";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearch() {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickSearchButton();
|
||||
page.insertSearchText("Супердевушка");
|
||||
page.insertEnterSearchText();
|
||||
SearchPage pageAn = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
Assertions.assertTrue(pageAn.isListSearchPresent("Супердевушка"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountryList() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickCountry();
|
||||
Thread.sleep(2000);
|
||||
page.clickSerial();
|
||||
ExSerialPage pageAn = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
Assertions.assertTrue(pageAn.isCountryPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenreList() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickGenre();
|
||||
Thread.sleep(2000);
|
||||
page.clickSerial();
|
||||
ExSerialPage pageAn = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
Assertions.assertTrue(pageAn.isGenrePresent());
|
||||
}
|
||||
}
|
94
Stroeva/src/test/java/NavigationTests.java
Normal file
94
Stroeva/src/test/java/NavigationTests.java
Normal file
@ -0,0 +1,94 @@
|
||||
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 = "http://amovies.cc/";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogo() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickLogo();
|
||||
Assertions.assertTrue(page.isFilterPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFooter() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickFooter();
|
||||
HolderPage pageAn = PageFactory.initElements(context.getDriver(), HolderPage.class);
|
||||
Assertions.assertTrue(pageAn.isHolderPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRating() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getRating();
|
||||
page.clickRating();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYear() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getYear();
|
||||
page.clickYear();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountry() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getCountry();
|
||||
page.clickCountry();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenre() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getGenre();
|
||||
page.clickGenre();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isContentPresent(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMenu() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
String str = page.getElementMenu();
|
||||
page.clickMenu();
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isPagePresent(str));
|
||||
}
|
||||
}
|
95
Stroeva/src/test/java/VideoTests.java
Normal file
95
Stroeva/src/test/java/VideoTests.java
Normal file
@ -0,0 +1,95 @@
|
||||
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.ExSerialPage;
|
||||
import page.LoginPage;
|
||||
import page.SearchPage;
|
||||
import page.SerialPage;
|
||||
|
||||
public class VideoTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials_2017/5812-mertv-na-99.html";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenFilter() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
String str = page.getGenre();
|
||||
page.clickGenre();
|
||||
SerialPage pageAn = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
pageAn.clickSerial();
|
||||
Assertions.assertTrue(page.checkGenre(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToFavorite() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickToFavorite();
|
||||
Assertions.assertTrue(page.isFavoritePresent());
|
||||
page.clickToFavorite();
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToFuture() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickToFuture();
|
||||
Assertions.assertTrue(page.isFuturePresent());
|
||||
page.clickToFuture();
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRating() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
int count = page.getRatingUpNum();
|
||||
page.clickRating();
|
||||
Assertions.assertTrue(page.getRatingUpNum() >= count );
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComment() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickCommentButton();
|
||||
page.commentWrite("Отличный фильм!");
|
||||
page.clickCommentAdd();
|
||||
Thread.sleep(2000);
|
||||
Assertions.assertTrue(page.isCommentPresent());
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
}
|
25
Stroeva/src/test/java/context/ChromeContext.java
Normal file
25
Stroeva/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
Stroeva/src/test/java/context/Context.java
Normal file
43
Stroeva/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
Stroeva/src/test/java/context/FirefoxContext.java
Normal file
24
Stroeva/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;
|
||||
}
|
||||
}
|
57
Stroeva/src/test/java/page/AccUserPage.java
Normal file
57
Stroeva/src/test/java/page/AccUserPage.java
Normal file
@ -0,0 +1,57 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class AccUserPage {
|
||||
WebDriver driver;
|
||||
@FindBy(xpath = "//*[@id=\"userinfo\"]/div[2]/div[4]/div/div[1]/span[2]/input")
|
||||
private WebElement email;
|
||||
|
||||
@FindBy(css = ".submit-user")
|
||||
private WebElement buttonSave;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/like/']")
|
||||
private WebElement favoritButton;
|
||||
|
||||
@FindBy(css = ".short-film")
|
||||
private WebElement filmElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/tosee/']")
|
||||
private WebElement futureButton;
|
||||
|
||||
public AccUserPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void editEmail(String str) {
|
||||
email.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickToButtonSave() {
|
||||
buttonSave.click();
|
||||
}
|
||||
|
||||
public void clickToFavorite() {
|
||||
favoritButton.click();
|
||||
}
|
||||
|
||||
public void clickToFuture() {
|
||||
futureButton.click();
|
||||
}
|
||||
|
||||
public boolean checkEmail(String str){
|
||||
if(email.getAttribute("value").equals(str))
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public void clearEmail() {
|
||||
email.clear();
|
||||
}
|
||||
|
||||
public boolean isListPage() {
|
||||
return filmElement.isDisplayed();
|
||||
}
|
||||
}
|
122
Stroeva/src/test/java/page/ExSerialPage.java
Normal file
122
Stroeva/src/test/java/page/ExSerialPage.java
Normal file
@ -0,0 +1,122 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExSerialPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/russia/']")
|
||||
private WebElement countrySerialElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/boeviki_2018/']")
|
||||
private WebElement genreSerialElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"dle-content\"]/article/span/div[1]/div[1]/div[4]/div/div[1]/div[2]/a[1]")
|
||||
private WebElement genreAnySerialElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"dle-content\"]/article/span/div[1]/div[1]/div[4]/div/div[1]/div[2]")
|
||||
private List<WebElement> genreListElement;
|
||||
|
||||
@FindBy(id = "film-favorite")
|
||||
private WebElement toFavorites;
|
||||
|
||||
@FindBy(id = "film-future")
|
||||
private WebElement toFuture;
|
||||
|
||||
@FindBy(css = "#film-favorite.in")
|
||||
private WebElement toFavoritesIn;
|
||||
|
||||
@FindBy(css = "#film-future.in")
|
||||
private WebElement toFutureIn;
|
||||
|
||||
@FindBy(id = "rating-btn")
|
||||
private WebElement rating;
|
||||
|
||||
@FindBy(id = "rating-up")
|
||||
private WebElement ratingUp;
|
||||
|
||||
@FindBy(css = ".write-comm")
|
||||
private WebElement commentButton;
|
||||
|
||||
@FindBy(id = "comments")
|
||||
private WebElement commentWrite;
|
||||
|
||||
@FindBy(css = ".fbutton")
|
||||
private WebElement commentAdd;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/user/test2018/']")
|
||||
private WebElement checkComment;
|
||||
|
||||
public ExSerialPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickGenre() {
|
||||
genreAnySerialElement.click();
|
||||
}
|
||||
|
||||
public String getGenre() {
|
||||
return genreAnySerialElement.getText();
|
||||
}
|
||||
|
||||
public boolean checkGenre(String genre) {
|
||||
for (WebElement el:
|
||||
genreListElement) {
|
||||
if(el.getText().contains(genre))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clickToFavorite() {
|
||||
toFavorites.click();
|
||||
}
|
||||
|
||||
public void clickToFuture() {
|
||||
toFuture.click();
|
||||
}
|
||||
|
||||
public void clickRating() {
|
||||
rating.click();
|
||||
}
|
||||
|
||||
public int getRatingUpNum() {
|
||||
return Integer.parseInt(ratingUp.getText());
|
||||
}
|
||||
|
||||
public void clickCommentButton() {
|
||||
commentButton.click();
|
||||
}
|
||||
|
||||
public void commentWrite(String str) {
|
||||
commentWrite.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickCommentAdd() {
|
||||
commentAdd.click();
|
||||
}
|
||||
|
||||
public boolean isCountryPresent() {
|
||||
return countrySerialElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isGenrePresent() {
|
||||
return genreSerialElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isFavoritePresent() {
|
||||
return toFavoritesIn.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isFuturePresent() {
|
||||
return toFutureIn.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isCommentPresent() {
|
||||
return checkComment.isDisplayed();
|
||||
}
|
||||
}
|
20
Stroeva/src/test/java/page/HolderPage.java
Normal file
20
Stroeva/src/test/java/page/HolderPage.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 HolderPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".box-text")
|
||||
private WebElement holderElement;
|
||||
|
||||
public HolderPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isHolderPresent() {
|
||||
return holderElement.isDisplayed();
|
||||
}
|
||||
}
|
82
Stroeva/src/test/java/page/LoginPage.java
Normal file
82
Stroeva/src/test/java/page/LoginPage.java
Normal file
@ -0,0 +1,82 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LoginPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".login")
|
||||
private WebElement signIn;
|
||||
|
||||
@FindBy(id = "login_name")
|
||||
private WebElement login;
|
||||
|
||||
@FindBy(id = "login_password")
|
||||
private WebElement pass;
|
||||
|
||||
@FindBy(css = ".login-button")
|
||||
private WebElement buttonLogin;
|
||||
|
||||
@FindBy(css = ".user")
|
||||
private WebElement user;
|
||||
|
||||
@FindBy(css = ".ulogin-button-vkontakte")
|
||||
private WebElement vkButton;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/index.php?action=logout']")
|
||||
private WebElement exitButton;
|
||||
|
||||
@FindBy(css = ".fa.fa-times.overlay-close")
|
||||
private WebElement closeFormButton;
|
||||
|
||||
public LoginPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickSignIn() {
|
||||
signIn.click();
|
||||
}
|
||||
|
||||
public void insertLogin(String str) {
|
||||
login.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertPass(String str) {
|
||||
pass.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickToButtonLogin() {
|
||||
buttonLogin.click();
|
||||
}
|
||||
|
||||
public void login(){
|
||||
clickSignIn();
|
||||
insertLogin("test2018");
|
||||
insertPass("q1w2e3r4t5");
|
||||
clickToButtonLogin();
|
||||
}
|
||||
|
||||
public void clickAccUser() {
|
||||
user.click();
|
||||
}
|
||||
|
||||
public void clickExitAccUser() {
|
||||
exitButton.click();
|
||||
}
|
||||
|
||||
public void clickToCloseFormButton() {
|
||||
closeFormButton.click();
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return user.isDisplayed();
|
||||
}
|
||||
|
||||
public void clickVkButton() {
|
||||
vkButton.click();
|
||||
}
|
||||
}
|
97
Stroeva/src/test/java/page/MainPage.java
Normal file
97
Stroeva/src/test/java/page/MainPage.java
Normal file
@ -0,0 +1,97 @@
|
||||
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 = ".logo")
|
||||
private WebElement logoElement;
|
||||
|
||||
@FindBy(css = ".nav-filter")
|
||||
private WebElement filterElement;
|
||||
|
||||
@FindBy(css = ".footer-nav")
|
||||
private WebElement footerElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/top/']")
|
||||
private WebElement ratingElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/filmy_2018/']")
|
||||
private WebElement yearElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/britain/']")
|
||||
private WebElement countryElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/horror/']")
|
||||
private WebElement genreElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/serials/']")
|
||||
private WebElement menuElement;
|
||||
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickLogo() {
|
||||
logoElement.click();
|
||||
}
|
||||
|
||||
public void clickFooter() {
|
||||
footerElement.click();
|
||||
}
|
||||
|
||||
public void clickRating() {
|
||||
ratingElement.click();
|
||||
}
|
||||
|
||||
public void clickYear() {
|
||||
yearElement.click();
|
||||
}
|
||||
|
||||
public void clickCountry() {
|
||||
countryElement.click();
|
||||
}
|
||||
|
||||
public void clickGenre() {
|
||||
genreElement.click();
|
||||
}
|
||||
|
||||
public void clickMenu() {
|
||||
menuElement.click();
|
||||
}
|
||||
|
||||
public String getRating(){
|
||||
return ratingElement.getText();
|
||||
}
|
||||
|
||||
public String getYear(){
|
||||
return yearElement.getText();
|
||||
}
|
||||
|
||||
public String getCountry(){
|
||||
return countryElement.getText();
|
||||
}
|
||||
|
||||
public String getGenre(){
|
||||
return genreElement.getText();
|
||||
}
|
||||
|
||||
public String getElementMenu(){
|
||||
return menuElement.getText();
|
||||
}
|
||||
|
||||
public boolean isFilterPresent() {
|
||||
return filterElement.isDisplayed();
|
||||
}
|
||||
}
|
24
Stroeva/src/test/java/page/NavFilterPage.java
Normal file
24
Stroeva/src/test/java/page/NavFilterPage.java
Normal file
@ -0,0 +1,24 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class NavFilterPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[2]/h1")
|
||||
private WebElement title;
|
||||
|
||||
public NavFilterPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isPagePresent(String str) {
|
||||
return driver.getTitle().toUpperCase().contains(str.toUpperCase());
|
||||
}
|
||||
|
||||
public boolean isContentPresent(String str) {
|
||||
return title.getText().toUpperCase().contains(str.toUpperCase());
|
||||
}
|
||||
}
|
35
Stroeva/src/test/java/page/SearchPage.java
Normal file
35
Stroeva/src/test/java/page/SearchPage.java
Normal file
@ -0,0 +1,35 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"serials\"]/div/div[2]/div[1]")
|
||||
private WebElement searchElement;
|
||||
|
||||
@FindBy(css = ".post-title")
|
||||
private List<WebElement> listSearchElement;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isSearchPresent(String str) {
|
||||
return searchElement.getText().contains(str);
|
||||
}
|
||||
|
||||
public boolean isListSearchPresent(String str) {
|
||||
boolean bl=true;
|
||||
for(int i=0; i<listSearchElement.size();i++){
|
||||
if(bl && !listSearchElement.get(i).getText().toLowerCase().contains(str.toLowerCase())){
|
||||
bl=false;
|
||||
}
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
}
|
61
Stroeva/src/test/java/page/SerialPage.java
Normal file
61
Stroeva/src/test/java/page/SerialPage.java
Normal file
@ -0,0 +1,61 @@
|
||||
package page;
|
||||
|
||||
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 SerialPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "show-search")
|
||||
private WebElement searchButton;
|
||||
|
||||
@FindBy(id = "story")
|
||||
private WebElement searchText;
|
||||
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[3]/div[1]/div[2]/div/div/div[2]/button[2]")
|
||||
private WebElement countryList;
|
||||
|
||||
@FindBy(css = "#dle-content .short-film")
|
||||
private WebElement serialElement;
|
||||
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[3]/div[2]/div[2]/div/div/div[2]/button[3]")
|
||||
private WebElement genreList;
|
||||
|
||||
public SerialPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickSearchButton() {
|
||||
searchButton.click();
|
||||
}
|
||||
|
||||
public void insertSearchText(String str) {
|
||||
searchText.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertEnterSearchText() {
|
||||
searchText.sendKeys(Keys.ENTER);
|
||||
}
|
||||
|
||||
public void clickCountry() {
|
||||
countryList.click();
|
||||
}
|
||||
|
||||
public void clickSerial() {
|
||||
serialElement.click();
|
||||
}
|
||||
|
||||
public void clickGenre() {
|
||||
genreList.click();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public boolean isUserPresent() {
|
||||
// return holderElement.isDisplayed();
|
||||
// }
|
||||
}
|
34
Stroeva/src/test/java/page/VKPage.java
Normal file
34
Stroeva/src/test/java/page/VKPage.java
Normal file
@ -0,0 +1,34 @@
|
||||
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();
|
||||
}
|
||||
|
||||
public void switchToSocial(){
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public void switchToOld(String str){
|
||||
driver.switchTo().window(str);
|
||||
}
|
||||
|
||||
public void closeSocial(){
|
||||
driver.close();
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ public class SearchPage {
|
||||
@FindBy(css = "input.header-search-input")
|
||||
private WebElement inputField;
|
||||
|
||||
@FindBy(xpath = "//a[contains(@href, 'Users')]")
|
||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
||||
private WebElement usersLink;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
|
Loading…
Reference in New Issue
Block a user