Compare commits

..

2 Commits

Author SHA1 Message Date
Anton Romanov
0ea8df6c32 Merge remote-tracking branch 'origin/master' 2019-11-21 10:46:02 +04:00
Anton Romanov
0ba38238af fix selector 2019-11-21 10:45:52 +04:00
33 changed files with 1 additions and 1649 deletions

156
Nagaytseva/.gitignore vendored
View File

@ -1,156 +0,0 @@
# 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/

View File

@ -1,2 +0,0 @@
Selenium WebDriver example project

View File

@ -1,49 +0,0 @@
<?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>

View File

@ -1,8 +0,0 @@
package ru.ulstu.tis;
public class Main {
public static void main(String[] args) {
System.out.println("666");
}
}

View File

@ -1,84 +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.PageGosCertification;
import page.PageMain;
import page.PagePriceList;
import page.PageProgrammProduct;
import java.io.File;
import static java.security.spec.MGF1ParameterSpec.SHA1;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class DownloadDoc {
private final static String APP_URL = "https://1c.ru/";
private static Context context;
private int menuItemNumber;
private int imgNumber;
private static String tmpPath;
@BeforeAll
public static void setup() {
context = new ChromeContext();
context.start();
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
context.getDriver().get(APP_URL);
tmpPath = context.getTmpPath();
}
@AfterAll
public static void quit() {
context.close();
}
@Test
public void testDownloandZip() throws InterruptedException {
context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 4;
page.clickFooterMenuItem(menuItemNumber);
PagePriceList pagePriceList = PageFactory.initElements(context.getDriver(), PagePriceList.class);
String fileName = pagePriceList.getFileName();
pagePriceList.clickBtn();
checkDownload(fileName,100,100);
}
@Test
public void testDownloandOpenChrome() throws InterruptedException {
context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 3;
page.clickFooterMenuItem(menuItemNumber);
PageProgrammProduct pageProgrammProduct = PageFactory.initElements(context.getDriver(), PageProgrammProduct.class);
menuItemNumber = 5;
pageProgrammProduct.clickLeftMenu(menuItemNumber);
PageGosCertification pageGosCertification = PageFactory.initElements(context.getDriver(), PageGosCertification.class);
imgNumber = 2;
String fileName = pageGosCertification.getFileNameImg(imgNumber);
pageGosCertification.clickiImg(imgNumber);
Assertions.assertTrue(pageGosCertification.checkOpenImg(fileName));
}
private void checkDownload(String fileName,int timeout, int period) throws InterruptedException {
File f = new File(tmpPath +fileName);
int time=0;
while(!f.exists()&&time<timeout){
Thread.sleep(period);
time++;
}
Assertions.assertTrue(f.exists());
if(f.exists()) {
f.delete();
}
}
}

View File

@ -1,123 +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.*;
import java.text.ParseException;
public class FilterTest {
private final static String APP_URL = "https://1c.ru/";
private static Context context;
private int menuItemNumber;
private int itemListCountry;
private int dateNumberListFirst;
private int dateNumberListLast;
@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 testSiteSearchEnter() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
String queryString = "Предприятие";
pageNews.insertSearchText(queryString);
pageNews.submitSearch();
Assertions.assertTrue(pageNews.checkSearch());
}
@Test
public void testSiteSearchBtn() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
String queryString = "Предприятие";
pageNews.insertSearchText(queryString);
pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearch());
}
@Test
public void testFilterParametrs() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
menuItemNumber = 18;
pageFirm1C.clickLeftMenu(menuItemNumber);
PageUserCertification pageUserCertification = PageFactory.initElements(context.getDriver(), PageUserCertification.class);
itemListCountry = 1;
pageUserCertification.clickFilterCountry(itemListCountry);
pageUserCertification.clickFilterCity();
Assertions.assertTrue(pageUserCertification.checkSortByFilterCity());
}
@Test
public void testSortCity() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment();
PageSystemManagment page3 = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
page3.clickLinkText();
PageListFirm pageListFirm = PageFactory.initElements(context.getDriver(), PageListFirm.class);
pageListFirm.clickCity();
Assertions.assertTrue(pageListFirm.checkSortCity());
}
@Test
public void testSearchByDate() throws ParseException {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
String queryString = "Предприятие";
pageNews.insertSearchText(queryString);
dateNumberListFirst = 7;
pageNews.clickSelectionDate(dateNumberListFirst);
dateNumberListLast = 26;
pageNews.clickSelectionDateL(dateNumberListLast);
pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearchParametrsFirstLastDay());
}
@Test
public void testSearchByDateL() throws ParseException {
context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
page.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
String queryString = "1с";
pageNews.insertSearchText(queryString);
dateNumberListLast = 26;
pageNews.clickSelectionDateL(dateNumberListLast);
pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearchParametrsLastDay());
}
}

