Edit tests

This commit is contained in:
nadya16 2018-05-03 12:48:00 +04:00
parent 78c676217f
commit 18ff938371
21 changed files with 109 additions and 269 deletions

View File

@ -6,14 +6,11 @@ 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
@ -28,72 +25,59 @@ public class Cabinet{
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);
helper.autorization(context);
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
mainPage.exitButtonClick();
Assertions.assertTrue(mainPage.isBlockPresent() );
}
@Test
public void getUserData() throws NoSuchMethodException, ParseException {
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());
}
}

View File

@ -9,15 +9,11 @@ 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
@ -25,9 +21,7 @@ public class Documents {
context = new ChromeContext();
context.start();
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
context.getDriver().get(APP_URL);
tmpPath = context.getTmpPath();
}
@ -40,31 +34,23 @@ public class Documents {
public void downloadDocs() throws InterruptedException {
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
page.clickLegislationPage();
LegislationPage legislationPage = PageFactory.initElements(context.getDriver(), LegislationPage.class);
legislationPage.clickDownloadDocLink();
String fileName = legislationPage.getFileName();
legislationPage.clickDownload();
checkDownload(fileName,100,500);
}
private void checkDownload(String fileName,int timeout, int period) throws InterruptedException {
File f = new File(tmpPath +fileName);
System.out.println(fileName);
System.out.println(f.toString());
int time=0;
while(!f.exists()&&time<timeout){
Thread.sleep(period);
time++;
}
Assertions.assertTrue(f.exists());
if(f.exists()) {
f.delete();
}
}
}

View File

@ -6,13 +6,10 @@ 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
@ -27,20 +24,18 @@ public class Filters{
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.checkFilter());
Assertions.assertTrue(page.checkRatingOrder());
}
@Test
@ -48,11 +43,9 @@ public class Filters{
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());
}
}

View File

