Vasileva #4
156
Vasileva/.gitignore
vendored
Normal file
156
Vasileva/.gitignore
vendored
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/intellij,java,maven,gradle,eclipse,netbeans
|
||||||
|
|
||||||
|
### Intellij ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
## Directory-based project format:
|
||||||
|
.idea/
|
||||||
|
.target
|
||||||
|
# if you remove the above rule, at least ignore the following:
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
# .idea/workspace.xml
|
||||||
|
# .idea/tasks.xml
|
||||||
|
# .idea/dictionaries
|
||||||
|
# .idea/shelf
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
# .idea/dataSources.ids
|
||||||
|
# .idea/dataSources.xml
|
||||||
|
# .idea/sqlDataSources.xml
|
||||||
|
# .idea/dynamic.xml
|
||||||
|
# .idea/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
# .idea/gradle.xml
|
||||||
|
# .idea/libraries
|
||||||
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
# .idea/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
|
||||||
|
### Maven ###
|
||||||
|
target/
|
||||||
|
pom.xml.tag
|
||||||
|
pom.xml.releaseBackup
|
||||||
|
pom.xml.versionsBackup
|
||||||
|
pom.xml.next
|
||||||
|
release.properties
|
||||||
|
dependency-reduced-pom.xml
|
||||||
|
buildNumber.properties
|
||||||
|
.mvn/timing.properties
|
||||||
|
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# PyDev specific (Python IDE for Eclipse)
|
||||||
|
*.pydevproject
|
||||||
|
|
||||||
|
# CDT-specific (C/C++ Development Tooling)
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
# Java annotation processor (APT)
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# PDT-specific (PHP Development Tools)
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
# sbteclipse plugin
|
||||||
|
.target
|
||||||
|
|
||||||
|
# TeXlipse plugin
|
||||||
|
.texlipse
|
||||||
|
|
||||||
|
# STS (Spring Tool Suite)
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
*.log
|
||||||
|
|
||||||
|
csv/
|
0
Vasileva/.gitkeep
Normal file
0
Vasileva/.gitkeep
Normal file
2
Vasileva/README.md
Normal file
2
Vasileva/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Selenium WebDriver example project
|
||||||
|
|
49
Vasileva/pom.xml
Normal file
49
Vasileva/pom.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>tis-2017</groupId>
|
||||||
|
<artifactId>tis-2017</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-java</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.1.0-RC1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<index>true</index>
|
||||||
|
<manifest>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
<mainClass>ru.ulstu.tis.Main</mainClass>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>lib/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
8
Vasileva/src/main/java/ru/ulstu/tis/Main.java
Normal file
8
Vasileva/src/main/java/ru/ulstu/tis/Main.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package ru.ulstu.tis;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("666");
|
||||||
|
}
|
||||||
|
}
|
BIN
Vasileva/src/main/resources/drivers/chromedriver
Normal file
BIN
Vasileva/src/main/resources/drivers/chromedriver
Normal file
Binary file not shown.
BIN
Vasileva/src/main/resources/drivers/chromedriver.exe
Normal file
BIN
Vasileva/src/main/resources/drivers/chromedriver.exe
Normal file
Binary file not shown.
BIN
Vasileva/src/main/resources/drivers/geckodriver
Normal file
BIN
Vasileva/src/main/resources/drivers/geckodriver
Normal file
Binary file not shown.
BIN
Vasileva/src/main/resources/drivers/geckodriver.exe
Normal file
BIN
Vasileva/src/main/resources/drivers/geckodriver.exe
Normal file
Binary file not shown.
83
Vasileva/src/test/java/Cabinet.java
Normal file
83
Vasileva/src/test/java/Cabinet.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
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 getUserDataFromGosuslugiTest() 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());
|
||||||
|
}
|
||||||
|
}
|
56
Vasileva/src/test/java/Documents.java
Normal file
56
Vasileva/src/test/java/Documents.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
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);
|
||||||
|
int time=0;
|
||||||
|
while(!f.exists()&&time<timeout){
|
||||||
|
Thread.sleep(period);
|
||||||
|
time++;
|
||||||
|
}
|
||||||
|
Assertions.assertTrue(f.exists());
|
||||||
|
if(f.exists()) {
|
||||||
|
f.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
Vasileva/src/test/java/Filters.java
Normal file
51
Vasileva/src/test/java/Filters.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public class Filters{
|
||||||
|
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 filterByRating() throws NoSuchMethodException, ParseException {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
|
helper.autorization(context);
|
||||||
|
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
mainPage.clickQuestionsAndAnswersPage();
|
||||||
|
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
||||||
|
page.filterByRatingClick();
|
||||||
|
|
||||||
|
Assertions.assertTrue(page.checkRatingOrder());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void filterClinicsByView() throws NoSuchMethodException, ParseException {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
mainPage.clickHospitalsPage();
|
||||||
|
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
||||||
|
page.hospitalViewButtonClick();
|
||||||
|
|
||||||
|
Assertions.assertTrue(page.checkHospitalsFilter());
|
||||||
|
}
|
||||||
|
}
|
86
Vasileva/src/test/java/Forms.java
Normal file
86
Vasileva/src/test/java/Forms.java
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
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 Forms{
|
||||||
|
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 sendQuestion() throws NoSuchMethodException, ParseException {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
|
helper.autorization(context);
|
||||||
|
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
mainPage.clickQuestionsAndAnswersPage();
|
||||||
|
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
||||||
|
Random r = new Random();
|
||||||
|
int randomNumber = r.nextInt();
|
||||||
|
String str = "/////////////////Тестовый комментарий номер"+randomNumber;
|
||||||
|
page.setText(str);
|
||||||
|
page.submitButtonClick();
|
||||||
|
|
||||||
|
Assertions.assertTrue(page.isQuestionPresent(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void likeRewiew() throws NoSuchMethodException, ParseException {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
|
helper.autorization(context);
|
||||||
|
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
mainPage.clickAboutPage();
|
||||||
|
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
||||||
|
aboutPage.rewiewsClick();
|
||||||
|
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
||||||
|
reviewsPage.likeRewiewClick();
|
||||||
|
String str1 ="Ваш голос учтен";
|
||||||
|
String str2 ="Ваш голос изменен";
|
||||||
|
|
||||||
|
Assertions.assertTrue(reviewsPage.getText().equals(str1)||reviewsPage.getText().equals(str2) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sendRewiewWithError() throws NoSuchMethodException, ParseException {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
|
helper.autorization(context);
|
||||||
|
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
mainPage.clickAboutPage();
|
||||||
|
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
||||||
|
aboutPage.rewiewsClick();
|
||||||
|
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
||||||
|
Random r = new Random();
|
||||||
|
int randomNumber = r.nextInt();
|
||||||
|
String str = "/////////////////Тестовый комментарий номер"+randomNumber;
|
||||||
|
reviewsPage.rewiewClick();
|
||||||
|
reviewsPage.setRewiewText(str);
|
||||||
|
reviewsPage.rewiewCheckClick();
|
||||||
|
reviewsPage.rewiewSubmitClick();
|
||||||
|
|
||||||
|
Assertions.assertTrue(reviewsPage.isErrorPresent());
|
||||||
|
}
|
||||||
|
}
|
113
Vasileva/src/test/java/Navigation.java
Normal file
113
Vasileva/src/test/java/Navigation.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
import context.ChromeContext;
|
||||||
|
import context.Context;
|
||||||
|
import helpers.AutorizationHelper;
|
||||||
|
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;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class Navigation {
|
||||||
|
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 topMenuTest() {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
String menuElementText = mainPage.getTopMenuElementText();
|
||||||
|
mainPage.clickTopMenuElement();
|
||||||
|
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
|
||||||
|
String title = doctorsPage.getTitle();
|
||||||
|
|
||||||
|
Assertions.assertTrue(doctorsPage.getTitle().contains(menuElementText));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sideMenuTest() {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
String menuElementText = mainPage.getSideMenuElementText();
|
||||||
|
mainPage.clickSideMenuElement();
|
||||||
|
NewsPage newsPage = PageFactory.initElements(context.getDriver(), NewsPage.class);
|
||||||
|
|
||||||
|
Assertions.assertTrue(newsPage.getTitle().contains(menuElementText));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void externalLinks() {
|
||||||
|
context.getDriver().get(APP_URL);
|
||||||
|
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
|
page.clickRulesPage();
|
||||||
|
RulesPage navigationPage = PageFactory.initElements(context.getDriver(), RulesPage.class);
|
||||||
|
String title = "Витакор";
|
||||||
|
navigationPage.clickLink();
|
||||||
|
ArrayList<String> tabs = new ArrayList<String> (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);
|
||||||
|
|
||||||
|
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();
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
73
Vasileva/src/test/java/Search.java
Normal file
73
Vasileva/src/test/java/Search.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
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();
|
||||||
|
page.searchHospitalClick();
|
||||||
|
SearchHospitalByNameResultPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchHospitalByNameResultPage.class);
|
||||||
|
|
||||||
|
Assertions.assertTrue(searchResultsPage.getTitle().contains(title));
|
||||||
|
}
|
||||||
|
}
|
35
Vasileva/src/test/java/context/ChromeContext.java
Normal file
35
Vasileva/src/test/java/context/ChromeContext.java
Normal file
@ -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<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;
|
||||||
|
}
|
||||||
|
}
|
52
Vasileva/src/test/java/context/Context.java
Normal file
52
Vasileva/src/test/java/context/Context.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
Vasileva/src/test/java/context/FirefoxContext.java
Normal file
24
Vasileva/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;
|
||||||
|
}
|
||||||
|
}
|
30
Vasileva/src/test/java/helpers/AutorizationHelper.java
Normal file
30
Vasileva/src/test/java/helpers/AutorizationHelper.java
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
40
Vasileva/src/test/java/helpers/SearchResultsPageHelper.java
Normal file
40
Vasileva/src/test/java/helpers/SearchResultsPageHelper.java
Normal file
@ -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});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<tryLimit) {
|
||||||
|
attemptNumber++;
|
||||||
|
breakIt = true;
|
||||||
|
try {
|
||||||
|
Thread.sleep(200);
|
||||||
|
objectToReturn = methodToCall.invoke(object, parameters);
|
||||||
|
} catch (Exception e) {
|
||||||
|
breakIt = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objectToReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
42
Vasileva/src/test/java/page/AboutPage.java
Normal file
42
Vasileva/src/test/java/page/AboutPage.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
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 AboutPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[5]/a")
|
||||||
|
private WebElement rewiewsButton;
|
||||||
|
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[6]/a")
|
||||||
|
private WebElement vacancy;
|
||||||
|
@FindBy(xpath = "//*[@id=\"ui-id-5\"]/span")
|
||||||
|
private WebElement dropdown;
|
||||||
|
@FindBy(xpath = "//*[@id=\"ui-id-6\"]")
|
||||||
|
|
||||||
|
private WebElement vacancyDescription;
|
||||||
|
|
||||||
|
public AboutPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
public void rewiewsClick(){
|
||||||
|
rewiewsButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void vacancyClick(){
|
||||||
|
vacancy.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dropdownClick(){
|
||||||
|
dropdown.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDescriptionPresent() {
|
||||||
|
return vacancyDescription.isDisplayed();
|
||||||
|
}
|
||||||
|
}
|
80
Vasileva/src/test/java/page/CabinetPage.java
Normal file
80
Vasileva/src/test/java/page/CabinetPage.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public class CabinetPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"cards\"]/a[1]")
|
||||||
|
private WebElement getData;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"considerationList\"]")
|
||||||
|
private WebElement user;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"considerationList\"]/tbody/tr/td[4]/input[9]")
|
||||||
|
private WebElement addToCardsList;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"AddCardFileSubmitButton\"]/span[2]")
|
||||||
|
private WebElement addCard;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"iconsent\"]")
|
||||||
|
private WebElement yesButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"InfoBox\"]")
|
||||||
|
private WebElement infoBox;
|
||||||
|
|
||||||
|
@FindBy(xpath = "/html/body/div[8]/div[1]/button")
|
||||||
|
private WebElement closeButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"CardFiles\"]/tbody/tr/td[6]/a")
|
||||||
|
private WebElement deleteButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "/html/body/div[13]/div[3]/div/button[1]")
|
||||||
|
private WebElement deleteButtonYes;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"CardFiles\"]")
|
||||||
|
private WebElement cardsList;
|
||||||
|
|
||||||
|
public CabinetPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getDataClick(){
|
||||||
|
getData.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUserPresent() {
|
||||||
|
return user.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfoText() {
|
||||||
|
return infoBox.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNewCard(){
|
||||||
|
addToCardsList.click();
|
||||||
|
addCard.click();
|
||||||
|
yesButton.click();
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[8]/div[1]/button")));
|
||||||
|
closeButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteUserCard(){
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"CardFiles\"]/tbody/tr/td[6]/a")));
|
||||||
|
deleteButton.click();
|
||||||
|
deleteButtonYes.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCardPresent() {
|
||||||
|
return cardsList.isDisplayed();
|
||||||
|
}
|
||||||
|
}
|
33
Vasileva/src/test/java/page/DoctorsPage.java
Normal file
33
Vasileva/src/test/java/page/DoctorsPage.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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 DoctorsPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div[1]/a")
|
||||||
|
|
||||||
|
private WebElement terapevts;
|
||||||
|
|
||||||
|
public DoctorsPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(){
|
||||||
|
return driver.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText(){
|
||||||
|
return terapevts.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void terapevtsClick(){
|
||||||
|
terapevts.click();
|
||||||
|
}
|
||||||
|
}
|
109
Vasileva/src/test/java/page/HospitalsPage.java
Normal file
109
Vasileva/src/test/java/page/HospitalsPage.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
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 HospitalsPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"searchbyaddress\"]/span")
|
||||||
|
private WebElement searchByAddressButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"street_search\"]")
|
||||||
|
private WebElement street;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"ui-id-8\"]")
|
||||||
|
private List<WebElement> streetChoice;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"house_search-button\"]")
|
||||||
|
private WebElement houseButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"house_search-menu\"]")
|
||||||
|
private List<WebElement> houseNumber;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"foundlpu\"]/tbody")
|
||||||
|
private WebElement element;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"lpu_search\"]")
|
||||||
|
private WebElement inputHospitalField;
|
||||||
|
|
||||||
|
@FindBy(css = ".ui-menu-item")
|
||||||
|
private List<WebElement> 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<WebElement> filteredHospitalsList;
|
||||||
|
|
||||||
|
public HospitalsPage(WebDriver driver) {
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(){
|
||||||
|
return driver.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void searchByAddressButtonClick(){
|
||||||
|
searchByAddressButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertStreet(String str) {
|
||||||
|
street.sendKeys(str);
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui-id-8\"]")));
|
||||||
|
streetChoice.get(0).click();
|
||||||
|
}
|
||||||
|
public void chooseHouse() {
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-button\"]")));
|
||||||
|
houseButton.click();
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-menu\"]")));
|
||||||
|
houseNumber.get(0).click();
|
||||||
|
}
|
||||||
|
public boolean isHospitalPresent() {
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"foundlpu\"]/tbody")));
|
||||||
|
return element.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HospitalsPage setSearchString(String text) {
|
||||||
|
inputHospitalField.sendKeys(text);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public String chooseHospital() {
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".ui-menu-item")));
|
||||||
|
hospitalsList.get(0).click();
|
||||||
|
|
||||||
|
return hospitalsList.get(0).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void searchHospitalClick(){
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"search_go\"]")));
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
33
Vasileva/src/test/java/page/LegislationPage.java
Normal file
33
Vasileva/src/test/java/page/LegislationPage.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
148
Vasileva/src/test/java/page/MainPageDoctor.java
Normal file
148
Vasileva/src/test/java/page/MainPageDoctor.java
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.*;
|
||||||
|
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 MainPageDoctor {
|
||||||
|
WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
|
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() {
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"BackToTop\"]")));
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
40
Vasileva/src/test/java/page/MainPageGosuslugi.java
Normal file
40
Vasileva/src/test/java/page/MainPageGosuslugi.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
20
Vasileva/src/test/java/page/NewsPage.java
Normal file
20
Vasileva/src/test/java/page/NewsPage.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
|
||||||
|
public class NewsPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]")
|
||||||
|
private WebElement element;
|
||||||
|
|
||||||
|
public NewsPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(){
|
||||||
|
return driver.getTitle();
|
||||||
|
}
|
||||||
|
}
|
24
Vasileva/src/test/java/page/NewsViewPage.java
Normal file
24
Vasileva/src/test/java/page/NewsViewPage.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
78
Vasileva/src/test/java/page/QuestionsAndAnswersPage.java
Normal file
78
Vasileva/src/test/java/page/QuestionsAndAnswersPage.java
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
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<WebElement> ratingPlusList;
|
||||||
|
|
||||||
|
@FindBy(css = ".rating-num-minus")
|
||||||
|
private List<WebElement> ratingMinusList;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"NewQuestion\"]")
|
||||||
|
private WebElement inputTextField;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"AddQuestionButton\"]")
|
||||||
|
private WebElement submitButton;
|
||||||
|
|
||||||
|
@FindBy(css = ".panel-text")
|
||||||
|
private List<WebElement> questionsList;
|
||||||
|
|
||||||
|
public QuestionsAndAnswersPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void filterByRatingClick(){
|
||||||
|
filterByRatingButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkRatingOrder() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
boolean checkRatingOrder = true;
|
||||||
|
int pastRating = Integer.parseInt(ratingPlusList.get(0).getText())+Integer.parseInt(ratingMinusList.get(0).getText());
|
||||||
|
for (int i=1; i<ratingPlusList.size(); i++){
|
||||||
|
int currentRating = Integer.parseInt(ratingPlusList.get(i).getText())+Integer.parseInt(ratingMinusList.get(i).getText());
|
||||||
|
if(pastRating >= currentRating){checkRatingOrder = true; pastRating=currentRating; }
|
||||||
|
else {checkRatingOrder = false; break;}
|
||||||
|
|
||||||
|
}
|
||||||
|
return checkRatingOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isQuestionPresent(String str){
|
||||||
|
boolean check = false;
|
||||||
|
for (int i=0; i<questionsList.size(); i++) {
|
||||||
|
if (questionsList.get(i).getText().equals(str)) {
|
||||||
|
check = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String str) {
|
||||||
|
inputTextField.sendKeys(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void submitButtonClick(){
|
||||||
|
submitButton.click();
|
||||||
|
}
|
||||||
|
}
|
83
Vasileva/src/test/java/page/ReviewsPage.java
Normal file
83
Vasileva/src/test/java/page/ReviewsPage.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.*;
|
||||||
|
import org.openqa.selenium.interactions.Actions;
|
||||||
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||||
|
|
||||||
|
public class ReviewsPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"NewQuestion\"]")
|
||||||
|
private WebElement inputTextField;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"AddQuestionButton\"]")
|
||||||
|
private WebElement submitButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div/input")
|
||||||
|
private WebElement rewiewsButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[1]/span[1]")
|
||||||
|
private WebElement yesButton;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[2]")
|
||||||
|
private WebElement text;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"star_error\"]")
|
||||||
|
private WebElement error;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"Text\"]")
|
||||||
|
private WebElement rewiewTextArea;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"ComplaintAttributes_0__isChecked\"]")
|
||||||
|
private WebElement rewiewCheck;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"miss\"]")
|
||||||
|
private WebElement rewiewSubmitButton;
|
||||||
|
|
||||||
|
public ReviewsPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
|
}
|
||||||
|
public void setText(String str) {
|
||||||
|
inputTextField.sendKeys(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void submitButtonClick(){
|
||||||
|
submitButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rewiewClick(){
|
||||||
|
rewiewsButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void likeRewiewClick(){
|
||||||
|
yesButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText(){
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"MainContent\"]/div[5]/div/div[1]/div[4]/div[2]")));
|
||||||
|
return text.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRewiewText(String str) {
|
||||||
|
rewiewTextArea.sendKeys(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rewiewCheckClick(){
|
||||||
|
rewiewCheck.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rewiewSubmitClick(){
|
||||||
|
rewiewSubmitButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isErrorPresent() {
|
||||||
|
return error.isDisplayed();
|
||||||
|
}
|
||||||
|
}
|
24
Vasileva/src/test/java/page/RulesPage.java
Normal file
24
Vasileva/src/test/java/page/RulesPage.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
|
||||||
|
public class RulesPage {
|
||||||
|
WebDriver driver;
|
||||||
|
|
||||||
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/p[2]/a")
|
||||||
|
private WebElement externalLink;
|
||||||
|
|
||||||
|
public RulesPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkText(){
|
||||||
|
return externalLink.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clickLink() {
|
||||||
|
externalLink.click();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
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 SearchHospitalByNameResultPage {
|
||||||
|
private WebDriver driver;
|
||||||
|
|
||||||
|
public SearchHospitalByNameResultPage(WebDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(){
|
||||||
|
return driver.getTitle();
|
||||||
|
}
|
||||||
|
}
|
30
Vasileva/src/test/java/page/SearchResultsPage.java
Normal file
30
Vasileva/src/test/java/page/SearchResultsPage.java
Normal file
@ -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.WebDriverWait;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SearchResultsPage {
|
||||||
|
private WebDriverWait wait;
|
||||||
|
private WebDriver driver;
|
||||||
|
|
||||||
|
@FindBy(css = ".gs-bidi-start-align .gs-snippet")
|
||||||
|
private List<WebElement> 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;
|
||||||
|
}
|
||||||
|
}
|
22
Vasileva/src/test/java/page/SpecialistsViewPage.java
Normal file
22
Vasileva/src/test/java/page/SpecialistsViewPage.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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(){
|
||||||
|
return driver.getTitle();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user