View File

@ -1,52 +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.PageMain;
import page.PageNews;
import page.PagePartnersFirm;
public class FormMakeRequest {
private final static String APP_URL = "https://1c.ru/partners-pp/rentclaim.jsp";
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 testMakeRequest() {
context.getDriver().get(APP_URL);
PagePartnersFirm pagePartnersFirm = PageFactory.initElements(context.getDriver(), PagePartnersFirm.class);
String fio = "Ekaterina";
String email = "test@yandex.ru";
String phone = "89756523322";
String inn = "745844556856";
int numberFieldInn = 0;
int numberFieldPhone = 3;
int numberFieldEmail = 4;
int numberFieldFio = 5;
pagePartnersFirm.insertSearchText(numberFieldInn, inn, numberFieldPhone, phone, numberFieldEmail, email, numberFieldFio, fio);
int numberCheckBox6 = 6;
int numberCheckBox10 = 10;
int numberCheckBox21 = 21;
int numberCheckBox31 = 31;
int numberCheckBox33 = 33;
pagePartnersFirm.clickCheckBox(numberCheckBox6, numberCheckBox10, numberCheckBox21, numberCheckBox31, numberCheckBox33);
pagePartnersFirm.clickBtnRequest();
Assertions.assertTrue(pagePartnersFirm.displayForm());
}
}

View File

@ -1,42 +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.BrowserWindow;
import page.PageMain;
import java.util.Random;
public class FormSubscribeTest {
private final static String APP_URL = "http://1c.ru/news/subscr.jsp";
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 testFormSubscribe() {
context.getDriver().get(APP_URL);
Random random = new Random();
BrowserWindow browserWindow = PageFactory.initElements(context.getDriver(), BrowserWindow.class);
String queryString = "name" + random.nextInt(100) + "@yandex.ru";
browserWindow.insertText(queryString);
browserWindow.clickSubscribe();
Assertions.assertTrue(browserWindow.subscribeTrue());
}
}

View File

@ -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());
}
}

View File

@ -1,150 +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.*;
public class MenuNavigation {
private final static String APP_URL = "https://1c.ru/";
private static Context context;
private int menuItemNumber;
@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 testTopMenuDropDownList() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickHeadMenuList();
Assertions.assertTrue(pageMain.menuList());
}
@Test
public void testTopMenuOutLink() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickMenuLink();
Assertions.assertTrue(pageMain.menuOutLink());
}
@Test
public void testFooterMenu() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickFooterMenuItem(menuItemNumber);
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
Assertions.assertTrue(pageFirm1C.footerMenuList());
}
@Test
public void testLeftMenuOutLink() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickLeftMenu(menuItemNumber);
Assertions.assertTrue(pageSearch.searchPage());
}
@Test
public void testPagination() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment();
PageSystemManagment pageSystemManagment = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
pageSystemManagment.clickLeftMenuListPagination();
pageSystemManagment.clickPaginationElement();
Assertions.assertTrue(pageSystemManagment.paginationCheck());
}
@Test
public void testButtomNews() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
Assertions.assertTrue(pageNews.disposeBlockNews());
}
@Test
public void testLinkNews() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
String str = pageMain.getTextTitleNews();
pageMain.clickLinkNews();
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
Assertions.assertTrue(pageInf.displayNewsInformationTrue(str));
}
@Test
public void testDropDownListVacancy() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickVacancy();
pageFirm1C.clickVacancyLink();
Assertions.assertTrue(pageFirm1C.disposalVacancyList());
}
@Test
public void testBtmBackNews() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickLinkNews5();
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
pageInf.clickBtmBack();
Assertions.assertTrue(pageInf.disposeMainInformation());
}
@Test
public void testBtmNextNews() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
pageMain.clickLinkNews5();
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
pageInf.clickBtmNext();
Assertions.assertTrue(pageInf.disposeMainInformation());
}
@Test
public void testPopUpWindow() {
context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
menuItemNumber = 0;
pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment();
PageSystemManagment pageSystemManagment = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
pageSystemManagment.clickLeftMenuListWindiw();
pageSystemManagment.clickPopUpWindowElement();
Assertions.assertTrue(pageSystemManagment.popUpWindowCheck());
}
}