@ -6,14 +6,12 @@ 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
@ -28,65 +26,52 @@ public class Forms{
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 ="Ваш голос изменен";
try {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
//System.out.println(reviewsPage.getText());
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();
@ -98,7 +83,4 @@ public class Forms{
Assertions.assertTrue(reviewsPage.isErrorPresent());
}
}

View File

@ -8,14 +8,12 @@ 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
@ -36,21 +34,18 @@ public class Navigation {
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));
@ -58,16 +53,12 @@ public class Navigation {
@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));
@ -80,31 +71,23 @@ public class Navigation {
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
String newsTitle = mainPage.getNewsText();
mainPage.clickNews();
NewsViewPage newsViewPage = PageFactory.initElements(context.getDriver(), NewsViewPage.class);
Assertions.assertTrue(newsViewPage.getTitle().contains(newsTitle));
}
@Test
public void doctorSpecialistView() {
context.getDriver().get(APP_URL);
AutorizationHelper helper = new AutorizationHelper();
helper.autorization(context);
MainPageDoctor page = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
page.clickTopMenuElement();
DoctorsPage doctorsPage = PageFactory.initElements(context.getDriver(), DoctorsPage.class);
String title = doctorsPage.getText();
doctorsPage.terapevtsClick();
SpecialistsViewPage specialistsViewPage = PageFactory.initElements(context.getDriver(), SpecialistsViewPage.class);
System.out.println( "Button Text = " + title);
Assertions.assertTrue(specialistsViewPage.getTitle().contains(title));
}
@ -113,22 +96,14 @@ public class Navigation {
context.getDriver().get(APP_URL);
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
mainPage.scroll();
try {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
Assertions.assertTrue(mainPage.isButtonUpPresent());
}
@Test
public void vacancyDescriptionView() throws NoSuchMethodException, ParseException {
context.getDriver().get(APP_URL);
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
mainPage.clickAboutPage();
AboutPage aboutPage = PageFactory.initElements(context.getDriver(), AboutPage.class);
aboutPage.vacancyClick();
aboutPage.dropdownClick();

View File

@ -8,13 +8,10 @@ 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
@ -48,9 +45,9 @@ public class Search{
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();
@ -61,7 +58,6 @@ public class Search{
@Test
public void searchHospitalByName() throws NoSuchMethodException, ParseException {
context.getDriver().get(APP_URL);
MainPageDoctor mainPage = PageFactory.initElements(context.getDriver(), MainPageDoctor.class);
mainPage.clickHospitalsPage();
@ -69,10 +65,9 @@ public class Search{
HospitalsPage page = PageFactory.initElements(context.getDriver(), HospitalsPage.class);
page.setSearchString(searchString);
String title = page.chooseHospital();
//System.out.println( "Hospitals List text = " + title);
page.searchHospitalClick();
SearchHospitalByNameResultPage searchResultsPage = PageFactory.initElements(context.getDriver(), SearchHospitalByNameResultPage.class);
Assertions.assertTrue(searchResultsPage.getTitle().contains(title));
}
}

View File

@ -8,40 +8,35 @@ 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
;
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();
}
}

View File

@ -1,5 +1,6 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@ -8,9 +9,9 @@ package page;
import java.util.List;
public class CabinetPage {
private WebDriver driver;
private WebDriverWait wait;
@FindBy(xpath = "//*[@id=\"cards\"]/a[1]")
private WebElement getData;
@ -44,6 +45,7 @@ public class CabinetPage {
public CabinetPage(WebDriver driver) {
this.driver = driver;
wait = new WebDriverWait(driver,30,500);
}
public void getDataClick(){
@ -62,19 +64,12 @@ public class CabinetPage {
addToCardsList.click();
addCard.click();
yesButton.click();
try {
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[8]/div[1]/button")));
closeButton.click();
}
public void deleteUserCard(){
try {
Thread.sleep(5000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"CardFiles\"]/tbody/tr/td[6]/a")));
deleteButton.click();
deleteButtonYes.click();
}
@ -82,6 +77,4 @@ public class CabinetPage {
public boolean isCardPresent() {
return cardsList.isDisplayed();
}
}

View File

@ -1,6 +1,6 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ -8,13 +8,12 @@ package page;
import java.util.List;
public class DoctorsPage {
private WebDriver driver;
@FindBy(xpath = "//*[@id=\"MainContent\"]/div[2]/div[1]/a")
private WebElement terapevts;
private WebElement terapevts;
public DoctorsPage(WebDriver driver) {
this.driver = driver;
@ -27,9 +26,8 @@ public class DoctorsPage {
public String getText(){
return terapevts.getText();
}
public void terapevtsClick(){
terapevts.click();
}
}

View File

@ -1,5 +1,6 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -12,12 +13,14 @@ 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;
@ -36,7 +39,6 @@ public class HospitalsPage {
@FindBy(css = ".ui-menu-item")
private List<WebElement> hospitalsList;
@FindBy(xpath = "//*[@id=\"search_go\"]")
private WebElement searchHospitalButton;
@ -47,6 +49,7 @@ public class HospitalsPage {
private List<WebElement> filteredHospitalsList;
public HospitalsPage(WebDriver driver) {
wait = new WebDriverWait(driver,30,500);
this.driver = driver;
}
@ -60,35 +63,17 @@ public class HospitalsPage {
public void insertStreet(String str) {
street.sendKeys(str);
try {
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"ui-id-8\"]")));
streetChoice.get(0).click();
}
public void chooseHouse() {
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-button\"]")));
houseButton.click();
try {
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"house_search-menu\"]")));
houseNumber.get(0).click();
}
public boolean isHospitalPresent() {
try {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\"foundlpu\"]/tbody")));
return element.isDisplayed();
}
@ -97,38 +82,28 @@ public class HospitalsPage {
return this;
}
public String chooseHospital() {
try {
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".ui-menu-item")));
hospitalsList.get(0).click();
return hospitalsList.get(0).getText();
}
public void searchHospitalClick(){
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
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;
}
}

View File

@ -20,12 +20,13 @@ public class LegislationPage {
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();
}

View File

