Edit tests
This commit is contained in:
parent
78c676217f
commit
18ff938371
@ -6,14 +6,11 @@ import org.junit.jupiter.api.*;
|
|||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import page.*;
|
import page.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
public class Cabinet{
|
public class Cabinet{
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@ -28,72 +25,59 @@ public class Cabinet{
|
|||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void autorization() throws NoSuchMethodException, ParseException {
|
public void autorization() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
Assertions.assertTrue(mainPage.isUserPresent() );
|
Assertions.assertTrue(mainPage.isUserPresent() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void autorizationExit() throws NoSuchMethodException, ParseException {
|
public void autorizationExit() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
|
||||||
|
|
||||||
|
helper.autorization(context);
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.exitButtonClick();
|
mainPage.exitButtonClick();
|
||||||
|
|
||||||
Assertions.assertTrue(mainPage.isBlockPresent() );
|
Assertions.assertTrue(mainPage.isBlockPresent() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUserData() throws NoSuchMethodException, ParseException {
|
public void getUserDataFromGosuslugiTest() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.cabinetButtonClick();
|
mainPage.cabinetButtonClick();
|
||||||
|
|
||||||
CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
|
CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
|
||||||
cabinetPage.getDataClick();
|
cabinetPage.getDataClick();
|
||||||
|
|
||||||
if(cabinetPage.isUserPresent()){
|
if(cabinetPage.isUserPresent()){
|
||||||
cabinetPage.addNewCard();
|
cabinetPage.addNewCard();
|
||||||
cabinetPage.deleteUserCard();
|
cabinetPage.deleteUserCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertTrue(cabinetPage.isUserPresent());
|
Assertions.assertTrue(cabinetPage.isUserPresent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addCard() throws NoSuchMethodException, ParseException {
|
public void addCard() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.cabinetButtonClick();
|
mainPage.cabinetButtonClick();
|
||||||
|
|
||||||
CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
|
CabinetPage cabinetPage = PageFactory.initElements(context.getDriver(), CabinetPage.class);
|
||||||
cabinetPage.getDataClick();
|
cabinetPage.getDataClick();
|
||||||
cabinetPage.addNewCard();
|
cabinetPage.addNewCard();
|
||||||
cabinetPage.deleteUserCard();
|
cabinetPage.deleteUserCard();
|
||||||
|
|
||||||
Assertions.assertTrue(cabinetPage.isCardPresent());
|
Assertions.assertTrue(cabinetPage.isCardPresent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -9,15 +9,11 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import page.LegislationPage;
|
import page.LegislationPage;
|
||||||
import page.MainPageDoctor;
|
import page.MainPageDoctor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class Documents {
|
public class Documents {
|
||||||
|
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
private static String tmpPath;
|
private static String tmpPath;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
@ -25,9 +21,7 @@ public class Documents {
|
|||||||
context = new ChromeContext();
|
context = new ChromeContext();
|
||||||
context.start();
|
context.start();
|
||||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
||||||
|
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
tmpPath = context.getTmpPath();
|
tmpPath = context.getTmpPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,31 +34,23 @@ public class Documents {
|
|||||||
public void downloadDocs() throws InterruptedException {
|
public void downloadDocs() throws InterruptedException {
|
||||||
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
page.clickLegislationPage();
|
page.clickLegislationPage();
|
||||||
|
|
||||||
LegislationPage legislationPage = PageFactory.initElements(context.getDriver(), LegislationPage.class);
|
LegislationPage legislationPage = PageFactory.initElements(context.getDriver(), LegislationPage.class);
|
||||||
legislationPage.clickDownloadDocLink();
|
legislationPage.clickDownloadDocLink();
|
||||||
String fileName = legislationPage.getFileName();
|
String fileName = legislationPage.getFileName();
|
||||||
legislationPage.clickDownload();
|
legislationPage.clickDownload();
|
||||||
|
|
||||||
checkDownload(fileName,100,500);
|
checkDownload(fileName,100,500);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkDownload(String fileName,int timeout, int period) throws InterruptedException {
|
private void checkDownload(String fileName,int timeout, int period) throws InterruptedException {
|
||||||
|
|
||||||
File f = new File(tmpPath +fileName);
|
File f = new File(tmpPath +fileName);
|
||||||
System.out.println(fileName);
|
|
||||||
System.out.println(f.toString());
|
|
||||||
int time=0;
|
int time=0;
|
||||||
while(!f.exists()&&time<timeout){
|
while(!f.exists()&&time<timeout){
|
||||||
Thread.sleep(period);
|
Thread.sleep(period);
|
||||||
time++;
|
time++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assertions.assertTrue(f.exists());
|
Assertions.assertTrue(f.exists());
|
||||||
if(f.exists()) {
|
if(f.exists()) {
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -6,13 +6,10 @@ import org.junit.jupiter.api.*;
|
|||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import page.*;
|
import page.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
|
|
||||||
public class Filters{
|
public class Filters{
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@ -27,20 +24,18 @@ public class Filters{
|
|||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void filterByRating() throws NoSuchMethodException, ParseException {
|
public void filterByRating() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickQuestionsAndAnswersPage();
|
mainPage.clickQuestionsAndAnswersPage();
|
||||||
|
|
||||||
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
||||||
page.filterByRatingClick();
|
page.filterByRatingClick();
|
||||||
Assertions.assertTrue(page.checkFilter());
|
|
||||||
|
Assertions.assertTrue(page.checkRatingOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -48,11 +43,9 @@ public class Filters{
|
|||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickHospitalsPage();
|
mainPage.clickHospitalsPage();
|
||||||
|
|
||||||
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
||||||
page.hospitalViewButtonClick();
|
page.hospitalViewButtonClick();
|
||||||
|
|
||||||
Assertions.assertTrue(page.checkHospitalsFilter());
|
Assertions.assertTrue(page.checkHospitalsFilter());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -6,14 +6,12 @@ import org.junit.jupiter.api.*;
|
|||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import page.*;
|
import page.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
public class Forms{
|
public class Forms{
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@ -28,65 +26,52 @@ public class Forms{
|
|||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendQuestion() throws NoSuchMethodException, ParseException {
|
public void sendQuestion() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickQuestionsAndAnswersPage();
|
mainPage.clickQuestionsAndAnswersPage();
|
||||||
|
|
||||||
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
QuestionsAndAnswersPage page = PageFactory.initElements(context.getDriver(), QuestionsAndAnswersPage.class);
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
int randomNumber = r.nextInt();
|
int randomNumber = r.nextInt();
|
||||||
String str = "/////////////////Тестовый комментарий номер"+randomNumber;
|
String str = "/////////////////Тестовый комментарий номер"+randomNumber;
|
||||||
page.setText(str);
|
page.setText(str);
|
||||||
page.submitButtonClick();
|
page.submitButtonClick();
|
||||||
|
|
||||||
Assertions.assertTrue(page.isQuestionPresent(str));
|
Assertions.assertTrue(page.isQuestionPresent(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void likeRewiew() throws NoSuchMethodException, ParseException {
|
public void likeRewiew() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickAboutPage();
|
mainPage.clickAboutPage();
|
||||||
|
|
||||||
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
||||||
aboutPage.rewiewsClick();
|
aboutPage.rewiewsClick();
|
||||||
|
|
||||||
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
||||||
reviewsPage.likeRewiewClick();
|
reviewsPage.likeRewiewClick();
|
||||||
String str1 ="Ваш голос учтен";
|
String str1 ="Ваш голос учтен";
|
||||||
String str2 ="Ваш голос изменен";
|
String str2 ="Ваш голос изменен";
|
||||||
try {
|
|
||||||
Thread.sleep(3000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//System.out.println(reviewsPage.getText());
|
|
||||||
Assertions.assertTrue(reviewsPage.getText().equals(str1)||reviewsPage.getText().equals(str2) );
|
Assertions.assertTrue(reviewsPage.getText().equals(str1)||reviewsPage.getText().equals(str2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendRewiewWithError() throws NoSuchMethodException, ParseException {
|
public void sendRewiewWithError() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickAboutPage();
|
mainPage.clickAboutPage();
|
||||||
|
|
||||||
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
||||||
aboutPage.rewiewsClick();
|
aboutPage.rewiewsClick();
|
||||||
|
|
||||||
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
ReviewsPage reviewsPage = PageFactory.initElements(context.getDriver(), ReviewsPage.class);
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
int randomNumber = r.nextInt();
|
int randomNumber = r.nextInt();
|
||||||
@ -98,7 +83,4 @@ public class Forms{
|
|||||||
|
|
||||||
Assertions.assertTrue(reviewsPage.isErrorPresent());
|
Assertions.assertTrue(reviewsPage.isErrorPresent());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -8,14 +8,12 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import page.*;
|
import page.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class Navigation {
|
public class Navigation {
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
@ -36,38 +34,31 @@ public class Navigation {
|
|||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
String menuElementText = mainPage.getTopMenuElementText();
|
String menuElementText = mainPage.getTopMenuElementText();
|
||||||
mainPage.clickTopMenuElement();
|
mainPage.clickTopMenuElement();
|
||||||
|
|
||||||
|
|
||||||
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
|
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
|
||||||
String title = doctorsPage.getTitle();
|
String title = doctorsPage.getTitle();
|
||||||
|
|
||||||
Assertions.assertTrue(doctorsPage.getTitle().contains(menuElementText));
|
Assertions.assertTrue(doctorsPage.getTitle().contains(menuElementText));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sideMenuTest() {
|
public void sideMenuTest() {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
String menuElementText = mainPage.getSideMenuElementText();
|
String menuElementText = mainPage.getSideMenuElementText();
|
||||||
mainPage.clickSideMenuElement();
|
mainPage.clickSideMenuElement();
|
||||||
|
|
||||||
|
|
||||||
NewsPage newsPage = PageFactory.initElements(context.getDriver(), NewsPage.class);
|
NewsPage newsPage = PageFactory.initElements(context.getDriver(), NewsPage.class);
|
||||||
|
|
||||||
Assertions.assertTrue(newsPage.getTitle().contains(menuElementText));
|
Assertions.assertTrue(newsPage.getTitle().contains(menuElementText));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void externalLinks() {
|
public void externalLinks() {
|
||||||
|
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
page.clickRulesPage();
|
page.clickRulesPage();
|
||||||
|
|
||||||
RulesPage navigationPage = PageFactory.initElements(context.getDriver(), RulesPage.class);
|
RulesPage navigationPage = PageFactory.initElements(context.getDriver(), RulesPage.class);
|
||||||
|
|
||||||
String title = "Витакор";
|
String title = "Витакор";
|
||||||
navigationPage.clickLink();
|
navigationPage.clickLink();
|
||||||
|
|
||||||
ArrayList<String> tabs = new ArrayList<String> (context.getDriver().getWindowHandles());
|
ArrayList<String> tabs = new ArrayList<String> (context.getDriver().getWindowHandles());
|
||||||
context.getDriver().switchTo().window(tabs.get(0));
|
context.getDriver().switchTo().window(tabs.get(0));
|
||||||
|
|
||||||
@ -80,31 +71,23 @@ public class Navigation {
|
|||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
String newsTitle = mainPage.getNewsText();
|
String newsTitle = mainPage.getNewsText();
|
||||||
mainPage.clickNews();
|
mainPage.clickNews();
|
||||||
|
|
||||||
NewsViewPage newsViewPage = PageFactory.initElements(context.getDriver(), NewsViewPage.class);
|
NewsViewPage newsViewPage = PageFactory.initElements(context.getDriver(), NewsViewPage.class);
|
||||||
|
|
||||||
Assertions.assertTrue(newsViewPage.getTitle().contains(newsTitle));
|
Assertions.assertTrue(newsViewPage.getTitle().contains(newsTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void doctorSpecialistView() {
|
public void doctorSpecialistView() {
|
||||||
|
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
|
|
||||||
AutorizationHelper helper = new AutorizationHelper();
|
AutorizationHelper helper = new AutorizationHelper();
|
||||||
helper.autorization(context);
|
helper.autorization(context);
|
||||||
|
|
||||||
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
page.clickTopMenuElement();
|
page.clickTopMenuElement();
|
||||||
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
|
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
|
||||||
|
|
||||||
String title = doctorsPage.getText();
|
String title = doctorsPage.getText();
|
||||||
doctorsPage.terapevtsClick();
|
doctorsPage.terapevtsClick();
|
||||||
|
|
||||||
SpecialistsViewPage specialistsViewPage = PageFactory.initElements(context.getDriver(), SpecialistsViewPage.class);
|
SpecialistsViewPage specialistsViewPage = PageFactory.initElements(context.getDriver(), SpecialistsViewPage.class);
|
||||||
|
|
||||||
System.out.println( "Button Text = " + title);
|
|
||||||
Assertions.assertTrue(specialistsViewPage.getTitle().contains(title));
|
Assertions.assertTrue(specialistsViewPage.getTitle().contains(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,26 +96,18 @@ public class Navigation {
|
|||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.scroll();
|
mainPage.scroll();
|
||||||
try {
|
|
||||||
Thread.sleep(3000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Assertions.assertTrue(mainPage.isButtonUpPresent());
|
Assertions.assertTrue(mainPage.isButtonUpPresent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void vacancyDescriptionView() throws NoSuchMethodException, ParseException {
|
public void vacancyDescriptionView() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickAboutPage();
|
mainPage.clickAboutPage();
|
||||||
|
|
||||||
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
|
||||||
aboutPage.vacancyClick();
|
aboutPage.vacancyClick();
|
||||||
aboutPage.dropdownClick();
|
aboutPage.dropdownClick();
|
||||||
|
|
||||||
Assertions.assertTrue(aboutPage.isDescriptionPresent());
|
Assertions.assertTrue(aboutPage.isDescriptionPresent());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,13 +8,10 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.openqa.selenium.Dimension;
|
import org.openqa.selenium.Dimension;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import page.*;
|
import page.*;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
|
|
||||||
public class Search{
|
public class Search{
|
||||||
private final static String APP_URL = "https://doctor73.ru/";
|
private final static String APP_URL = "https://doctor73.ru/";
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
@ -48,9 +45,9 @@ public class Search{
|
|||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
page.clickHospitalsPage();
|
page.clickHospitalsPage();
|
||||||
|
|
||||||
HospitalsPage hospitalsPage = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
HospitalsPage hospitalsPage = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
||||||
String street = "Филатова";
|
String street = "Филатова";
|
||||||
|
|
||||||
hospitalsPage.searchByAddressButtonClick();
|
hospitalsPage.searchByAddressButtonClick();
|
||||||
hospitalsPage.insertStreet(street);
|
hospitalsPage.insertStreet(street);
|
||||||
hospitalsPage.chooseHouse();
|
hospitalsPage.chooseHouse();
|
||||||
@ -61,7 +58,6 @@ public class Search{
|
|||||||
@Test
|
@Test
|
||||||
public void searchHospitalByName() throws NoSuchMethodException, ParseException {
|
public void searchHospitalByName() throws NoSuchMethodException, ParseException {
|
||||||
context.getDriver().get(APP_URL);
|
context.getDriver().get(APP_URL);
|
||||||
|
|
||||||
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
|
||||||
mainPage.clickHospitalsPage();
|
mainPage.clickHospitalsPage();
|
||||||
|
|
||||||
@ -69,10 +65,9 @@ public class Search{
|
|||||||
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
|
||||||
page.setSearchString(searchString);
|
page.setSearchString(searchString);
|
||||||
String title = page.chooseHospital();
|
String title = page.chooseHospital();
|
||||||
//System.out.println( "Hospitals List text = " + title);
|
|
||||||
page.searchHospitalClick();
|
page.searchHospitalClick();
|
||||||
SearchHospitalByNameResultPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchHospitalByNameResultPage.class);
|
SearchHospitalByNameResultPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchHospitalByNameResultPage.class);
|
||||||
|
|
||||||
Assertions.assertTrue(searchResultsPage.getTitle().contains(title));
|
Assertions.assertTrue(searchResultsPage.getTitle().contains(title));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
@ -8,40 +8,35 @@ import org.openqa.selenium.support.ui.WebDriverWait;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class AboutPage {
|
public class AboutPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[5]/a")
|
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[5]/a")
|
||||||
private WebElement rewiewsButton;
|
private WebElement rewiewsButton;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[6]/a")
|
@FindBy(xpath = "//*[@id=\"VerticalMenu\"]/ul/li[6]/a")
|
||||||
private WebElement vacancy;
|
private WebElement vacancy;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"ui-id-5\"]/span")
|
@FindBy(xpath = "//*[@id=\"ui-id-5\"]/span")
|
||||||
private WebElement dropdown;
|
private WebElement dropdown;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"ui-id-6\"]")
|
@FindBy(xpath = "//*[@id=\"ui-id-6\"]")
|
||||||
private WebElement vacancyDescription
|
|
||||||
;
|
|
||||||
|
|
||||||
|
private WebElement vacancyDescription;
|
||||||
|
|
||||||
public AboutPage(WebDriver driver) {
|
public AboutPage(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rewiewsClick(){
|
public void rewiewsClick(){
|
||||||
rewiewsButton.click();
|
rewiewsButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void vacancyClick(){
|
public void vacancyClick(){
|
||||||
vacancy.click();
|
vacancy.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropdownClick(){
|
public void dropdownClick(){
|
||||||
dropdown.click();
|
dropdown.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDescriptionPresent() {
|
public boolean isDescriptionPresent() {
|
||||||
return vacancyDescription.isDisplayed();
|
return vacancyDescription.isDisplayed();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
@ -8,9 +9,9 @@ package page;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class CabinetPage {
|
public class CabinetPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"cards\"]/a[1]")
|
@FindBy(xpath = "//*[@id=\"cards\"]/a[1]")
|
||||||
private WebElement getData;
|
private WebElement getData;
|
||||||
@ -44,6 +45,7 @@ public class CabinetPage {
|
|||||||
|
|
||||||
public CabinetPage(WebDriver driver) {
|
public CabinetPage(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getDataClick(){
|
public void getDataClick(){
|
||||||
@ -62,19 +64,12 @@ public class CabinetPage {
|
|||||||
addToCardsList.click();
|
addToCardsList.click();
|
||||||
addCard.click();
|
addCard.click();
|
||||||
yesButton.click();
|
yesButton.click();
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[8]/div[1]/button")));
|
||||||
Thread.sleep(5000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
closeButton.click();
|
closeButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUserCard(){
|
public void deleteUserCard(){
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"CardFiles\"]/tbody/tr/td[6]/a")));
|
||||||
Thread.sleep(5000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
deleteButton.click();
|
deleteButton.click();
|
||||||
deleteButtonYes.click();
|
deleteButtonYes.click();
|
||||||
}
|
}
|
||||||
@ -82,6 +77,4 @@ public class CabinetPage {
|
|||||||
public boolean isCardPresent() {
|
public boolean isCardPresent() {
|
||||||
return cardsList.isDisplayed();
|
return cardsList.isDisplayed();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
@ -8,13 +8,12 @@ package page;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class DoctorsPage {
|
public class DoctorsPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div[1]/a")
|
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div[1]/a")
|
||||||
private WebElement terapevts;
|
|
||||||
|
|
||||||
|
private WebElement terapevts;
|
||||||
|
|
||||||
public DoctorsPage(WebDriver driver) {
|
public DoctorsPage(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
@ -27,9 +26,8 @@ public class DoctorsPage {
|
|||||||
public String getText(){
|
public String getText(){
|
||||||
return terapevts.getText();
|
return terapevts.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void terapevtsClick(){
|
public void terapevtsClick(){
|
||||||
terapevts.click();
|
terapevts.click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.JavascriptExecutor;
|
import org.openqa.selenium.JavascriptExecutor;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
@ -12,12 +13,14 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
public class HospitalsPage {
|
public class HospitalsPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"searchbyaddress\"]/span")
|
@FindBy(xpath = "//*[@id=\"searchbyaddress\"]/span")
|
||||||
private WebElement searchByAddressButton;
|
private WebElement searchByAddressButton;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"street_search\"]")
|
@FindBy(xpath = "//*[@id=\"street_search\"]")
|
||||||
private WebElement street;
|
private WebElement street;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"ui-id-8\"]")
|
@FindBy(xpath = "//*[@id=\"ui-id-8\"]")
|
||||||
private List<WebElement> streetChoice;
|
private List<WebElement> streetChoice;
|
||||||
|
|
||||||
@ -36,7 +39,6 @@ public class HospitalsPage {
|
|||||||
@FindBy(css = ".ui-menu-item")
|
@FindBy(css = ".ui-menu-item")
|
||||||
private List<WebElement> hospitalsList;
|
private List<WebElement> hospitalsList;
|
||||||
|
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"search_go\"]")
|
@FindBy(xpath = "//*[@id=\"search_go\"]")
|
||||||
private WebElement searchHospitalButton;
|
private WebElement searchHospitalButton;
|
||||||
|
|
||||||
@ -47,6 +49,7 @@ public class HospitalsPage {
|
|||||||
private List<WebElement> filteredHospitalsList;
|
private List<WebElement> filteredHospitalsList;
|
||||||
|
|
||||||
public HospitalsPage(WebDriver driver) {
|
public HospitalsPage(WebDriver driver) {
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,35 +63,17 @@ public class HospitalsPage {
|
|||||||
|
|
||||||
public void insertStreet(String str) {
|
public void insertStreet(String str) {
|
||||||
street.sendKeys(str);
|
street.sendKeys(str);
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui-id-8\"]")));
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
streetChoice.get(0).click();
|
streetChoice.get(0).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chooseHouse() {
|
public void chooseHouse() {
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-button\"]")));
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
houseButton.click();
|
houseButton.click();
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-menu\"]")));
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
houseNumber.get(0).click();
|
houseNumber.get(0).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHospitalPresent() {
|
public boolean isHospitalPresent() {
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"foundlpu\"]/tbody")));
|
||||||
Thread.sleep(3000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return element.isDisplayed();
|
return element.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,38 +82,28 @@ public class HospitalsPage {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public String chooseHospital() {
|
public String chooseHospital() {
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".ui-menu-item")));
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
hospitalsList.get(0).click();
|
hospitalsList.get(0).click();
|
||||||
|
|
||||||
return hospitalsList.get(0).getText();
|
return hospitalsList.get(0).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchHospitalClick(){
|
public void searchHospitalClick(){
|
||||||
try {
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"search_go\"]")));
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
searchHospitalButton.click();
|
searchHospitalButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hospitalViewButtonClick(){
|
public void hospitalViewButtonClick(){
|
||||||
hospitalViewButton.click();
|
hospitalViewButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHospitalViewCount(){
|
public int getHospitalViewCount(){
|
||||||
String str = hospitalViewButton.getText();
|
String str = hospitalViewButton.getText();
|
||||||
String substr = str.substring(17,18);
|
String substr = str.substring(17,18);
|
||||||
return Integer.parseInt(substr);
|
return Integer.parseInt(substr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkHospitalsFilter(){
|
public boolean checkHospitalsFilter(){
|
||||||
if(filteredHospitalsList.size()==getHospitalViewCount()) return true;
|
if(filteredHospitalsList.size()==getHospitalViewCount()) return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -20,12 +20,13 @@ public class LegislationPage {
|
|||||||
public String getFileName(){
|
public String getFileName(){
|
||||||
String fileName = downloadDoc.getAttribute("href");
|
String fileName = downloadDoc.getAttribute("href");
|
||||||
fileName = fileName.substring(fileName.lastIndexOf("/")+1);
|
fileName = fileName.substring(fileName.lastIndexOf("/")+1);
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickDownloadDocLink() {
|
public void clickDownloadDocLink() {
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickDownload() {
|
public void clickDownload() {
|
||||||
downloadDoc.click();
|
downloadDoc.click();
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,14 @@ package page;
|
|||||||
|
|
||||||
import org.openqa.selenium.*;
|
import org.openqa.selenium.*;
|
||||||
import org.openqa.selenium.support.FindBy;
|
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.util.List;
|
||||||
|
|
||||||
public class MainPageDoctor {
|
public class MainPageDoctor {
|
||||||
WebDriver driver;
|
WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[4]")
|
@FindBy(xpath = "//*[@id=\"HorizontalMenu\"]/ul/li[4]")
|
||||||
private WebElement topMenuElement;
|
private WebElement topMenuElement;
|
||||||
@ -56,14 +59,15 @@ public class MainPageDoctor {
|
|||||||
@FindBy(xpath = "//*[@id=\"AuthOK\"]/span[2]/a[1]")
|
@FindBy(xpath = "//*[@id=\"AuthOK\"]/span[2]/a[1]")
|
||||||
private WebElement cabinetButton;
|
private WebElement cabinetButton;
|
||||||
|
|
||||||
|
|
||||||
public MainPageDoctor(WebDriver driver) {
|
public MainPageDoctor(WebDriver driver) {
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTopMenuElementText(){
|
public String getTopMenuElementText(){
|
||||||
return topMenuElement.getText();
|
return topMenuElement.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickTopMenuElement() {
|
public void clickTopMenuElement() {
|
||||||
topMenuElement.click();
|
topMenuElement.click();
|
||||||
}
|
}
|
||||||
@ -71,6 +75,7 @@ public class MainPageDoctor {
|
|||||||
public String getSideMenuElementText(){
|
public String getSideMenuElementText(){
|
||||||
return sideMenuElement.getText();
|
return sideMenuElement.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickSideMenuElement() {
|
public void clickSideMenuElement() {
|
||||||
sideMenuElement.click();
|
sideMenuElement.click();
|
||||||
}
|
}
|
||||||
@ -78,6 +83,7 @@ public class MainPageDoctor {
|
|||||||
public void clickLegislationPage(){
|
public void clickLegislationPage(){
|
||||||
legislationPage.click();
|
legislationPage.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickAboutPage(){
|
public void clickAboutPage(){
|
||||||
aboutPage.click();
|
aboutPage.click();
|
||||||
}
|
}
|
||||||
@ -85,9 +91,11 @@ public class MainPageDoctor {
|
|||||||
public void clickRulesPage(){
|
public void clickRulesPage(){
|
||||||
rulesPage.click();
|
rulesPage.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickQuestionsAndAnswersPage(){
|
public void clickQuestionsAndAnswersPage(){
|
||||||
questionsAndAnswersPage.click();
|
questionsAndAnswersPage.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickAutorization(){
|
public void clickAutorization(){
|
||||||
autorizationButton.click();
|
autorizationButton.click();
|
||||||
}
|
}
|
||||||
@ -96,7 +104,6 @@ public class MainPageDoctor {
|
|||||||
inputField.sendKeys(text);
|
inputField.sendKeys(text);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickSubmitButton() {
|
public void clickSubmitButton() {
|
||||||
inputField.sendKeys(Keys.RETURN);
|
inputField.sendKeys(Keys.RETURN);
|
||||||
}
|
}
|
||||||
@ -104,6 +111,7 @@ public class MainPageDoctor {
|
|||||||
public String getNewsText(){
|
public String getNewsText(){
|
||||||
return news.getText();
|
return news.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickNews(){
|
public void clickNews(){
|
||||||
newsButton.click();
|
newsButton.click();
|
||||||
}
|
}
|
||||||
@ -118,12 +126,14 @@ public class MainPageDoctor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isButtonUpPresent() {
|
public boolean isButtonUpPresent() {
|
||||||
|
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"BackToTop\"]")));
|
||||||
return driver.findElement(By.xpath("//*[@id=\"BackToTop\"]")).isDisplayed();
|
return driver.findElement(By.xpath("//*[@id=\"BackToTop\"]")).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUserPresent() {
|
public boolean isUserPresent() {
|
||||||
return driver.findElement(By.id("lfio")).isDisplayed();
|
return driver.findElement(By.id("lfio")).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exitButtonClick(){
|
public void exitButtonClick(){
|
||||||
exitButton.click();
|
exitButton.click();
|
||||||
}
|
}
|
||||||
@ -135,4 +145,4 @@ public class MainPageDoctor {
|
|||||||
public void cabinetButtonClick(){
|
public void cabinetButtonClick(){
|
||||||
cabinetButton.click();
|
cabinetButton.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
import org.openqa.selenium.JavascriptExecutor;
|
import org.openqa.selenium.JavascriptExecutor;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
@ -29,6 +29,7 @@ public class MainPageGosuslugi {
|
|||||||
public void insertLogin(String str) {
|
public void insertLogin(String str) {
|
||||||
loginInputField.sendKeys(str);
|
loginInputField.sendKeys(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertPassword(String str) {
|
public void insertPassword(String str) {
|
||||||
passwordInputField.sendKeys(str);
|
passwordInputField.sendKeys(str);
|
||||||
}
|
}
|
||||||
@ -36,9 +37,4 @@ public class MainPageGosuslugi {
|
|||||||
public void submitButtonClick(){
|
public void submitButtonClick(){
|
||||||
submitButton.click();
|
submitButton.click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -17,4 +17,4 @@ public class NewsPage {
|
|||||||
public String getTitle(){
|
public String getTitle(){
|
||||||
return driver.getTitle();
|
return driver.getTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,6 @@ import org.openqa.selenium.support.ui.WebDriverWait;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class NewsViewPage {
|
public class NewsViewPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
|
||||||
@ -22,6 +21,4 @@ public class NewsViewPage {
|
|||||||
public String getTitle(){
|
public String getTitle(){
|
||||||
return driver.getTitle();
|
return driver.getTitle();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.JavascriptExecutor;
|
import org.openqa.selenium.JavascriptExecutor;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
@ -40,23 +40,32 @@ public class QuestionsAndAnswersPage {
|
|||||||
filterByRatingButton.click();
|
filterByRatingButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkFilter() {
|
public boolean checkRatingOrder() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
boolean checkRatingOrder = true;
|
||||||
boolean check = true;
|
|
||||||
int pastRating = Integer.parseInt(ratingPlusList.get(0).getText())+Integer.parseInt(ratingMinusList.get(0).getText());
|
int pastRating = Integer.parseInt(ratingPlusList.get(0).getText())+Integer.parseInt(ratingMinusList.get(0).getText());
|
||||||
for (int i=1; i<ratingPlusList.size(); i++){
|
for (int i=1; i<ratingPlusList.size(); i++){
|
||||||
int currentRating = Integer.parseInt(ratingPlusList.get(i).getText())+Integer.parseInt(ratingMinusList.get(i).getText());
|
int currentRating = Integer.parseInt(ratingPlusList.get(i).getText())+Integer.parseInt(ratingMinusList.get(i).getText());
|
||||||
System.out.println( "pastRating= " +pastRating+ " / currentRating= "+currentRating);
|
if(pastRating >= currentRating){checkRatingOrder = true; pastRating=currentRating; }
|
||||||
if(pastRating >= currentRating){check = true; pastRating=currentRating; }
|
else {checkRatingOrder = false; break;}
|
||||||
else {check = false; break;}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return check;
|
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) {
|
public void setText(String str) {
|
||||||
@ -66,38 +75,4 @@ public class QuestionsAndAnswersPage {
|
|||||||
public void submitButtonClick(){
|
public void submitButtonClick(){
|
||||||
submitButton.click();
|
submitButton.click();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public boolean isQuestionPresent(String str) {
|
|
||||||
boolean check = false;
|
|
||||||
for (int i=0; i<questionsList.size(); i++) {
|
|
||||||
System.out.println("str= " + str + " text/ = " + questionsList.get(i).getText());
|
|
||||||
if (questionsList.get(i).getText().equals(str)) {
|
|
||||||
check = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return check;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public boolean checkFilter1() {
|
|
||||||
// try {
|
|
||||||
// Thread.sleep(2000);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// boolean check = true;
|
|
||||||
// int pastRating = Integer.parseInt(ratingList.get(0).getText());
|
|
||||||
// for (int i=1; i<ratingList.size(); i++){
|
|
||||||
// int currentRating = Integer.parseInt(ratingList.get(i).getText());
|
|
||||||
// System.out.println( "pastRating= " +pastRating+ " / currentRating= "+currentRating);
|
|
||||||
// if(pastRating >= currentRating){check = true; pastRating=currentRating; }
|
|
||||||
// else {check = false; break;}
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// return check;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
@ -5,9 +5,13 @@ import org.openqa.selenium.interactions.Actions;
|
|||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
|
|
||||||
import java.util.List;
|
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 {
|
public class ReviewsPage {
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private WebDriverWait wait;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"NewQuestion\"]")
|
@FindBy(xpath = "//*[@id=\"NewQuestion\"]")
|
||||||
private WebElement inputTextField;
|
private WebElement inputTextField;
|
||||||
@ -30,16 +34,16 @@ public class ReviewsPage {
|
|||||||
@FindBy(xpath = "//*[@id=\"Text\"]")
|
@FindBy(xpath = "//*[@id=\"Text\"]")
|
||||||
private WebElement rewiewTextArea;
|
private WebElement rewiewTextArea;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"ComplaintAttributes_0__isChecked\"]")
|
@FindBy(xpath = "//*[@id=\"ComplaintAttributes_0__isChecked\"]")
|
||||||
private WebElement rewiewCheck;
|
private WebElement rewiewCheck;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"miss\"]")
|
@FindBy(xpath = "//*[@id=\"miss\"]")
|
||||||
private WebElement rewiewSubmitButton;
|
private WebElement rewiewSubmitButton;
|
||||||
|
|
||||||
public ReviewsPage(WebDriver driver) {
|
public ReviewsPage(WebDriver driver) {
|
||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
|
wait = new WebDriverWait(driver,30,500);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String str) {
|
public void setText(String str) {
|
||||||
inputTextField.sendKeys(str);
|
inputTextField.sendKeys(str);
|
||||||
}
|
}
|
||||||
@ -51,26 +55,29 @@ public class ReviewsPage {
|
|||||||
public void rewiewClick(){
|
public void rewiewClick(){
|
||||||
rewiewsButton.click();
|
rewiewsButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void likeRewiewClick(){
|
public void likeRewiewClick(){
|
||||||
yesButton.click();
|
yesButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText(){return text.getText();}
|
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) {
|
public void setRewiewText(String str) {
|
||||||
rewiewTextArea.sendKeys(str);
|
rewiewTextArea.sendKeys(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rewiewCheckClick(){
|
public void rewiewCheckClick(){
|
||||||
rewiewCheck.click();
|
rewiewCheck.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rewiewSubmitClick(){
|
public void rewiewSubmitClick(){
|
||||||
rewiewSubmitButton.click();
|
rewiewSubmitButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isErrorPresent() {
|
public boolean isErrorPresent() {
|
||||||
return error.isDisplayed();
|
return error.isDisplayed();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -17,7 +17,8 @@ public class RulesPage {
|
|||||||
public String getLinkText(){
|
public String getLinkText(){
|
||||||
return externalLink.getText();
|
return externalLink.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clickLink() {
|
public void clickLink() {
|
||||||
externalLink.click();
|
externalLink.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
@ -17,15 +17,6 @@ public class SearchHospitalByNameResultPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(){
|
public String getTitle(){
|
||||||
System.out.println( "Search Hospital by name Page Title = " + driver.getTitle().toString());
|
|
||||||
return driver.getTitle();
|
return driver.getTitle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -8,11 +8,9 @@ import org.openqa.selenium.support.ui.WebDriverWait;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SearchResultsPage {
|
public class SearchResultsPage {
|
||||||
|
|
||||||
private WebDriverWait wait;
|
private WebDriverWait wait;
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
|
||||||
//@FindBy(xpath = "//*[@id=\"___gcse_0\"]/div/div/div/div[5]/div[2]/div/div/div[1]/div[1]/table/tbody/tr/td[2]/div[2]")
|
|
||||||
@FindBy(css = ".gs-bidi-start-align .gs-snippet")
|
@FindBy(css = ".gs-bidi-start-align .gs-snippet")
|
||||||
private List<WebElement> searchResultsTexts;
|
private List<WebElement> searchResultsTexts;
|
||||||
|
|
||||||
@ -22,15 +20,11 @@ public class SearchResultsPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getItemsText(int itemNumber){
|
public String getItemsText(int itemNumber){
|
||||||
|
|
||||||
return searchResultsTexts.get(itemNumber).getText();
|
return searchResultsTexts.get(itemNumber).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemsCount() {
|
public int getItemsCount() {
|
||||||
int size = searchResultsTexts.size();
|
int size = searchResultsTexts.size();
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package page;
|
package page;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||||
@ -17,14 +17,6 @@ public class SpecialistsViewPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(){
|
public String getTitle(){
|
||||||
System.out.println( "Page Title = " + driver.getTitle().toString());
|
|
||||||
return driver.getTitle();
|
return driver.getTitle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user