View File

@ -1,32 +0,0 @@
package context;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.HashMap;
import java.util.Map;
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() {
ChromeOptions options = new ChromeOptions();
Map<String,Object> prefs = new HashMap<String, Object>();
tmpPath = System.getProperty("user.dir") + "/src/main/resources/downloads/";
prefs.put("download.default_directory",tmpPath);
driver = new ChromeDriver();
}
@Override
protected String getDriverExecutable(boolean isWindows) {
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
}
@Override
protected String getDriverType() {
return DRIVER_TYPE;
}
}

View File

@ -1,46 +0,0 @@
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;
protected String tmpPath;
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();
}
public String getTmpPath(){
return tmpPath;
}
private boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows");
}
}

View File

@ -1,24 +0,0 @@
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;
}
}

View File

@ -1,39 +0,0 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class BrowserWindow {
WebDriver driver;
@FindBy(xpath = "//*[@id=\"email\"]")
private WebElement textFieldEmail;
@FindBy(className = "btn")
private WebElement btnSubscribe;
@FindBy(css = ".widebox h3")
private List<WebElement> text;
public BrowserWindow(WebDriver driver) {
this.driver = driver;
}
public void insertText(String text) {
textFieldEmail.sendKeys(text);
}
public void clickSubscribe() {
btnSubscribe.click();
}
public boolean subscribeTrue() {
if (text.get(1).getText().contains("Ваши данные приняты")) {
return true;
}
return false;
}
}

View File