@ -2,11 +2,14 @@ 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;
@ -56,14 +59,15 @@ public class MainPageDoctor {
@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();
}
@ -71,6 +75,7 @@ public class MainPageDoctor {
public String getSideMenuElementText(){
return sideMenuElement.getText();
}
public void clickSideMenuElement() {
sideMenuElement.click();
}
@ -78,6 +83,7 @@ public class MainPageDoctor {
public void clickLegislationPage(){
legislationPage.click();
}
public void clickAboutPage(){
aboutPage.click();
}
@ -85,9 +91,11 @@ public class MainPageDoctor {
public void clickRulesPage(){
rulesPage.click();
}
public void clickQuestionsAndAnswersPage(){
questionsAndAnswersPage.click();
}
public void clickAutorization(){
autorizationButton.click();
}
@ -96,7 +104,6 @@ public class MainPageDoctor {
inputField.sendKeys(text);
return this;
}
public void clickSubmitButton() {
inputField.sendKeys(Keys.RETURN);
}
@ -104,6 +111,7 @@ public class MainPageDoctor {
public String getNewsText(){
return news.getText();
}
public void clickNews(){
newsButton.click();
}
@ -118,12 +126,14 @@ public class MainPageDoctor {
}
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();
}

View File

@ -1,6 +1,6 @@
package page;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@ -29,6 +29,7 @@ public class MainPageGosuslugi {
public void insertLogin(String str) {
loginInputField.sendKeys(str);
}
public void insertPassword(String str) {
passwordInputField.sendKeys(str);
}
@ -36,9 +37,4 @@ public class MainPageGosuslugi {
public void submitButtonClick(){
submitButton.click();
}
}

View File

@ -8,7 +8,6 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
public class NewsViewPage {
private WebDriver driver;
@ -22,6 +21,4 @@ public class NewsViewPage {
public String getTitle(){
return driver.getTitle();
}
}

View File

@ -1,6 +1,6 @@
package page;
import org.openqa.selenium.By;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -40,22 +40,31 @@ public class QuestionsAndAnswersPage {
filterByRatingButton.click();
}
public boolean checkFilter() {
public boolean checkRatingOrder() {
try {
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
boolean check = true;
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());
System.out.println( "pastRating= " +pastRating+ " / currentRating= "+currentRating);
if(pastRating >= currentRating){check = true; pastRating=currentRating; }
else {check = false; break;}
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;
}
@ -66,38 +75,4 @@ public class QuestionsAndAnswersPage {
public void submitButtonClick(){
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;
// }
}

View File

@ -5,9 +5,13 @@ 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;
@ -38,8 +42,8 @@ public class ReviewsPage {
public ReviewsPage(WebDriver driver) {
this.driver = driver;
wait = new WebDriverWait(driver,30,500);
}
public void setText(String str) {
inputTextField.sendKeys(str);
}
@ -51,26 +55,29 @@ public class ReviewsPage {
public void rewiewClick(){
rewiewsButton.click();
}
public void likeRewiewClick(){
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) {
rewiewTextArea.sendKeys(str);
}
public void rewiewCheckClick(){
rewiewCheck.click();
}
public void rewiewSubmitClick(){
rewiewSubmitButton.click();
}
public boolean isErrorPresent() {
return error.isDisplayed();
}
}

View File

@ -17,6 +17,7 @@ public class RulesPage {
public String getLinkText(){
return externalLink.getText();
}
public void clickLink() {
externalLink.click();
}

View File

@ -1,6 +1,6 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ -17,15 +17,6 @@ public class SearchHospitalByNameResultPage {
}
public String getTitle(){
System.out.println( "Search Hospital by name Page Title = " + driver.getTitle().toString());
return driver.getTitle();
}
}

View File

@ -8,11 +8,9 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
public class SearchResultsPage {
private WebDriverWait wait;
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")
private List<WebElement> searchResultsTexts;
@ -22,15 +20,11 @@ public class SearchResultsPage {
}
public String getItemsText(int itemNumber){
return searchResultsTexts.get(itemNumber).getText();
}
public int getItemsCount() {
int size = searchResultsTexts.size();
return size;
}
}

View File

@ -1,6 +1,6 @@
package page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ -17,14 +17,6 @@ public class SpecialistsViewPage {
}
public String getTitle(){
System.out.println( "Page Title = " + driver.getTitle().toString());
return driver.getTitle();
}
}