Kravchenko #11
49
Kravchenko/pom.xml
Normal file
49
Kravchenko/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>
|
7
Kravchenko/src/main/java/ru/ulstu/tis/Main.java
Normal file
7
Kravchenko/src/main/java/ru/ulstu/tis/Main.java
Normal file
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.tis;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Kravchenko/src/main/resources/drivers/chromedriver
Normal file
BIN
Kravchenko/src/main/resources/drivers/chromedriver
Normal file
Binary file not shown.
BIN
Kravchenko/src/main/resources/drivers/chromedriver.exe
Normal file
BIN
Kravchenko/src/main/resources/drivers/chromedriver.exe
Normal file
Binary file not shown.
BIN
Kravchenko/src/main/resources/drivers/geckodriver
Normal file
BIN
Kravchenko/src/main/resources/drivers/geckodriver
Normal file
Binary file not shown.
BIN
Kravchenko/src/main/resources/drivers/geckodriver.exe
Normal file
BIN
Kravchenko/src/main/resources/drivers/geckodriver.exe
Normal file
Binary file not shown.
73
Kravchenko/src/test/java/ExternalLinks.java
Normal file
73
Kravchenko/src/test/java/ExternalLinks.java
Normal file
@ -0,0 +1,73 @@
|
||||
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 ExternalLinks {
|
||||
private final static String APP_URL = "http://www.sberbank-ast.ru/";
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
@Test
|
||||
public void OpenMapTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickMap();
|
||||
ExternalPage externalPage = PageFactory.initElements(context.getDriver(), ExternalPage.class);
|
||||
Assertions.assertTrue(externalPage.isPageDisplayExternalMap());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void OpenSberkeyTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickSberkey();
|
||||
ExternalPage externalPage = PageFactory.initElements(context.getDriver(), ExternalPage.class);
|
||||
Assertions.assertTrue(externalPage.isPageDisplaySberkey());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ShareInFacebookTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickAboutUsElement();
|
||||
AboutCompanyPage aboutPage = PageFactory.initElements(context.getDriver(), AboutCompanyPage.class);
|
||||
aboutPage.clickShareElement();
|
||||
aboutPage.isPageDisplaySubmitButton();
|
||||
Assertions.assertTrue(aboutPage.isPageDisplaySubmitButton());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CommericalTendersTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickCommercialPurchases();
|
||||
ExternalPage externalPage = PageFactory.initElements(context.getDriver(), ExternalPage.class);
|
||||
Assertions.assertTrue(externalPage.isPageDisplayCommercial());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
123
Kravchenko/src/test/java/NavigationMenu.java
Normal file
123
Kravchenko/src/test/java/NavigationMenu.java
Normal file
@ -0,0 +1,123 @@
|
||||
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 NavigationMenu {
|
||||
private final static String APP_URL = "http://www.sberbank-ast.ru/";
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
@Test
|
||||
public void logotypeNavigationTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickMoreInformation();
|
||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
||||
subPage.clickLogoElement();
|
||||
Assertions.assertTrue(page.isPageDisplayMain());
|
||||
|
||||
}
|
||||
@Test
|
||||
public void menuMainNavigationTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickMenu();
|
||||
Assertions.assertTrue(page.isPageDisplayMenu());
|
||||
}
|
||||
@Test
|
||||
public void RegistrationTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickRegistration();
|
||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
||||
Assertions.assertTrue(subPage.isPageDisplayRegistration());
|
||||
|
||||
}
|
||||
@Test
|
||||
public void FeedbackTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickFeedbackElement();
|
||||
FeedbackPage feedPage = PageFactory.initElements(context.getDriver(), FeedbackPage.class);
|
||||
Assertions.assertTrue(page.isPageDisplayFeedback());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void ReestrTest(){
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickMoreInformation();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
searchPage.isPageDisplayReestr();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void AccrediationTest(){
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickAccreditationElement();
|
||||
Assertions.assertTrue(page.isPageDisplayAccreditation());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CheckNewsTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickHeadlineElement();
|
||||
page.isPageDisplayArticle();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSearchButton()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickGreenSearchButton();
|
||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
||||
Assertions.assertTrue(subPage.isRageDisplaySearch());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openTenderTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickFzElement();
|
||||
page.isPageDisplayTender();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void InfoQualityTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickQuality();
|
||||
AboutCompanyPage aboutPage = PageFactory.initElements(context.getDriver(), AboutCompanyPage.class);
|
||||
Assertions.assertTrue(aboutPage.isPageDisplayQuality());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
80
Kravchenko/src/test/java/Search.java
Normal file
80
Kravchenko/src/test/java/Search.java
Normal file
@ -0,0 +1,80 @@
|
||||
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 Search {
|
||||
private final static String APP_URL = "http://www.sberbank-ast.ru/";
|
||||
private static Context context;
|
||||
String search = "Поставка";
|
||||
|
||||
@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 searchHeaderTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
}
|
||||
@Test
|
||||
public void searchHeaderTestWithFilter() throws RuntimeException{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
searchPage.clickSearchFilter();
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
Assertions.assertTrue(searchPage.checkFilter());
|
||||
}
|
||||
@Test
|
||||
public void searchHeaderTestWithSorting() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
searchPage.clickSearchSortingElement();
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchInReestTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickReestrMenuElement();
|
||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
||||
subPage.insertSearchReestrText();
|
||||
Assertions.assertTrue(subPage.isPageDisplayContractors());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void searchSheduleTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickSheduleElement();
|
||||
ShedulePage shedPage = PageFactory.initElements(context.getDriver(), ShedulePage.class);
|
||||
shedPage.searchShedule();
|
||||
}
|
||||
}
|
68
Kravchenko/src/test/java/WorkWithDocument.java
Normal file
68
Kravchenko/src/test/java/WorkWithDocument.java
Normal file
@ -0,0 +1,68 @@
|
||||
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.HelpPage;
|
||||
import page.MainPage;
|
||||
import page.SubMenuPage;
|
||||
import java.io.File;
|
||||
|
||||
public class WorkWithDocument {
|
||||
private final static String APP_URL = "http://www.sberbank-ast.ru/";
|
||||
private static Context context;
|
||||
private static String tmpPath;
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||
tmpPath = context.getTmpPath();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenDocumentChrome() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickAnswerAndQuestionElement();
|
||||
HelpPage helpage = PageFactory.initElements(context.getDriver(), HelpPage.class);
|
||||
helpage.clickQuestionElement();
|
||||
|
||||
String fileName = helpage.getFileName();
|
||||
helpage.clickOpenDocumentElement();
|
||||
Assertions.assertTrue(helpage.checkOpen(fileName));
|
||||
}
|
||||
@Test
|
||||
public void testDownloandDocument() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickLegMenu();
|
||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
||||
Assertions.assertTrue(subPage.isPageDisplayDocuments());
|
||||
subPage.clickDownloandDocumentElement();
|
||||
String fileName = subPage.getFileName();
|
||||
checkDownload(fileName,100,100);
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
38
Kravchenko/src/test/java/context/ChromeContext.java
Normal file
38
Kravchenko/src/test/java/context/ChromeContext.java
Normal file
@ -0,0 +1,38 @@
|
||||
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() {
|
||||
// driver = new ChromeDriver();
|
||||
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);
|
||||
//prefs.put("plugins.always_open_pdf_externally", true);
|
||||
|
||||
options.setExperimentalOption("prefs",prefs);
|
||||
driver = new ChromeDriver(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
47
Kravchenko/src/test/java/context/Context.java
Normal file
47
Kravchenko/src/test/java/context/Context.java
Normal file
@ -0,0 +1,47 @@
|
||||
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();
|
||||
}
|
||||
|
||||
private boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
}
|
||||
public String getTmpPath(){
|
||||
return tmpPath;
|
||||
}
|
||||
|
||||
}
|
24
Kravchenko/src/test/java/context/FirefoxContext.java
Normal file
24
Kravchenko/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;
|
||||
}
|
||||
}
|
47
Kravchenko/src/test/java/page/AboutCompanyPage.java
Normal file
47
Kravchenko/src/test/java/page/AboutCompanyPage.java
Normal file
@ -0,0 +1,47 @@
|
||||
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 org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
|
||||
public class AboutCompanyPage {
|
||||
private WebDriver driver ;
|
||||
private WebDriverWait wait;
|
||||
public AboutCompanyPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
wait = new WebDriverWait(driver,30,500);
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"blockFacebook\"]/div/span/iframe")
|
||||
private WebElement shareFrame;
|
||||
|
||||
@FindBy(css = "#u_0_3 > button")
|
||||
private WebElement shareButton;
|
||||
|
||||
public void clickShareElement(){
|
||||
|
||||
wait.until(ExpectedConditions.visibilityOf(shareFrame));
|
||||
driver.switchTo().frame(shareFrame);
|
||||
shareButton.click();
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageDisplayQuality() {
|
||||
return driver.findElement(By.cssSelector("#ctl00_phWorkZone_ContentItem_lblbody")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isPageDisplaySubmitButton()
|
||||
{
|
||||
return driver.findElement(By.cssSelector("#u_0_0")).isDisplayed();
|
||||
}
|
||||
|
||||
|
||||
}
|
25
Kravchenko/src/test/java/page/ExternalPage.java
Normal file
25
Kravchenko/src/test/java/page/ExternalPage.java
Normal file
@ -0,0 +1,25 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class ExternalPage {
|
||||
WebDriver driver;
|
||||
|
||||
public ExternalPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
|
||||
}
|
||||
public boolean isPageDisplayExternalMap() {
|
||||
return driver.findElement(By.cssSelector("#scene")).isDisplayed();
|
||||
}
|
||||
public boolean isPageDisplaySberkey()
|
||||
{
|
||||
return driver.findElement(By.cssSelector("#FPgosuslugi")).isDisplayed();
|
||||
}
|
||||
public boolean isPageDisplayCommercial() {
|
||||
return driver.findElement(By.cssSelector("#header > div > div > " +
|
||||
"div.col-xs-8.col-md-8.master_open_logo_link > div > h3 > a")).isDisplayed();
|
||||
}
|
||||
|
||||
}
|
15
Kravchenko/src/test/java/page/FeedbackPage.java
Normal file
15
Kravchenko/src/test/java/page/FeedbackPage.java
Normal file
@ -0,0 +1,15 @@
|
||||
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.io.File;
|
||||
|
||||
public class FeedbackPage {
|
||||
WebDriver driver;
|
||||
|
||||
public boolean isPageDisplayFeedback() {
|
||||
return driver.findElement(By.cssSelector("#aspnetForm > div.master_open_content > div > div.response_list")).isDisplayed();
|
||||
}
|
||||
}
|
50
Kravchenko/src/test/java/page/HelpPage.java
Normal file
50
Kravchenko/src/test/java/page/HelpPage.java
Normal file
@ -0,0 +1,50 @@
|
||||
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.io.File;
|
||||
|
||||
public class HelpPage {
|
||||
WebDriver driver;
|
||||
|
||||
public HelpPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
|
||||
}
|
||||
|
||||
@FindBy(css = "#XMLContainer > a:nth-child(11)")
|
||||
private WebElement questElement;
|
||||
|
||||
@FindBy(css = "#XMLContainer > div:nth-child(13) > a:nth-child(11)")
|
||||
private WebElement openDocumentElement;
|
||||
|
||||
public void clickQuestionElement()
|
||||
{
|
||||
questElement.click();
|
||||
}
|
||||
|
||||
public void clickOpenDocumentElement() {
|
||||
|
||||
openDocumentElement.click();
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public String getFileName() {
|
||||
String fileName = openDocumentElement.getAttribute("href");
|
||||
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
return fileName;
|
||||
}
|
||||
public boolean checkOpen(String str) {
|
||||
boolean check = false;
|
||||
File f = new File(str);
|
||||
String s = driver.getCurrentUrl();
|
||||
if (s.contains(str))
|
||||
check = true;
|
||||
return check;
|
||||
}
|
||||
}
|
304
Kravchenko/src/test/java/page/MainPage.java
Normal file
304
Kravchenko/src/test/java/page/MainPage.java
Normal file
@ -0,0 +1,304 @@
|
||||
package page;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.*;
|
||||
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;
|
||||
|
||||
public class MainPage {
|
||||
String headline = "";
|
||||
WebDriver driver;
|
||||
private WebDriverWait wait;
|
||||
@FindBy(css = "#response_slider_wrap iframe")
|
||||
private WebElement feedbackFrame;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_content > div > " +
|
||||
"div.container.default_search > div > div.col-xs-3.col-md-3 > input")
|
||||
private WebElement moreInformationElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > div > div > ul > li:nth-child(1) > a")
|
||||
private WebElement SubmenuElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > div > div > ul >" +
|
||||
" li:nth-child(1) > ul > li:nth-child(1) > a")
|
||||
private WebElement Submenu;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > div > div > ul >" +
|
||||
" li:nth-child(1) > ul > li:nth-child(3) > a")
|
||||
private WebElement SubmenuLegislationElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div >" +
|
||||
"div > div > ul > li:nth-child(1) > ul > li:nth-child(5) > a")
|
||||
private WebElement AnswerAndQuestionElement;
|
||||
|
||||
@FindBy(css = "#ctl00_loginctrl_registration")
|
||||
private WebElement RegistrationElement;
|
||||
|
||||
@FindBy(css = "#ctl00_OnResponseView1_Image1")
|
||||
private WebElement FeedbackElement;
|
||||
|
||||
@FindBy(css = "#HyperLink1")
|
||||
private WebElement AllFeedbackElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"aspnetForm\"]/div[7]/div/div[4]/div/div/div[4]/p/a[1]")
|
||||
private WebElement AccreditationElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_footer > " +
|
||||
"div > div.row.master_open_footer_first > div:nth-child(3) > p > a")
|
||||
private WebElement MapElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_logo > div > div " +
|
||||
"> div.col-xs-4.col-md-4.master_open_logo_support > h3 > a")
|
||||
private WebElement helpElement;
|
||||
|
||||
@FindBy (css = "#aspnetForm > div.master_open_menu2 > div > div > div > ul > li:nth-child(3) > a")
|
||||
private WebElement reestMenuElement;
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > " +
|
||||
"ul > li:nth-child(3) > div > ul:nth-child(1) > li:nth-child(3) > a")
|
||||
private WebElement commercialPurchases;
|
||||
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > " +
|
||||
"div > div > ul > li:nth-child(3) > ul > li:nth-child(1) > a")
|
||||
private WebElement ContractorReestrElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > div > div > ul > li:nth-child(5) > a")
|
||||
private WebElement servicesElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(2) > span")
|
||||
private WebElement greenMenuElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(2) >" +
|
||||
" div > ul:nth-child(2) > li:nth-child(4) > a")
|
||||
private WebElement aboutUsElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_menu2 > div > div > div >" +
|
||||
" ul > li:nth-child(5) > ul > li:nth-child(9) > a")
|
||||
private WebElement bankGuaranteeElement;
|
||||
@FindBy(css = "#aspnetForm > div.master_open_content > div >" +
|
||||
" div.default_services > div:nth-child(2) > div:nth-child(1) > a")
|
||||
private WebElement sberkeyElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(6) > span")
|
||||
private WebElement learningElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(6) " +
|
||||
"> div > ul > li:nth-child(2) > a")
|
||||
private WebElement sheduleElement;
|
||||
|
||||
@FindBy(css = "#ctl00_phWorkZone_ContentsPreviewM_gvMain > div:nth-child(1) > h4 > a")
|
||||
private WebElement articleElement;
|
||||
|
||||
@FindBy(css = "#ctl00_phWorkZone_ContentItem_lblHeader")
|
||||
private WebElement headElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(1) > a")
|
||||
private WebElement searchGreenButton;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(3) > span")
|
||||
private WebElement purchasesElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(3) >" +
|
||||
" div > ul:nth-child(1) > li:nth-child(2) > a")
|
||||
private WebElement fzElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"177\"]")
|
||||
private WebElement testElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"127\"]")
|
||||
private WebElement numberPurchaseElement;
|
||||
|
||||
@FindBy(xpath= "//td[contains(., 'leaf:purchCode')]")
|
||||
private WebElement checkNumberElement;
|
||||
|
||||
@FindBy(css = "#ctl00_UnitedMenu_UnitedPanel > nav > ul > li:nth-child(2) " +
|
||||
"> div > ul:nth-child(2) > li:nth-child(2) > a")
|
||||
private WebElement politicElement;
|
||||
@FindBy(css = "#txtUnitedPurchaseSearch")
|
||||
private WebElement searchHeaderElement;
|
||||
@FindBy(css = "//*[@id=\"navbar-submenu\"]/div[1]/div[1]/div[2]/div[1]/div[2]/ul/li[5]/a")
|
||||
private WebElement documentsSubmenuElement;
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
wait = new WebDriverWait(driver,30,5000);
|
||||
}
|
||||
|
||||
public void clickMoreInformation() {
|
||||
moreInformationElement.click();
|
||||
}
|
||||
|
||||
public void clickMenu() {
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(SubmenuElement).perform();
|
||||
Submenu.click();
|
||||
//companySubmenuElement.sendKeys(Keys.ENTER);
|
||||
}
|
||||
|
||||
public void clickQuality() {
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(greenMenuElement).perform();
|
||||
politicElement.click();
|
||||
}
|
||||
public void clickLegMenu()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(SubmenuElement).perform();
|
||||
SubmenuLegislationElement.click();
|
||||
}
|
||||
|
||||
public void clickAnswerAndQuestionElement()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(SubmenuElement).perform();
|
||||
AnswerAndQuestionElement.click();
|
||||
}
|
||||
public void clickHelpElement()
|
||||
{
|
||||
helpElement.click();
|
||||
}
|
||||
|
||||
public void clickRegistration() {
|
||||
RegistrationElement.click();
|
||||
}
|
||||
public void clickFeedbackElement() {
|
||||
FeedbackElement.click();
|
||||
wait.until(ExpectedConditions.visibilityOf(feedbackFrame));
|
||||
driver.switchTo().frame(feedbackFrame);
|
||||
AllFeedbackElement.click();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void clickAccreditationElement() {
|
||||
|
||||
int elementPosition = AccreditationElement.getLocation().getY();
|
||||
String js = String.format("window.scroll(0, %s)", elementPosition-200);
|
||||
((JavascriptExecutor)driver).executeScript(js);
|
||||
AccreditationElement.click();
|
||||
}
|
||||
|
||||
public void clickMap() {
|
||||
|
||||
int elementPosition = MapElement.getLocation().getY();
|
||||
String js = String.format("window.scroll(0, %s)", elementPosition-200);
|
||||
((JavascriptExecutor)driver).executeScript(js);
|
||||
MapElement.click();
|
||||
}
|
||||
|
||||
public void clickSberkey()
|
||||
{
|
||||
int elementPosition = sberkeyElement.getLocation().getY();
|
||||
String js = String.format("window.scroll(0, %s)", elementPosition-200);
|
||||
((JavascriptExecutor)driver).executeScript(js);
|
||||
sberkeyElement.click();
|
||||
}
|
||||
|
||||
public void clickReestrMenuElement()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(reestMenuElement).perform();
|
||||
ContractorReestrElement.click();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void insertSearchHeaderText(String text) {
|
||||
searchHeaderElement.sendKeys(text);
|
||||
}
|
||||
|
||||
|
||||
public void clickAboutUsElement()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(greenMenuElement).perform();
|
||||
aboutUsElement.click();
|
||||
}
|
||||
|
||||
public void clickSheduleElement()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(learningElement).perform();
|
||||
sheduleElement.click();
|
||||
}
|
||||
|
||||
public void clickHeadlineElement()
|
||||
{
|
||||
int elementPosition = articleElement.getLocation().getY();
|
||||
String js = String.format("window.scroll(0, %s)", elementPosition-200);
|
||||
((JavascriptExecutor)driver).executeScript(js);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
|
||||
headline = articleElement.getText();
|
||||
articleElement.click();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String clickFzElement()
|
||||
{
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(purchasesElement).perform();
|
||||
fzElement.click();
|
||||
int elementPosition = testElement.getLocation().getY();
|
||||
String js = String.format("window.scroll(0, %s)", elementPosition-200);
|
||||
((JavascriptExecutor)driver).executeScript(js);
|
||||
String number = numberPurchaseElement.getText();
|
||||
testElement.click();
|
||||
return number;
|
||||
|
||||
}
|
||||
|
||||
public void clickCommercialPurchases(){
|
||||
Actions action = new Actions(driver);
|
||||
action.moveToElement(purchasesElement).perform();
|
||||
commercialPurchases.click();
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageDisplayTender()
|
||||
{
|
||||
String checkNumber = checkNumberElement.getText();
|
||||
return checkNumber.equals(clickFzElement());
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageDisplayArticle()
|
||||
{
|
||||
String checkheadline = headElement.getText();
|
||||
return checkheadline.equals(headline);
|
||||
}
|
||||
|
||||
public void clickGreenSearchButton()
|
||||
{
|
||||
searchGreenButton.click();
|
||||
}
|
||||
public boolean isPageDisplayFeedback() {
|
||||
return driver.findElement(By.cssSelector("#aspnetForm > div.master_open_content > div > div.response_list")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isPageDisplayAccreditation() {
|
||||
return driver.findElement(By.cssSelector("#XMLContainer > h2")).isDisplayed();
|
||||
}
|
||||
public boolean isPageDisplayMenu() {
|
||||
return driver.findElement(By.cssSelector("#aspnetForm > div.master_open_content" +
|
||||
" > div > h2:nth-child(2)")).isDisplayed();
|
||||
}
|
||||
public boolean isPageDisplayMain() {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}return driver.findElement(By.cssSelector("div.default_press:nth-child(1) > h2:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public void submitSearchHeader() {
|
||||
searchHeaderElement.sendKeys(Keys.RETURN);
|
||||
|
||||
}
|
||||
|
||||
}
|
81
Kravchenko/src/test/java/page/SearchPage.java
Normal file
81
Kravchenko/src/test/java/page/SearchPage.java
Normal file
@ -0,0 +1,81 @@
|
||||
package page;
|
||||
|
||||
import jdk.nashorn.internal.runtime.NumberToString;
|
||||
import org.openqa.selenium.By;
|
||||
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 SearchPage {
|
||||
WebDriver driver;
|
||||
@FindBy(css = ".page-result-search .list-group-item")
|
||||
private List<WebElement> listResultSearch;
|
||||
|
||||
@FindBy(css = "#searchInput")
|
||||
private WebElement searchHeaderElement;
|
||||
|
||||
@FindBy (css = "#filters > div > table > tbody > tr:nth-child(1) > " +
|
||||
"td:nth-child(2) > button.element-in-one-row.simple-button.orange-background")
|
||||
private WebElement addFilterButton;
|
||||
|
||||
@FindBy (css = "#specialFilters > table:nth-child(3) > tbody > tr:nth-child(1)" +
|
||||
" > td:nth-child(2) > span:nth-child(1) > input")
|
||||
private WebElement priceElement;
|
||||
|
||||
@FindBy (css = "#OkCansellBtns > input.simple-button.green-background")
|
||||
private WebElement searchButton;
|
||||
|
||||
@FindBy(css = "#resultTbl > tbody > tr:nth-child(1) >" +
|
||||
" td:nth-child(1) > div:nth-child(3) > span.es-el-amount")
|
||||
private WebElement resultElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div/div[4]/button[2]")
|
||||
private WebElement searchFilterElement;
|
||||
@FindBy(css = "#sortControls > a:nth-child(6)")
|
||||
private WebElement searchSortingElement;
|
||||
|
||||
double pr = 1000000;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isPageDisplayReestr(){
|
||||
return driver.findElement(By.cssSelector("#aspnetForm > div.master_open_content >" +
|
||||
" div > div > h2")).isDisplayed();
|
||||
}
|
||||
public void clickSearchFilter() {
|
||||
addFilterButton.click();
|
||||
String b = String.valueOf(pr);
|
||||
priceElement.sendKeys(b);
|
||||
searchButton.click();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void clickSearchSortingElement() {
|
||||
searchSortingElement.click();
|
||||
}
|
||||
public boolean checkSearch(String strSearch) {
|
||||
boolean checkSearch = false;
|
||||
int count = listResultSearch.size();
|
||||
for (int i = 0; i < count - 1; i++) {
|
||||
if (listResultSearch.get(i).getText().contains(strSearch))
|
||||
checkSearch = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkFilter()
|
||||
{
|
||||
double b = Math.round(Double.parseDouble(resultElement.getText().replaceAll(" ", "")));
|
||||
return b > pr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
44
Kravchenko/src/test/java/page/ShedulePage.java
Normal file
44
Kravchenko/src/test/java/page/ShedulePage.java
Normal file
@ -0,0 +1,44 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.*;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class ShedulePage
|
||||
{
|
||||
WebDriver driver;
|
||||
String typeText;
|
||||
@FindBy(css = "#FilterContainer > table > tbody > tr > td > table > " +
|
||||
"tbody > tr:nth-child(5) > td:nth-child(2) > input.btnBasic.btnType3.btnFilter")
|
||||
private WebElement chooseTypeButton;
|
||||
|
||||
@FindBy(id = "spravIframe")
|
||||
private WebElement listFrame;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"99\"]")
|
||||
private WebElement typeElement;
|
||||
|
||||
@FindBy(css = "#ctl00_ctl00_phWorkZone_btnSearch")
|
||||
private WebElement searchSheduleButton;
|
||||
|
||||
public void searchShedule()
|
||||
{
|
||||
chooseTypeButton.click();
|
||||
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
driver.switchTo().frame(listFrame);
|
||||
typeElement.click();
|
||||
typeText = typeElement.getText();
|
||||
System.out.println(typeText);
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
searchSheduleButton.click();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
100
Kravchenko/src/test/java/page/SubMenuPage.java
Normal file
100
Kravchenko/src/test/java/page/SubMenuPage.java
Normal file
@ -0,0 +1,100 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
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 SubMenuPage {
|
||||
WebDriver driver;
|
||||
String text = "7736050003";
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div[3]/div[1]/a")
|
||||
private WebElement plusElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[1]/ul/li[2]/a/span")
|
||||
private WebElement hyperlinkElement;
|
||||
|
||||
@FindBy(css = "#ctl00_ctl00_A1")
|
||||
private WebElement logotypeElement;
|
||||
|
||||
@FindBy(id = "ctl0#ctl00_A10_Img2")
|
||||
private WebElement brElement;
|
||||
|
||||
@FindBy(css = "#ctl00_phWorkZone_PageContent_lblbody > div > div > div:nth-child(5) > div > h1")
|
||||
private WebElement registElement;
|
||||
|
||||
@FindBy (css = "#FilterContainer > div > table > tbody > " +
|
||||
"tr:nth-child(2) > td:nth-child(2) > input[type=\"text\"]")
|
||||
private WebElement searchReestrElement;
|
||||
|
||||
@FindBy (css = "#ctl00_ctl00_phWorkZone_btnSearch")
|
||||
private WebElement searchReestrButton;
|
||||
|
||||
@FindBy(css = "span.pager-button.pagerElem.currPageInPager")
|
||||
private List<WebElement> paginationElements;
|
||||
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[3]/ul/li[2]/a/span")
|
||||
private WebElement myFavoritesElement;
|
||||
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[1]")
|
||||
private WebElement addDocumentToFavoritesElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[3]")
|
||||
private WebElement openDocumentElement;
|
||||
|
||||
@FindBy(css = "#aspnetForm > div.master_open_content > div > " +
|
||||
"div.layout_ik > div.row.rowSeparated.textLikeEverywhere > div:nth-child(1) > a")
|
||||
private WebElement downloandDocumentElement;
|
||||
|
||||
public boolean isPageDisplayRegistration() {
|
||||
return driver.findElement(By.cssSelector("#ctl00_phWorkZone_PageContent_lblbody > " +
|
||||
"div > div > div:nth-child(5) > div > h1")).isDisplayed();
|
||||
}
|
||||
|
||||
public void insertSearchReestrText() {
|
||||
searchReestrElement.sendKeys(text);
|
||||
searchReestrButton.click();
|
||||
}
|
||||
|
||||
public void clickDownloandDocumentElement() {
|
||||
downloandDocumentElement.click();
|
||||
}
|
||||
public void clickLogoElement() {
|
||||
logotypeElement.click();
|
||||
}
|
||||
public boolean isPageDisplayContractors()
|
||||
{
|
||||
|
||||
String INN = driver.findElement(By.cssSelector("#INN")).getText();
|
||||
return INN.equals(text);
|
||||
}
|
||||
|
||||
public boolean isRageDisplaySearch()
|
||||
{
|
||||
return driver.findElement(By.cssSelector("#searchInput")).isDisplayed();
|
||||
}
|
||||
|
||||
public SubMenuPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isPageDisplayDocuments() {
|
||||
return driver.findElement(By.cssSelector("#aspnetForm > div.master_open_content >" +
|
||||
" div > div.layout_ik > div:nth-child(2) > div > h1")).isDisplayed();
|
||||
}
|
||||
public String getFileName() {
|
||||
String fileName = downloandDocumentElement.getAttribute("href");
|
||||
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user