@ -1,55 +0,0 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import java.util.List;
public class PageFirm1C {
WebDriver driver;
@FindBy(css = ".sidebar-menu li")
private List<WebElement> itemMenu;
@FindBy(xpath = "//*[@id=\"main_field\"]/h4[1]/a")
private WebElement linlVacancy;
private static int systemManagmentMenuElementNumber = 5;
public PageFirm1C(WebDriver driver) {
this.driver = driver;
}
public void clickSystemManagment() {
itemMenu.get(systemManagmentMenuElementNumber).click();
}
public void clickLeftMenu(int number) {
itemMenu.get(number).click();
}
public void clickVacancy() {
itemMenu.get(4).click();
}
public void clickVacancyLink() {
linlVacancy.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public boolean disposalVacancyList() {
return driver.findElement(By.cssSelector("#dept6")).isDisplayed();
}
public boolean footerMenuList() {
return driver.findElement(By.cssSelector(".widebox")).isDisplayed();
}
}

View File

@ -1,40 +0,0 @@
package page;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.io.File;
import java.util.List;
public class PageGosCertification {
WebDriver driver;
@FindBy(css = ".widebox a")
private List<WebElement> elementImg;
public PageGosCertification(WebDriver driver) {
this.driver = driver;
}
public void clickiImg(int number) {
elementImg.get(number).click();
}
public String getFileNameImg(int elementNumber) {
String fileName = elementImg.get(elementNumber).getAttribute("href");
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
return fileName;
}
public boolean checkOpenImg(String str) {
boolean check = false;
File f = new File(str);
String s = driver.getCurrentUrl();
if (s.contains(str))
check = true;
return check;
}
}

View File

@ -1,43 +0,0 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class PageInformationRelease {
WebDriver driver;
@FindBy(className = "previous")
private WebElement elementBackBtmNews;
@FindBy(className = "next")
private WebElement elementNextBtmNews;
@FindBy(id = "pagecontentforsolr")
private WebElement content;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/div[4]")
private WebElement title;
public PageInformationRelease(WebDriver driver) {
this.driver = driver;
}
public void clickBtmBack() {
elementBackBtmNews.click();
}
public void clickBtmNext() {
elementBackBtmNews.click();
}
public boolean disposeMainInformation() {
return content.isDisplayed();
}
public boolean displayNewsInformationTrue(String str) {
return title.getText().contains(str);
}
}

View File

@ -1,46 +0,0 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageInformers {
WebDriver driver;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/textarea")
private WebElement elementCode;
@FindBy(name = "limit")
private WebElement textField;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/table/tbody/tr[4]/td/input")
private WebElement formBtn;
public PageInformers(WebDriver driver) {
this.driver = driver;
}
public void insertText(String text) {
textField.clear();
textField.sendKeys(text);
}
private String strCode;
public void clickBtn() {
formBtn.click();
strCode = elementCode.getAttribute("value");
}
public boolean checkWorkInformer() {
boolean check = false;
String strTexyField = textField.getAttribute("value");
String strCode1 = strCode;
if (strCode1.contains(strTexyField))
check = true;
return check;
}
}

View File

@ -1,43 +0,0 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageListFirm {
WebDriver driver;
@FindBy(css = ".content select")
private WebElement selectListCity;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table/tbody/tr[1]/th[2]/select/option[17]")
private WebElement itemListCity;
@FindBy(css = "tr")
private List<WebElement> tr;
public PageListFirm(WebDriver driver) {
this.driver = driver;
}
public void clickCity() {
selectListCity.click();
itemListCity.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public boolean checkSortCity() {
boolean checkSearch = false;
int count = tr.size();
for (int i = 0; i < count; i++) {
if (tr.get(i).getText().contains(itemListCity.getText()))
checkSearch = true;
}
return checkSearch;
}
}

View File

@ -1,92 +0,0 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageMain {
WebDriver driver;
@FindBy(css = ".header-navigation li")
private WebElement menuElementsList;
@FindBy(css = ".header-tools a")
private List<WebElement> menuElements;
@FindBy(css = ".footer-container .span6 .row ul a")
private List<WebElement> footerMenuElements;
@FindBy(xpath = "/html/body/div[1]/div[2]/div[3]/div[1]/a")
private WebElement buttomNewsElements;
@FindBy(css = ".span6 dl a")
private List<WebElement> linkElement;
@FindBy(className = "subscribe")
private WebElement linkElementSubscribe;
public PageMain(WebDriver driver) {
this.driver = driver;
}
public void clickHeadMenuList() {
driver.findElement(By.className("droppable")).findElement(By.tagName("span")).click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void clickMenuLink() {
menuElementsList.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void clickTopMenuItem(int number) {
menuElements.get(number).click();
}
public void clickFooterMenuItem(int number) {
footerMenuElements.get(number).click();
}
public void clickButtomNews() {
buttomNewsElements.click();
}
public void clickLinkNews() {
linkElement.get(3).click();
}
public void clickLinkNews5() {
linkElement.get(5).click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public String getTextTitleNews() {
String str = linkElement.get(3).getText();
return str;
}
public boolean menuList() {
return !(driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/ul/div/li[1]/a")).isDisplayed());
}
public boolean menuOutLink() {
return driver.findElement(By.cssSelector(".left-content")).isDisplayed();
}
}

View File

@ -1,145 +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;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
public class PageNews {
WebDriver driver;
@FindBy(name = "query")
private WebElement elementEntryField;
@FindBy(className = "btn")
private WebElement elementBtnSearch;
@FindBy(className = "next")
private WebElement elementNextBtmNews;
@FindBy(id = "date_from")
private WebElement elementDateFrom;
@FindBy(css = " .table-condensed td")
private List<WebElement> elementDateNumber;
@FindBy(id = "date_to")
private WebElement elementDateTo;
@FindBy(css = ".widebox li")
private List<WebElement> elementListNews;
@FindBy(className = "datepicker-switch")
private WebElement elementMonth;
@FindBy(className = "prev")
private WebElement elementBack;
public PageNews(WebDriver driver) {
this.driver = driver;
}
public void insertSearchText(String text) {
elementEntryField.sendKeys(text);
}
private int strDayFirst;
private int strDayLast;
private String strMonthFirst;
private String strMonthLast;
public void clickBtmSearch() {
elementBtnSearch.click();
}
public void submitSearch() {
elementEntryField.sendKeys(Keys.RETURN);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void clickSelectionDate(int number1) {
elementDateFrom.click();
elementBack.click();
elementDateNumber.get(number1).click();
strDayFirst = Integer.parseInt(elementDateNumber.get(number1).getText());
strMonthFirst = elementMonth.getText();
}
public void clickSelectionDateL(int number2) {
elementDateTo.click();
elementDateNumber.get(number2).click();
strDayLast = Integer.parseInt(elementDateNumber.get(number2).getText());
strMonthLast = elementMonth.getText();
driver.findElement(By.className("cats")).click();
}
public boolean disposeBlockNews() {
return driver.findElement(By.className("redhead")).isDisplayed();
}
public boolean checkSearchParametrsFirstLastDay() throws ParseException {
boolean checkSearch = false;
int count = elementListNews.size();
String firstDayNewsList = elementListNews.get(0).getText().substring(0, elementListNews.get(0).getText().indexOf("\n"));
String enDayNewsList = elementListNews.get(count - 1).getText().substring(0, elementListNews.get(count - 1).getText().indexOf("\n"));
String fDayNumber = elementDateFrom.getAttribute("value");
String eDayNumber = elementDateTo.getAttribute("value");
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
SimpleDateFormat oldDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault());
Date dateFirstList = oldDateFormat.parse(firstDayNewsList);
Date dateEndList = oldDateFormat.parse(enDayNewsList);
Date dateFDay = newDateFormat.parse(fDayNumber);
Date dateEDay = newDateFormat.parse(eDayNumber);
if ((dateFirstList.before(dateEDay) || dateFirstList.equals(dateEDay)) && (dateEndList.after(dateFDay) || dateEndList.equals(dateFDay)) ) {
checkSearch = true;
}
return checkSearch;
}
public boolean checkSearchParametrsLastDay() throws ParseException {
boolean checkSearch = false;
String firstDayNewsList = elementListNews.get(0).getText();
String dateTo = elementDateTo.getAttribute("value");
String dateInString = firstDayNewsList.substring(0, firstDayNewsList.indexOf("\n"));//создаю строку по заданному формату
String oldDateString = dateInString;
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
SimpleDateFormat oldDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault());
Date date = oldDateFormat.parse(oldDateString);
String result = newDateFormat.format(date);
Date date1 = newDateFormat.parse(dateTo);
if (date1.after(date) || date1.equals(date)) {
checkSearch = true;
}
return checkSearch;
}
public boolean checkSearch() {
boolean checkSearch = false;
int count = elementListNews.size();
String strSearch = elementEntryField.getAttribute("value");
for (int i = 0; i < count - 1; i++) {
if (elementListNews.get(i).getText().contains(strSearch))
checkSearch = true;
}
return checkSearch;
}
}

View File

@ -1,91 +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;
import java.util.List;
public class PagePartnersFirm {
WebDriver driver;
@FindBy(className = "btn-danger")
private WebElement elementBtn;
@FindBy(css = ".table input")
private List<WebElement> elementInput;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/div/form/span[7]/span")
private WebElement elementSpan;
public PagePartnersFirm(WebDriver driver) {
this.driver = driver;
}
public void insertSearchText(int i, String Inn,
int i1, String email,
int i2, String phone,
int i3, String name) {
elementInput.get(i).sendKeys(Inn);
elementInput.get(i2).sendKeys(phone);
elementInput.get(i1).sendKeys(email);
elementInput.get(i3).sendKeys(name);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void clickCheckBox(int cBox,
int cBox1,
int cBox2,
int cBox3,
int cBox4) {
elementInput.get(cBox).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
elementInput.get(cBox1).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
elementInput.get(cBox2).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
elementInput.get(cBox3).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
elementInput.get(cBox4).click();
}
public void clickBtnRequest() {
elementBtn.click();
}
public void submitRequest() {
elementBtn.sendKeys(Keys.RETURN);
}
public boolean displayForm() {
return elementSpan.getText().contains("Благодрим вас за отправленную анкету");
}
}

View File

@ -1,36 +0,0 @@
package page;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.io.File;
import java.util.List;
public class PagePriceList {
WebDriver driver;
@FindBy(className = "btn")
private WebElement elementBtn;
public PagePriceList(WebDriver driver) {
this.driver = driver;
}
public String getFileName() {
String fileName = elementBtn.getAttribute("href");
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
return fileName;
}
public void clickBtn() {
elementBtn.click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

View File

@ -1,24 +0,0 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageProgrammProduct {
WebDriver driver;
@FindBy(css = ".dropdown a")
private List<WebElement> elementMenu;
public PageProgrammProduct(WebDriver driver) {
this.driver = driver;
}
public void clickLeftMenu(int number) {
elementMenu.get(number).click();
}
}

View File

@ -1,42 +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;
import java.util.List;
public class PageSearch {
WebDriver driver;
@FindBy(css = ".dropdown li")
private List<WebElement> leftMenuElement;
@FindBy(css = ".header-navigation li")
private List<WebElement> topMenuElement;
@FindBy(xpath = "//*[@id=\"queryString\"]")
private WebElement searchField;
@FindBy(xpath = "//*[@id=\"searchForm\"]/button")
private WebElement searchBtn;
private static int topMenuElementNumber = 1;
public PageSearch(WebDriver driver) {
this.driver = driver;
}
public void clickLeftMenu(int number) {
leftMenuElement.get(number).click();
}
public void clickTopMenu() {
topMenuElement.get(topMenuElementNumber).click();
}
public boolean searchPage() {
return driver.findElement(By.cssSelector("#pagecontentforsolr")).isDisplayed();
}
}

View File

@ -1,60 +0,0 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageSystemManagment {
WebDriver driver;
@FindBy(css = ".widebox a")
private List<WebElement> paginationElement;
@FindBy(css = ".sidebar-menu li")
private List<WebElement> itemLeftMenu;
@FindBy(className = "scope")
private List<WebElement> elementPopUpWindow;
@FindBy(css = ".scope .from")
private WebElement windowPopUp;
@FindBy(css = ".widebox a")
private List<WebElement> elementtLinkText;
public PageSystemManagment(WebDriver driver) {
this.driver = driver;
}
public void clickLeftMenuListPagination() {
itemLeftMenu.get(4).click();
}
public void clickLeftMenuListWindiw() {
itemLeftMenu.get(3).click();
}
public void clickPaginationElement() {
paginationElement.get(3).click();
}
public void clickPopUpWindowElement() {
elementPopUpWindow.get(0).click();
}
public void clickLinkText() {
elementtLinkText.get(1).click();
}
public boolean paginationCheck() {
return driver.findElement(By.cssSelector(".ndate")).isDisplayed();
}
public boolean popUpWindowCheck() {
return windowPopUp.isDisplayed();
}
}

View File

@ -1,47 +0,0 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
public class PageUserCertification {
WebDriver driver;
@FindBy(className = "country-list-li")
private List<WebElement> itemListCountry;
@FindBy(name = "reg")
private WebElement selectListCity;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/form[2]/select/option[8]")
private WebElement itemListCity;
@FindBy(css = "tr")
private List<WebElement> tr;
public PageUserCertification(WebDriver driver) {
this.driver = driver;
}
public void clickFilterCountry(int number) {
itemListCountry.get(number).click();
}
public void clickFilterCity() {
selectListCity.click();
itemListCity.click();
}
public boolean checkSortByFilterCity() {
boolean checkSearch = false;
int count = tr.size();
for (int i = 0; i < count; i++) {
if (tr.get(i).getText().contains(itemListCity.getText()))
checkSearch = true;
}
return checkSearch;
}
}

View File

@ -1,37 +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();
}
}

View File

@ -12,7 +12,7 @@ public class SearchPage {
@FindBy(css = "input.header-search-input")
private WebElement inputField;
@FindBy(xpath = "//*[@class='menu border']/a[7]")
@FindBy(xpath = "//a[contains(@href, 'Users')]")
private WebElement usersLink;
public SearchPage(WebDriver driver) {