diff --git a/Vasileva/.gitignore b/Vasileva/.gitignore
new file mode 100644
index 0000000..3bac491
--- /dev/null
+++ b/Vasileva/.gitignore
@@ -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/
\ No newline at end of file
diff --git a/Vasileva/README.md b/Vasileva/README.md
new file mode 100644
index 0000000..635e81b
--- /dev/null
+++ b/Vasileva/README.md
@@ -0,0 +1,2 @@
+Selenium WebDriver example project
+
diff --git a/Vasileva/pom.xml b/Vasileva/pom.xml
new file mode 100644
index 0000000..756ca36
--- /dev/null
+++ b/Vasileva/pom.xml
@@ -0,0 +1,49 @@
+
+
+ 4.0.0
+ tis-2017
+ tis-2017
+ 1.0
+
+ UTF-8
+ 1.8
+ 1.8
+
+
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ 3.6.0
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.1.0-RC1
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+ true
+
+ true
+ lib/
+ ru.ulstu.tis.Main
+
+
+ lib/
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Vasileva/src/main/java/ru/ulstu/tis/Main.java b/Vasileva/src/main/java/ru/ulstu/tis/Main.java
new file mode 100644
index 0000000..aa6f1d2
--- /dev/null
+++ b/Vasileva/src/main/java/ru/ulstu/tis/Main.java
@@ -0,0 +1,8 @@
+package ru.ulstu.tis;
+
+public class Main {
+
+ public static void main(String[] args) {
+ System.out.println("666");
+ }
+}
diff --git a/Vasileva/src/main/resources/drivers/chromedriver b/Vasileva/src/main/resources/drivers/chromedriver
new file mode 100644
index 0000000..02ff671
Binary files /dev/null and b/Vasileva/src/main/resources/drivers/chromedriver differ
diff --git a/Vasileva/src/main/resources/drivers/chromedriver.exe b/Vasileva/src/main/resources/drivers/chromedriver.exe
new file mode 100644
index 0000000..28a4067
Binary files /dev/null and b/Vasileva/src/main/resources/drivers/chromedriver.exe differ
diff --git a/Vasileva/src/main/resources/drivers/geckodriver b/Vasileva/src/main/resources/drivers/geckodriver
new file mode 100644
index 0000000..ba1da8c
Binary files /dev/null and b/Vasileva/src/main/resources/drivers/geckodriver differ
diff --git a/Vasileva/src/main/resources/drivers/geckodriver.exe b/Vasileva/src/main/resources/drivers/geckodriver.exe
new file mode 100644
index 0000000..6208aa8
Binary files /dev/null and b/Vasileva/src/main/resources/drivers/geckodriver.exe differ
diff --git a/Vasileva/src/test/java/Cabinet.java b/Vasileva/src/test/java/Cabinet.java
new file mode 100644
index 0000000..74f2bc9
--- /dev/null
+++ b/Vasileva/src/test/java/Cabinet.java
@@ -0,0 +1,99 @@
+import context.ChromeContext;
+import context.Context;
+import helpers.AutorizationHelper;
+import helpers.SearchResultsPageHelper;
+import org.junit.jupiter.api.*;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.support.PageFactory;
+import page.*;
+
+import java.text.ParseException;
+import java.util.Random;
+
+
+public class Cabinet{
+ private final static String APP_URL = "https://doctor73.ru/";
+
+ private static Context context;
+
+ @BeforeEach
+ public void setup() {
+ context = new ChromeContext();
+ context.start();
+ context.getDriver().manage().window().setSize(new Dimension(1600, 900));
+ }
+
+ @AfterEach
+ public void quit() {
+ context.close();
+ }
+
+
+ @Test
+ public void autorization() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ AutorizationHelper helper = new AutorizationHelper();
+ helper.autorization(context);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ Assertions.assertTrue(mainPage.isUserPresent() );
+
+ }
+
+ @Test
+ public void autorizationExit() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ AutorizationHelper helper = new AutorizationHelper();
+ helper.autorization(context);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.exitButtonClick();
+ Assertions.assertTrue(mainPage.isBlockPresent() );
+ }
+
+ @Test
+ public void getUserData() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ AutorizationHelper helper = new AutorizationHelper();
+ helper.autorization(context);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.cabinetButtonClick();
+
+ CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
+ cabinetPage.getDataClick();
+
+ if(cabinetPage.isUserPresent()){
+ cabinetPage.addNewCard();
+ cabinetPage.deleteUserCard();
+ }
+
+ Assertions.assertTrue(cabinetPage.isUserPresent());
+
+ }
+
+ @Test
+ public void addCard() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ AutorizationHelper helper = new AutorizationHelper();
+ helper.autorization(context);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.cabinetButtonClick();
+
+ CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
+ cabinetPage.getDataClick();
+ cabinetPage.addNewCard();
+ cabinetPage.deleteUserCard();
+ Assertions.assertTrue(cabinetPage.isCardPresent());
+
+ }
+
+
+
+
+}
diff --git a/Vasileva/src/test/java/Documents.java b/Vasileva/src/test/java/Documents.java
new file mode 100644
index 0000000..9d63ba4
--- /dev/null
+++ b/Vasileva/src/test/java/Documents.java
@@ -0,0 +1,70 @@
+import context.ChromeContext;
+import context.Context;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.support.PageFactory;
+import org.junit.jupiter.api.Assertions;
+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 page.LegislationPage;
+import page.MainPageDoctor;
+
+import java.io.File;
+
+public class Documents {
+
+ private final static String APP_URL = "https://doctor73.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));
+
+ context.getDriver().get(APP_URL);
+
+ tmpPath = context.getTmpPath();
+ }
+
+ @AfterAll
+ public static void quit() {
+ context.close();
+ }
+
+ @Test
+ public void downloadDocs() throws InterruptedException {
+ MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ page.clickLegislationPage();
+
+ LegislationPage legislationPage = PageFactory.initElements(context.getDriver(), LegislationPage.class);
+ legislationPage.clickDownloadDocLink();
+ String fileName = legislationPage.getFileName();
+ legislationPage.clickDownload();
+
+ checkDownload(fileName,100,500);
+ }
+
+ private void checkDownload(String fileName,int timeout, int period) throws InterruptedException {
+
+ File f = new File(tmpPath +fileName);
+ System.out.println(fileName);
+ System.out.println(f.toString());
+ int time=0;
+ while(!f.exists()&&time tabs = new ArrayList (context.getDriver().getWindowHandles());
+ context.getDriver().switchTo().window(tabs.get(0));
+
+ Assertions.assertTrue(context.getDriver().getTitle().contains(title));
+ }
+
+ @Test
+ public void newsViewTest() {
+ context.getDriver().get(APP_URL);
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ String newsTitle = mainPage.getNewsText();
+ mainPage.clickNews();
+
+ NewsViewPage newsViewPage = PageFactory.initElements(context.getDriver(), NewsViewPage.class);
+
+ Assertions.assertTrue(newsViewPage.getTitle().contains(newsTitle));
+ }
+
+ @Test
+ public void doctorSpecialistView() {
+
+ context.getDriver().get(APP_URL);
+
+
+ AutorizationHelper helper = new AutorizationHelper();
+ helper.autorization(context);
+
+ MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ page.clickTopMenuElement();
+ DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
+
+ String title = doctorsPage.getText();
+ doctorsPage.terapevtsClick();
+
+ SpecialistsViewPage specialistsViewPage = PageFactory.initElements(context.getDriver(), SpecialistsViewPage.class);
+
+ System.out.println( "Button Text = " + title);
+ Assertions.assertTrue(specialistsViewPage.getTitle().contains(title));
+ }
+
+ @Test
+ public void scroll() {
+ context.getDriver().get(APP_URL);
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.scroll();
+ try {
+ Thread.sleep(3000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ Assertions.assertTrue(mainPage.isButtonUpPresent());
+ }
+
+ @Test
+ public void vacancyDescriptionView() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.clickAboutPage();
+
+ AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
+ aboutPage.vacancyClick();
+ aboutPage.dropdownClick();
+
+ Assertions.assertTrue(aboutPage.isDescriptionPresent());
+ }
+}
diff --git a/Vasileva/src/test/java/Search.java b/Vasileva/src/test/java/Search.java
new file mode 100644
index 0000000..126fd2b
--- /dev/null
+++ b/Vasileva/src/test/java/Search.java
@@ -0,0 +1,78 @@
+import context.ChromeContext;
+import context.Context;
+import helpers.SearchResultsPageHelper;
+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 Search{
+ private final static String APP_URL = "https://doctor73.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 search() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+ String searchString = "терапевт";
+
+ MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ page.setSearchString(searchString);
+ page.clickSubmitButton();
+ SearchResultsPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchResultsPage.class);
+ SearchResultsPageHelper helper = new SearchResultsPageHelper(searchResultsPage);
+
+ Assertions.assertTrue(helper.searchResultsMatchQuery(searchString));
+ }
+
+ @Test
+ public void searchHospitalByPlace() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+ MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ page.clickHospitalsPage();
+ HospitalsPage hospitalsPage = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
+ String street = "Филатова";
+
+ hospitalsPage.searchByAddressButtonClick();
+ hospitalsPage.insertStreet(street);
+ hospitalsPage.chooseHouse();
+
+ Assertions.assertTrue(hospitalsPage.isHospitalPresent());
+ }
+
+ @Test
+ public void searchHospitalByName() throws NoSuchMethodException, ParseException {
+ context.getDriver().get(APP_URL);
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.clickHospitalsPage();
+
+ String searchString = "Кирова";
+ HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
+ page.setSearchString(searchString);
+ String title = page.chooseHospital();
+ //System.out.println( "Hospitals List text = " + title);
+ page.searchHospitalClick();
+ SearchHospitalByNameResultPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchHospitalByNameResultPage.class);
+ Assertions.assertTrue(searchResultsPage.getTitle().contains(title));
+ }
+
+}
diff --git a/Vasileva/src/test/java/context/ChromeContext.java b/Vasileva/src/test/java/context/ChromeContext.java
new file mode 100644
index 0000000..8bd1d57
--- /dev/null
+++ b/Vasileva/src/test/java/context/ChromeContext.java
@@ -0,0 +1,35 @@
+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 prefs = new HashMap();
+
+ tmpPath = "C:/Users/Надежда/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;
+ }
+}
diff --git a/Vasileva/src/test/java/context/Context.java b/Vasileva/src/test/java/context/Context.java
new file mode 100644
index 0000000..67f7b6f
--- /dev/null
+++ b/Vasileva/src/test/java/context/Context.java
@@ -0,0 +1,52 @@
+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;
+ }
+
+}
diff --git a/Vasileva/src/test/java/context/FirefoxContext.java b/Vasileva/src/test/java/context/FirefoxContext.java
new file mode 100644
index 0000000..1d5c163
--- /dev/null
+++ b/Vasileva/src/test/java/context/FirefoxContext.java
@@ -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;
+ }
+}
diff --git a/Vasileva/src/test/java/helpers/AutorizationHelper.java b/Vasileva/src/test/java/helpers/AutorizationHelper.java
new file mode 100644
index 0000000..77a84cd
--- /dev/null
+++ b/Vasileva/src/test/java/helpers/AutorizationHelper.java
@@ -0,0 +1,30 @@
+package helpers;
+
+import context.Context;
+import org.junit.jupiter.api.Assertions;
+import org.openqa.selenium.support.PageFactory;
+import page.MainPageDoctor;
+import page.MainPageGosuslugi;
+
+import java.text.ParseException;
+
+public class AutorizationHelper {
+ public void autorization(Context context) {
+
+ MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
+ mainPage.clickAutorization();
+
+ MainPageGosuslugi mainPageGosuslugi = PageFactory.initElements(context.getDriver(), MainPageGosuslugi.class);
+ String login = "nadya97vas@yandex.ru";
+ String password = "H16lprokX+";
+ try {
+ Thread.sleep(9000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ mainPageGosuslugi.insertLogin(login);
+ mainPageGosuslugi.insertPassword(password);
+ mainPageGosuslugi.submitButtonClick();
+ }
+
+}
diff --git a/Vasileva/src/test/java/helpers/SearchResultsPageHelper.java b/Vasileva/src/test/java/helpers/SearchResultsPageHelper.java
new file mode 100644
index 0000000..b1f3f8e
--- /dev/null
+++ b/Vasileva/src/test/java/helpers/SearchResultsPageHelper.java
@@ -0,0 +1,40 @@
+package helpers;
+
+import page.SearchResultsPage;
+
+import java.lang.reflect.Method;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+public class SearchResultsPageHelper {
+
+ private SearchResultsPage page;
+ public SearchResultsPageHelper(SearchResultsPage page){
+ this.page = page;
+ }
+
+ public boolean searchResultsMatchQuery(String queryString) throws ParseException, NoSuchMethodException {
+ boolean matched = true;
+
+ for (int i = 0; i < page.getItemsCount(); i++) {
+ if(!waitAngGetItemsText(i).toLowerCase().contains(queryString)){
+ matched = false;
+ break;
+ }
+ }
+ return matched;
+
+ }
+
+ public String waitAngGetItemsText(int itemNumber) throws NoSuchMethodException {
+
+ Method method = SearchResultsPage.class.getMethod("getItemsText", int.class);
+ return (String)WaitingForElementToLoadHelper.waitAndCallMethod(method,page,new Object[]{itemNumber});
+
+ }
+}
+
diff --git a/Vasileva/src/test/java/helpers/WaitingForElementToLoadHelper.java b/Vasileva/src/test/java/helpers/WaitingForElementToLoadHelper.java
new file mode 100644
index 0000000..0c6c9fa
--- /dev/null
+++ b/Vasileva/src/test/java/helpers/WaitingForElementToLoadHelper.java
@@ -0,0 +1,27 @@
+package helpers;
+
+import java.lang.reflect.Method;
+
+public class WaitingForElementToLoadHelper {
+ static int tryLimit=10;
+ static Object waitAndCallMethod(Method methodToCall,Object object,Object[] parameters ){
+
+ Object objectToReturn=null;
+ boolean breakIt=false;
+ int attemptNumber =0;
+ while (!breakIt&&attemptNumber streetChoice;
+
+ @FindBy(xpath = "//*[@id=\"house_search-button\"]")
+ private WebElement houseButton;
+
+ @FindBy(xpath = "//*[@id=\"house_search-menu\"]")
+ private List houseNumber;
+
+ @FindBy(xpath = "//*[@id=\"foundlpu\"]/tbody")
+ private WebElement element;
+
+ @FindBy(xpath = "//*[@id=\"lpu_search\"]")
+ private WebElement inputHospitalField;
+
+ @FindBy(css = ".ui-menu-item")
+ private List hospitalsList;
+
+
+ @FindBy(xpath = "//*[@id=\"search_go\"]")
+ private WebElement searchHospitalButton;
+
+ @FindBy(xpath = "//*[@id=\"MainContent\"]/div[1]/div[2]/span/a")
+ private WebElement hospitalViewButton;
+
+ @FindBy(css = ".l-vis")
+ private List filteredHospitalsList;
+
+ public HospitalsPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getTitle(){
+ return driver.getTitle();
+ }
+
+ public void searchByAddressButtonClick(){
+ searchByAddressButton.click();
+ }
+
+ public void insertStreet(String str) {
+ street.sendKeys(str);
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ streetChoice.get(0).click();
+ }
+
+ public void chooseHouse() {
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ houseButton.click();
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ houseNumber.get(0).click();
+ }
+
+ public boolean isHospitalPresent() {
+ try {
+ Thread.sleep(3000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return element.isDisplayed();
+ }
+
+ public HospitalsPage setSearchString(String text) {
+ inputHospitalField.sendKeys(text);
+ return this;
+ }
+ public String chooseHospital() {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ hospitalsList.get(0).click();
+
+ return hospitalsList.get(0).getText();
+ }
+
+ public void searchHospitalClick(){
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ searchHospitalButton.click();
+ }
+
+ public void hospitalViewButtonClick(){
+ hospitalViewButton.click();
+ }
+ public int getHospitalViewCount(){
+ String str = hospitalViewButton.getText();
+ String substr = str.substring(17,18);
+ return Integer.parseInt(substr);
+ }
+
+ public boolean checkHospitalsFilter(){
+ if(filteredHospitalsList.size()==getHospitalViewCount()) return true;
+ else return false;
+ }
+
+
+}
diff --git a/Vasileva/src/test/java/page/LegislationPage.java b/Vasileva/src/test/java/page/LegislationPage.java
new file mode 100644
index 0000000..52fdfab
--- /dev/null
+++ b/Vasileva/src/test/java/page/LegislationPage.java
@@ -0,0 +1,32 @@
+package page;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+public class LegislationPage {
+ WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"MainContent\"]/table[8]/tbody/tr[2]/td/ul/li")
+ private WebElement downloadLink;
+
+ @FindBy(xpath = "//*[@id=\"4e4a4b91-915e-4759-ad51-5daa9292f5aa\"]/div/div/table/tbody/tr[1]/td[3]/a")
+ private WebElement downloadDoc;
+
+ public LegislationPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getFileName(){
+ String fileName = downloadDoc.getAttribute("href");
+ fileName = fileName.substring(fileName.lastIndexOf("/")+1);
+
+ return fileName;
+ }
+ public void clickDownloadDocLink() {
+ downloadLink.click();
+ }
+ public void clickDownload() {
+ downloadDoc.click();
+ }
+}
\ No newline at end of file
diff --git a/Vasileva/src/test/java/page/MainPageDoctor.java b/Vasileva/src/test/java/page/MainPageDoctor.java
new file mode 100644
index 0000000..96fc371
--- /dev/null
+++ b/Vasileva/src/test/java/page/MainPageDoctor.java
@@ -0,0 +1,138 @@
+package page;
+
+import org.openqa.selenium.*;
+import org.openqa.selenium.support.FindBy;
+
+import java.util.List;
+
+public class MainPageDoctor {
+ WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[4]")
+ private WebElement topMenuElement;
+
+ @FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[2]")
+ private WebElement sideMenuElement;
+
+ @FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[9]")
+ private WebElement rulesPage;
+
+ @FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[5]")
+ private WebElement legislationPage;
+
+ @FindBy(xpath = "//*[@id=\"issearch\"]")
+ private WebElement inputField;
+
+ @FindBy(xpath = "//*[@id=\"articles\"]/div[1]/div[1]")
+ private WebElement news;
+
+ @FindBy(xpath = "//*[@id=\"articles\"]/div[1]/div[2]/div/a")
+ private WebElement newsButton;
+
+ @FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[3]/a")
+ private WebElement hospitalsPage;
+
+ @FindBy(xpath = "//*[@id=\"Footer\"]")
+ private WebElement footer;
+
+ @FindBy(xpath = "//*[@id=\"BackToTop\"]")
+ private WebElement buttonUp;
+
+ @FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[7]/a")
+ private WebElement questionsAndAnswersPage;
+
+ @FindBy(xpath = "//*[@id=\"AuthButtons\"]/button/span")
+ private WebElement autorizationButton;
+
+ @FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[2]/a")
+ private WebElement aboutPage;
+
+ @FindBy(xpath = "//*[@id=\"AuthOK\"]/span[2]/a[2]")
+ private WebElement exitButton;
+
+ @FindBy(xpath = "//*[@id=\"AuthEsia\"]")
+ private WebElement authEsia;
+
+ @FindBy(xpath = "//*[@id=\"AuthOK\"]/span[2]/a[1]")
+ private WebElement cabinetButton;
+
+
+ public MainPageDoctor(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getTopMenuElementText(){
+ return topMenuElement.getText();
+ }
+ public void clickTopMenuElement() {
+ topMenuElement.click();
+ }
+
+ public String getSideMenuElementText(){
+ return sideMenuElement.getText();
+ }
+ public void clickSideMenuElement() {
+ sideMenuElement.click();
+ }
+
+ public void clickLegislationPage(){
+ legislationPage.click();
+ }
+ public void clickAboutPage(){
+ aboutPage.click();
+ }
+
+ public void clickRulesPage(){
+ rulesPage.click();
+ }
+ public void clickQuestionsAndAnswersPage(){
+ questionsAndAnswersPage.click();
+ }
+ public void clickAutorization(){
+ autorizationButton.click();
+ }
+
+ public MainPageDoctor setSearchString(String text) {
+ inputField.sendKeys(text);
+ return this;
+ }
+
+ public void clickSubmitButton() {
+ inputField.sendKeys(Keys.RETURN);
+ }
+
+ public String getNewsText(){
+ return news.getText();
+ }
+ public void clickNews(){
+ newsButton.click();
+ }
+
+ public void clickHospitalsPage(){
+ hospitalsPage.click();
+ }
+
+ public void scroll(){
+ ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();"
+ ,footer);
+ }
+
+ public boolean isButtonUpPresent() {
+ return driver.findElement(By.xpath("//*[@id=\"BackToTop\"]")).isDisplayed();
+ }
+
+ public boolean isUserPresent() {
+ return driver.findElement(By.id("lfio")).isDisplayed();
+ }
+ public void exitButtonClick(){
+ exitButton.click();
+ }
+
+ public boolean isBlockPresent() {
+ return authEsia.isDisplayed();
+ }
+
+ public void cabinetButtonClick(){
+ cabinetButton.click();
+ }
+}
diff --git a/Vasileva/src/test/java/page/MainPageGosuslugi.java b/Vasileva/src/test/java/page/MainPageGosuslugi.java
new file mode 100644
index 0000000..ece92e6
--- /dev/null
+++ b/Vasileva/src/test/java/page/MainPageGosuslugi.java
@@ -0,0 +1,44 @@
+package page;
+
+ import org.openqa.selenium.JavascriptExecutor;
+ 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 java.util.List;
+ import java.lang.reflect.Method;
+
+public class MainPageGosuslugi {
+ private WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"mobileOrEmail\"]")
+ private WebElement loginInputField;
+
+ @FindBy(xpath = "//*[@id=\"password\"]")
+ private WebElement passwordInputField;
+
+ @FindBy(xpath = "//*[@id=\"authnFrm\"]/div[1]/div[3]/div[3]/div[2]/button")
+ private WebElement submitButton;
+
+ public MainPageGosuslugi(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public void insertLogin(String str) {
+ loginInputField.sendKeys(str);
+ }
+ public void insertPassword(String str) {
+ passwordInputField.sendKeys(str);
+ }
+
+ public void submitButtonClick(){
+ submitButton.click();
+ }
+
+
+
+
+}
+
diff --git a/Vasileva/src/test/java/page/NewsPage.java b/Vasileva/src/test/java/page/NewsPage.java
new file mode 100644
index 0000000..60e3b0f
--- /dev/null
+++ b/Vasileva/src/test/java/page/NewsPage.java
@@ -0,0 +1,20 @@
+package page;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+public class NewsPage {
+ private WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"MainContent\"]")
+ private WebElement element;
+
+ public NewsPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getTitle(){
+ return driver.getTitle();
+ }
+}
diff --git a/Vasileva/src/test/java/page/NewsViewPage.java b/Vasileva/src/test/java/page/NewsViewPage.java
new file mode 100644
index 0000000..11b96d7
--- /dev/null
+++ b/Vasileva/src/test/java/page/NewsViewPage.java
@@ -0,0 +1,27 @@
+package page;
+
+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 java.util.List;
+
+
+public class NewsViewPage {
+ private WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"MainContent\"]/div[1]")
+ private WebElement element;
+
+ public NewsViewPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getTitle(){
+ return driver.getTitle();
+ }
+
+
+}
diff --git a/Vasileva/src/test/java/page/QuestionsAndAnswersPage.java b/Vasileva/src/test/java/page/QuestionsAndAnswersPage.java
new file mode 100644
index 0000000..7a47722
--- /dev/null
+++ b/Vasileva/src/test/java/page/QuestionsAndAnswersPage.java
@@ -0,0 +1,103 @@
+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 org.openqa.selenium.support.ui.ExpectedConditions;
+ import org.openqa.selenium.support.ui.WebDriverWait;
+
+ import java.util.List;
+ import java.lang.reflect.Method;
+
+public class QuestionsAndAnswersPage {
+ private WebDriver driver;
+
+ @FindBy(xpath = "//*[@id=\"MainContent\"]/div[1]/div/span[3]/a")
+ private WebElement filterByRatingButton;
+
+ @FindBy(css = ".rating-num-plus")
+ private List ratingPlusList;
+
+ @FindBy(css = ".rating-num-minus")
+ private List ratingMinusList;
+
+ @FindBy(xpath = "//*[@id=\"NewQuestion\"]")
+ private WebElement inputTextField;
+
+ @FindBy(xpath = "//*[@id=\"AddQuestionButton\"]")
+ private WebElement submitButton;
+
+ @FindBy(css = ".panel-text")
+ private List questionsList;
+
+ public QuestionsAndAnswersPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public void filterByRatingClick(){
+ filterByRatingButton.click();
+ }
+
+ public boolean checkFilter() {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ boolean check = true;
+ int pastRating = Integer.parseInt(ratingPlusList.get(0).getText())+Integer.parseInt(ratingMinusList.get(0).getText());
+ for (int i=1; i searchResultsTexts;
+
+ public SearchResultsPage (WebDriver driver) {
+ this.driver = driver;
+ wait = new WebDriverWait(driver,30,500);
+ }
+
+ public String getItemsText(int itemNumber){
+
+ return searchResultsTexts.get(itemNumber).getText();
+ }
+ public int getItemsCount() {
+ int size = searchResultsTexts.size();
+ return size;
+
+ }
+
+
+}
+
diff --git a/Vasileva/src/test/java/page/SpecialistsViewPage.java b/Vasileva/src/test/java/page/SpecialistsViewPage.java
new file mode 100644
index 0000000..4a3beae
--- /dev/null
+++ b/Vasileva/src/test/java/page/SpecialistsViewPage.java
@@ -0,0 +1,30 @@
+package page;
+
+ 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 java.util.List;
+ import static java.lang.System.out;
+
+public class SpecialistsViewPage {
+ private WebDriver driver;
+
+ public SpecialistsViewPage(WebDriver driver) {
+ this.driver = driver;
+ }
+
+ public String getTitle(){
+ System.out.println( "Page Title = " + driver.getTitle().toString());
+ return driver.getTitle();
+
+ }
+
+
+
+
+
+}
+