This commit is contained in:
NEkaterina 2018-05-03 19:56:06 +03:00
parent 022472b1f5
commit 89e355701f
23 changed files with 333 additions and 392 deletions

View File

@ -20,12 +20,19 @@ public class DownloadDoc {
private final static String APP_URL = "https://1c.ru/"; private final static String APP_URL = "https://1c.ru/";
private static Context context; private static Context context;
private String tmpPath; private int menuItemNumber;
private int imgNumber;
private static String tmpPath;
@BeforeAll @BeforeAll
public static void setup() { public static void setup() {
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);
tmpPath = context.getTmpPath();
} }
@AfterAll @AfterAll
@ -33,37 +40,45 @@ public class DownloadDoc {
context.close(); context.close();
} }
@Test @Test
public void testDownloandZip() throws InterruptedException { public void testDownloandZip() throws InterruptedException {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
page.clickFooterMenuItem(4); menuItemNumber = 4;
page.clickFooterMenuItem(menuItemNumber);
PagePriceList pagePriceList = PageFactory.initElements(context.getDriver(), PagePriceList.class); PagePriceList pagePriceList = PageFactory.initElements(context.getDriver(), PagePriceList.class);
String fileName = pagePriceList.getFileName(); String fileName = pagePriceList.getFileName();
pagePriceList.clickBtn(); pagePriceList.clickBtn();
checkDownload(fileName,100,100);
Assertions.assertTrue(pagePriceList.isFileDownloaded(fileName));
} }
@Test @Test
public void testDownloandOpenChrome() throws InterruptedException { public void testDownloandOpenChrome() throws InterruptedException {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
page.clickFooterMenuItem(3); menuItemNumber = 3;
page.clickFooterMenuItem(menuItemNumber);
PageProgrammProduct pageProgrammProduct = PageFactory.initElements(context.getDriver(), PageProgrammProduct.class); PageProgrammProduct pageProgrammProduct = PageFactory.initElements(context.getDriver(), PageProgrammProduct.class);
pageProgrammProduct.clickLeftMenu(5); menuItemNumber = 5;
PageGosCertification pageGosCertification = PageFactory.initElements(context.getDriver(),PageGosCertification.class); pageProgrammProduct.clickLeftMenu(menuItemNumber);
String fileName = pageGosCertification.getFileNameImg(2); PageGosCertification pageGosCertification = PageFactory.initElements(context.getDriver(), PageGosCertification.class);
pageGosCertification.clickiImg(2); imgNumber = 2;
String fileName = pageGosCertification.getFileNameImg(imgNumber);
pageGosCertification.clickiImg(imgNumber);
Assertions.assertTrue(pageGosCertification.checkOpenImg(fileName)); Assertions.assertTrue(pageGosCertification.checkOpenImg(fileName));
} }
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();
}
}
} }

View File

@ -14,6 +14,10 @@ public class FilterTest {
private final static String APP_URL = "https://1c.ru/"; private final static String APP_URL = "https://1c.ru/";
private static Context context; private static Context context;
private int menuItemNumber;
private int itemListCountry;
private int dateNumberListFirst;
private int dateNumberListLast;
@BeforeAll @BeforeAll
public static void setup() { public static void setup() {
@ -30,63 +34,55 @@ public class FilterTest {
@Test @Test
public void testSiteSearchEnter() { public void testSiteSearchEnter() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickButtomNews();
page.clickButtomNews(); PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
PageNews pageNews = PageFactory.initElements(context.getDriver(),PageNews.class);
String queryString = "Предприятие"; String queryString = "Предприятие";
pageNews.insertSearchText(queryString); pageNews.insertSearchText(queryString);
pageNews.submitSearch(); pageNews.submitSearch();
Assertions.assertTrue(pageNews.checkSearch()); Assertions.assertTrue(pageNews.checkSearch());
} }
@Test @Test
public void testSiteSearchBtn() { public void testSiteSearchBtn() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickButtomNews();
page.clickButtomNews(); PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
PageNews pageNews = PageFactory.initElements(context.getDriver(),PageNews.class);
String queryString = "Предприятие"; String queryString = "Предприятие";
pageNews.insertSearchText(queryString); pageNews.insertSearchText(queryString);
pageNews.clickBtmSearch(); pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearch()); Assertions.assertTrue(pageNews.checkSearch());
} }
@Test @Test
public void testFilterParametrs() { public void testFilterParametrs() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
PageSearch page1 = PageFactory.initElements(context.getDriver(), PageSearch.class); pageSearch.clickTopMenu();
page1.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickLeftMenu(18); menuItemNumber = 18;
pageFirm1C.clickLeftMenu(menuItemNumber);
PageUserCertification pageUserCertification = PageFactory.initElements(context.getDriver(), PageUserCertification.class); PageUserCertification pageUserCertification = PageFactory.initElements(context.getDriver(), PageUserCertification.class);
itemListCountry = 1;
pageUserCertification.clickFilterCountry(1); pageUserCertification.clickFilterCountry(itemListCountry);
pageUserCertification.clickFilterCity(); pageUserCertification.clickFilterCity();
Assertions.assertTrue(pageUserCertification.checkSortByFilterCity());
Assertions.assertTrue(pageUserCertification.checkFilterCity());
} }
@Test @Test
public void testSortCity() { public void testSortCity() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class); PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
pageSearch.clickTopMenu(); pageSearch.clickTopMenu();
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment(); pageFirm1C.clickSystemManagment();
PageSystemManagment page3 = PageFactory.initElements(context.getDriver(), PageSystemManagment.class); PageSystemManagment page3 = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
page3.clickLinkText(); page3.clickLinkText();
PageListFirm pageListFirm = PageFactory.initElements(context.getDriver(), PageListFirm.class); PageListFirm pageListFirm = PageFactory.initElements(context.getDriver(), PageListFirm.class);
@ -97,36 +93,31 @@ public class FilterTest {
@Test @Test
public void testSearchByDate() throws ParseException { public void testSearchByDate() throws ParseException {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickButtomNews();
page.clickButtomNews(); PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
PageNews pageNews = PageFactory.initElements(context.getDriver(),PageNews.class);
String queryString = "Предприятие"; String queryString = "Предприятие";
pageNews.insertSearchText(queryString); pageNews.insertSearchText(queryString);
dateNumberListFirst = 7;
pageNews.clickSelectionDate(7); pageNews.clickSelectionDate(dateNumberListFirst);
pageNews.clickSelectionDateL(26); dateNumberListLast = 26;
pageNews.clickSelectionDateL(dateNumberListLast);
pageNews.clickBtmSearch(); pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearchParametrsFirstLastDay()); Assertions.assertTrue(pageNews.checkSearchParametrsFirstLastDay());
} }
@Test @Test
public void testSearchByDateL() throws ParseException { public void testSearchByDateL() throws ParseException {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class);
page.clickButtomNews(); page.clickButtomNews();
PageNews pageNews = PageFactory.initElements(context.getDriver(),PageNews.class); PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
String queryString = "1с"; String queryString = "1с";
pageNews.insertSearchText(queryString); pageNews.insertSearchText(queryString);
dateNumberListLast = 26;
pageNews.clickSelectionDateL(26); pageNews.clickSelectionDateL(dateNumberListLast);
pageNews.clickBtmSearch(); pageNews.clickBtmSearch();
Assertions.assertTrue(pageNews.checkSearchParametrsLastDay()); Assertions.assertTrue(pageNews.checkSearchParametrsLastDay());
} }
} }

View File

@ -26,22 +26,27 @@ public class FormMakeRequest {
public static void quit() { public static void quit() {
context.close(); context.close();
} }
@Test @Test
public void testMakeRequest(){ public void testMakeRequest() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PagePartnersFirm pagePartnersFirm = PageFactory.initElements(context.getDriver(), PagePartnersFirm.class);
PagePartnersFirm pagePartnersFirm = PageFactory.initElements(context.getDriver(),PagePartnersFirm.class);
String fio = "Ekaterina"; String fio = "Ekaterina";
String email = "test@yandex.ru"; String email = "test@yandex.ru";
String phone = "89756523322"; String phone = "89756523322";
String inn = "745844556856"; String inn = "745844556856";
pagePartnersFirm.insertSearchText(0,inn,3,phone,4,email,5,fio); int numberFieldInn = 0;
int numberFieldPhone = 3;
pagePartnersFirm.clickCheckBox(6,10,21,31,33); int numberFieldEmail = 4;
int numberFieldFio = 5;
pagePartnersFirm.insertSearchText(numberFieldInn, inn, numberFieldPhone, phone, numberFieldEmail, email, numberFieldFio, fio);
int numberCheckBox6 = 6;
int numberCheckBox10 = 10;
int numberCheckBox21 = 21;
int numberCheckBox31 = 31;
int numberCheckBox33 = 33;
pagePartnersFirm.clickCheckBox(numberCheckBox6, numberCheckBox10, numberCheckBox21, numberCheckBox31, numberCheckBox33);
pagePartnersFirm.clickBtnRequest(); pagePartnersFirm.clickBtnRequest();
//pagePartnersFirm.clickBtmSearch();
Assertions.assertTrue(pagePartnersFirm.displayForm()); Assertions.assertTrue(pagePartnersFirm.displayForm());
} }
} }

View File

@ -27,15 +27,14 @@ public class FormSubscribeTest {
public static void quit() { public static void quit() {
context.close(); context.close();
} }
@Test @Test
public void testFormSubscribe() { public void testFormSubscribe() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
Random random = new Random(); Random random = new Random();
BrowserWindow browserWindow= PageFactory.initElements(context.getDriver(), BrowserWindow.class); BrowserWindow browserWindow = PageFactory.initElements(context.getDriver(), BrowserWindow.class);
String queryString = "name"+random.nextInt(100)+"@yandex.ru"; String queryString = "name" + random.nextInt(100) + "@yandex.ru";
browserWindow.insertText(queryString); browserWindow.insertText(queryString);
browserWindow.clickSubscribe(); browserWindow.clickSubscribe();
Assertions.assertTrue(browserWindow.subscribeTrue()); Assertions.assertTrue(browserWindow.subscribeTrue());
} }

View File

@ -12,6 +12,7 @@ public class MenuNavigation {
private final static String APP_URL = "https://1c.ru/"; private final static String APP_URL = "https://1c.ru/";
private static Context context; private static Context context;
private int menuItemNumber;
@BeforeAll @BeforeAll
public static void setup() { public static void setup() {
@ -28,142 +29,122 @@ public class MenuNavigation {
@Test @Test
public void testTopMenuDropDownList() { public void testTopMenuDropDownList() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickHeadMenuList();
Assertions.assertTrue(pageMain.menuList());
page.clickHeadMenuList();
Assertions.assertTrue(page.menuList());
} }
@Test @Test
public void testTopMenuOutLink() { public void testTopMenuOutLink() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickMenuLink();
page.clickMenuLink(); Assertions.assertTrue(pageMain.menuOutLink());
Assertions.assertTrue(page.menuOutLink());
} }
@Test @Test
public void testFooterMenu() { public void testFooterMenu() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickFooterMenuItem(0); pageMain.clickFooterMenuItem(menuItemNumber);
PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
Assertions.assertTrue(pageFirm1C.footerMenuList()); Assertions.assertTrue(pageFirm1C.footerMenuList());
} }
@Test @Test
public void testLeftMenuOutLink() { public void testLeftMenuOutLink() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
PageSearch page1 = PageFactory.initElements(context.getDriver(), PageSearch.class); pageSearch.clickLeftMenu(menuItemNumber);
page1.clickLeftMenu(0); Assertions.assertTrue(pageSearch.searchPage());
Assertions.assertTrue(page1.searchPage());
} }
@Test @Test
public void testPagination() { public void testPagination() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
PageSearch page1 = PageFactory.initElements(context.getDriver(), PageSearch.class); pageSearch.clickTopMenu();
page1.clickTopMenu(); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment();
PageFirm1C page2 = PageFactory.initElements(context.getDriver(), PageFirm1C.class); PageSystemManagment pageSystemManagment = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
page2.clickSystemManagment(); pageSystemManagment.clickLeftMenuListPagination();
pageSystemManagment.clickPaginationElement();
PageSystemManagment page3 = PageFactory.initElements(context.getDriver(), PageSystemManagment.class); Assertions.assertTrue(pageSystemManagment.paginationCheck());
page3.clickLeftMenuListPagination();
page3.clickPaginationElement();
Assertions.assertTrue(page3.paginationCheck());
} }
@Test @Test
public void testButtomNews() { public void testButtomNews() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickButtomNews();
page.clickButtomNews(); PageNews pageNews = PageFactory.initElements(context.getDriver(), PageNews.class);
PageNews pageNews = PageFactory.initElements(context.getDriver(),PageNews.class);
Assertions.assertTrue(pageNews.disposeBlockNews()); Assertions.assertTrue(pageNews.disposeBlockNews());
} }
@Test @Test
public void testLinkNews() { public void testLinkNews() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); String str = pageMain.getTextTitleNews();
String str = page.getTextTitleNews(); pageMain.clickLinkNews();
page.clickLinkNews(); PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(),PageInformationRelease.class);
Assertions.assertTrue(pageInf.displayNewsInformationTrue(str)); Assertions.assertTrue(pageInf.displayNewsInformationTrue(str));
} }
@Test @Test
public void testDropDownListVacancy() { public void testDropDownListVacancy() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
PageSearch page1 = PageFactory.initElements(context.getDriver(), PageSearch.class); pageSearch.clickTopMenu();
page1.clickTopMenu(); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickVacancy();
PageFirm1C page2 = PageFactory.initElements(context.getDriver(), PageFirm1C.class); pageFirm1C.clickVacancyLink();
page2.clickVacancy(); Assertions.assertTrue(pageFirm1C.disposalVacancyList());
page2.clickVacancyLink();
Assertions.assertTrue(page2.disposalVacancyList());
} }
@Test @Test
public void testBtmBackNews() { public void testBtmBackNews() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickLinkNews5();
page.clickLinkNews5(); PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(),PageInformationRelease.class);
pageInf.clickBtmBack(); pageInf.clickBtmBack();
Assertions.assertTrue(pageInf.disposeMainInformation()); Assertions.assertTrue(pageInf.disposeMainInformation());
} }
@Test @Test
public void testBtmNextNews() { public void testBtmNextNews() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); pageMain.clickLinkNews5();
page.clickLinkNews5(); PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(), PageInformationRelease.class);
PageInformationRelease pageInf = PageFactory.initElements(context.getDriver(),PageInformationRelease.class);
pageInf.clickBtmNext(); pageInf.clickBtmNext();
Assertions.assertTrue(pageInf.disposeMainInformation()); Assertions.assertTrue(pageInf.disposeMainInformation());
} }
@Test @Test
public void testPopUpWindow() { public void testPopUpWindow() {
context.getDriver().get(APP_URL); context.getDriver().get(APP_URL);
PageMain pageMain = PageFactory.initElements(context.getDriver(), PageMain.class);
PageMain page = PageFactory.initElements(context.getDriver(), PageMain.class); menuItemNumber = 0;
page.clickTopMenuItem(0); pageMain.clickTopMenuItem(menuItemNumber);
PageSearch pageSearch = PageFactory.initElements(context.getDriver(), PageSearch.class);
PageSearch page1 = PageFactory.initElements(context.getDriver(), PageSearch.class); pageSearch.clickTopMenu();
page1.clickTopMenu(); PageFirm1C pageFirm1C = PageFactory.initElements(context.getDriver(), PageFirm1C.class);
pageFirm1C.clickSystemManagment();
PageFirm1C page2 = PageFactory.initElements(context.getDriver(), PageFirm1C.class); PageSystemManagment pageSystemManagment = PageFactory.initElements(context.getDriver(), PageSystemManagment.class);
page2.clickSystemManagment(); pageSystemManagment.clickLeftMenuListWindiw();
pageSystemManagment.clickPopUpWindowElement();
PageSystemManagment page3 = PageFactory.initElements(context.getDriver(), PageSystemManagment.class); Assertions.assertTrue(pageSystemManagment.popUpWindowCheck());
page3.clickLeftMenuListWindiw();
page3.clickPopUpWindowElement();
Assertions.assertTrue(page3.popUpWindowCheck());
} }
} }

View File

@ -1,6 +1,10 @@
package context; package context;
import org.openqa.selenium.chrome.ChromeDriver; 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 { public class ChromeContext extends Context {
private final static String WINDOWS_DRIVER = "chromedriver.exe"; private final static String WINDOWS_DRIVER = "chromedriver.exe";
@ -9,6 +13,10 @@ public class ChromeContext extends Context {
@Override @Override
protected void createDriver() { 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(); driver = new ChromeDriver();
} }

View File

@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit;
public abstract class Context { public abstract class Context {
private final static String DRIVER_LOCATION = "drivers/%s"; private final static String DRIVER_LOCATION = "drivers/%s";
protected WebDriver driver; protected WebDriver driver;
protected String tmpPath;
public WebDriver getDriver() { public WebDriver getDriver() {
if (driver != null) { if (driver != null) {
return driver; return driver;
@ -36,6 +36,9 @@ public abstract class Context {
return Context.class.getClassLoader().getResource( return Context.class.getClassLoader().getResource(
String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile(); String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile();
} }
public String getTmpPath(){
return tmpPath;
}
private boolean isWindows() { private boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows"); return System.getProperty("os.name").toLowerCase().contains("windows");

View File

@ -1,35 +1,39 @@
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 java.util.List; import java.util.List;
public class BrowserWindow { public class BrowserWindow {
WebDriver driver; WebDriver driver;
@FindBy(xpath= "//*[@id=\"email\"]") @FindBy(xpath = "//*[@id=\"email\"]")
private WebElement textFieldEmail; private WebElement textFieldEmail;
@FindBy(className = "btn") @FindBy(className = "btn")
private WebElement btnSubscribe; private WebElement btnSubscribe;
@FindBy(css = ".widebox h3") @FindBy(css = ".widebox h3")
private List<WebElement> text; private List<WebElement> text;
public BrowserWindow(WebDriver driver) { public BrowserWindow(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void insertText(String text){
public void insertText(String text) {
textFieldEmail.sendKeys(text); textFieldEmail.sendKeys(text);
} }
public void clickSubscribe(){
public void clickSubscribe() {
btnSubscribe.click(); btnSubscribe.click();
} }
public boolean subscribeTrue(){
if(text.get(1).getText().contains("Ваши данные приняты")){ public boolean subscribeTrue() {
if (text.get(1).getText().contains("Ваши данные приняты")) {
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -1,42 +0,0 @@
package page;
import context.ChromeContext;
import context.Context;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.support.PageFactory;
public class InformersTest {
// http://1c.ru/news/informer.htm
private final static String APP_URL = "http://1c.ru/news/informer.htm";
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 testInformer(){
context.getDriver().get(APP_URL);
PageInformers pageInformers = PageFactory.initElements(context.getDriver(),PageInformers.class);
String count = "5";
pageInformers.insertText(count);
pageInformers.clickBtn();
Assertions.assertTrue(pageInformers.checkInformer());
}
}

View File

@ -14,26 +14,28 @@ public class PageFirm1C {
@FindBy(css = ".sidebar-menu li") @FindBy(css = ".sidebar-menu li")
private List<WebElement> itemMenu; private List<WebElement> itemMenu;
@FindBy(xpath= "//*[@id=\"main_field\"]/h4[1]/a") @FindBy(xpath = "//*[@id=\"main_field\"]/h4[1]/a")
private WebElement linlVacancy; private WebElement linlVacancy;
private static int systemManagmentMenuElementNumber = 5; private static int systemManagmentMenuElementNumber = 5;
public PageFirm1C (WebDriver driver) {
public PageFirm1C(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickSystemManagment(){ public void clickSystemManagment() {
itemMenu.get(systemManagmentMenuElementNumber).click(); itemMenu.get(systemManagmentMenuElementNumber).click();
} }
public void clickLeftMenu(int number){ public void clickLeftMenu(int number) {
itemMenu.get(number).click(); itemMenu.get(number).click();
} }
public void clickVacancy(){
public void clickVacancy() {
itemMenu.get(4).click(); itemMenu.get(4).click();
} }
public void clickVacancyLink(){
public void clickVacancyLink() {
linlVacancy.click(); linlVacancy.click();
try { try {
Thread.sleep(5000); Thread.sleep(5000);
@ -42,13 +44,12 @@ public class PageFirm1C {
} }
} }
public boolean disposalVacancyList() {
public boolean disposalVacancyList(){
return driver.findElement(By.cssSelector("#dept6")).isDisplayed(); return driver.findElement(By.cssSelector("#dept6")).isDisplayed();
} }
public boolean footerMenuList(){
public boolean footerMenuList() {
return driver.findElement(By.cssSelector(".widebox")).isDisplayed(); return driver.findElement(By.cssSelector(".widebox")).isDisplayed();
} }
} }

View File

@ -14,31 +14,27 @@ public class PageGosCertification {
@FindBy(css = ".widebox a") @FindBy(css = ".widebox a")
private List<WebElement> elementImg; private List<WebElement> elementImg;
public PageGosCertification(WebDriver driver) { public PageGosCertification(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickiImg(int number){
public void clickiImg(int number) {
elementImg.get(number).click(); elementImg.get(number).click();
} }
public String getFileNameImg(int elementNumber){
public String getFileNameImg(int elementNumber) {
String fileName = elementImg.get(elementNumber).getAttribute("href"); String fileName = elementImg.get(elementNumber).getAttribute("href");
fileName = fileName.substring(fileName.lastIndexOf("/")+1); fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
return fileName; return fileName;
} }
public boolean checkOpenImg(String str) { public boolean checkOpenImg(String str) {
boolean check = false; boolean check = false;
File f = new File (str); File f = new File(str);
String s = driver.getCurrentUrl(); String s = driver.getCurrentUrl();
if(s.contains(str)) if (s.contains(str))
check = true; check = true;
return check; return check;
} }
} }

View File

@ -9,34 +9,35 @@ import org.openqa.selenium.support.PageFactory;
public class PageInformationRelease { public class PageInformationRelease {
WebDriver driver; WebDriver driver;
@FindBy(className= "previous") @FindBy(className = "previous")
private WebElement elementBackBtmNews; private WebElement elementBackBtmNews;
@FindBy(className= "next") @FindBy(className = "next")
private WebElement elementNextBtmNews; private WebElement elementNextBtmNews;
@FindBy(id= "pagecontentforsolr") @FindBy(id = "pagecontentforsolr")
private WebElement content; private WebElement content;
@FindBy(xpath= "//*[@id=\"pagecontentforsolr\"]/div[4]") @FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/div[4]")
private WebElement title; private WebElement title;
public PageInformationRelease(WebDriver driver) { public PageInformationRelease(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickBtmBack(){ public void clickBtmBack() {
elementBackBtmNews.click(); elementBackBtmNews.click();
} }
public void clickBtmNext(){
elementBackBtmNews.click();
}
public boolean disposeMainInformation() {
public void clickBtmNext() {
elementBackBtmNews.click();
}
public boolean disposeMainInformation() {
return content.isDisplayed(); return content.isDisplayed();
} }
public boolean displayNewsInformationTrue(String str){
public boolean displayNewsInformationTrue(String str) {
return title.getText().contains(str); return title.getText().contains(str);
} }
} }

View File

@ -13,42 +13,34 @@ public class PageInformers {
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/textarea") @FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/textarea")
private WebElement elementCode; private WebElement elementCode;
@FindBy(name = "limit") @FindBy(name = "limit")
private WebElement textField; private WebElement textField;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/table/tbody/tr[4]/td/input") @FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table[1]/tbody/tr/td[2]/form/table/tbody/tr[4]/td/input")
private WebElement formBtn; private WebElement formBtn;
public PageInformers(WebDriver driver) { public PageInformers(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void insertText(String text){
public void insertText(String text) {
textField.clear(); textField.clear();
textField.sendKeys(text); textField.sendKeys(text);
} }
private String strCode; private String strCode;
private int countItem;
public void clickBtn() {
public void clickBtn() {
formBtn.click(); formBtn.click();
strCode = elementCode.getAttribute("value"); strCode = elementCode.getAttribute("value");
} }
public boolean checkWorkInformer() {
public boolean checkInformer(){
boolean check = false; boolean check = false;
String strTexyField = textField.getAttribute("value"); String strTexyField = textField.getAttribute("value");
String strCode1 = strCode; String strCode1 = strCode;
if (strCode1.contains(strTexyField))
if(strCode1.contains(strTexyField)) check = true;
check=true;
return check; return check;
} }
} }

View File

@ -8,32 +8,34 @@ import java.util.List;
public class PageListFirm { public class PageListFirm {
WebDriver driver; WebDriver driver;
@FindBy(css = ".content select") @FindBy(css = ".content select")
private WebElement selectListCity; private WebElement selectListCity;
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table/tbody/tr[1]/th[2]/select/option[17]") @FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/table/tbody/tr[1]/th[2]/select/option[17]")
private WebElement itemListCity; private WebElement itemListCity;
@FindBy(css="tr")
@FindBy(css = "tr")
private List<WebElement> tr; private List<WebElement> tr;
public PageListFirm(WebDriver driver) { public PageListFirm(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickCity(){
public void clickCity() {
selectListCity.click(); selectListCity.click();
itemListCity.click(); itemListCity.click();
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public boolean checkSortCity(){
public boolean checkSortCity() {
boolean checkSearch = false; boolean checkSearch = false;
int count = tr.size(); int count = tr.size();
for(int i = 0; i<count;i++){ for (int i = 0; i < count; i++) {
if(tr.get(i).getText().contains(itemListCity.getText())) if (tr.get(i).getText().contains(itemListCity.getText()))
checkSearch = true; checkSearch = true;
} }
return checkSearch; return checkSearch;

View File

@ -31,6 +31,7 @@ public class PageMain {
public PageMain(WebDriver driver) { public PageMain(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickHeadMenuList() { public void clickHeadMenuList() {
driver.findElement(By.className("droppable")).findElement(By.tagName("span")).click(); driver.findElement(By.className("droppable")).findElement(By.tagName("span")).click();
try { try {
@ -39,6 +40,7 @@ public class PageMain {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void clickMenuLink() { public void clickMenuLink() {
menuElementsList.click(); menuElementsList.click();
try { try {
@ -47,24 +49,26 @@ public class PageMain {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void clickTopMenuItem(int number){
public void clickTopMenuItem(int number) {
menuElements.get(number).click(); menuElements.get(number).click();
} }
public void clickFooterMenuItem(int number){
public void clickFooterMenuItem(int number) {
footerMenuElements.get(number).click(); footerMenuElements.get(number).click();
} }
public void clickButtomNews(){
public void clickButtomNews() {
buttomNewsElements.click(); buttomNewsElements.click();
} }
public void clickLinkNews(){
public void clickLinkNews() {
linkElement.get(3).click(); linkElement.get(3).click();
} }
public void clickLinkNews5(){
public void clickLinkNews5() {
linkElement.get(5).click(); linkElement.get(5).click();
try { try {
Thread.sleep(5000); Thread.sleep(5000);
@ -72,19 +76,17 @@ public class PageMain {
e.printStackTrace(); e.printStackTrace();
} }
} }
public String getTextTitleNews(){
public String getTextTitleNews() {
String str = linkElement.get(3).getText(); String str = linkElement.get(3).getText();
return str; return str;
} }
public boolean menuList(){ public boolean menuList() {
return !(driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/ul/div/li[1]/a")).isDisplayed()); return !(driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/ul/div/li[1]/a")).isDisplayed());
} }
public boolean menuOutLink() { public boolean menuOutLink() {
return driver.findElement(By.cssSelector(".left-content")).isDisplayed(); return driver.findElement(By.cssSelector(".left-content")).isDisplayed();
} }
} }

View File

@ -15,43 +15,46 @@ import java.util.Locale;
public class PageNews { public class PageNews {
WebDriver driver; WebDriver driver;
@FindBy(name= "query") @FindBy(name = "query")
private WebElement elementEntryField; private WebElement elementEntryField;
@FindBy(className= "btn") @FindBy(className = "btn")
private WebElement elementBtnSearch; private WebElement elementBtnSearch;
@FindBy(className= "next") @FindBy(className = "next")
private WebElement elementNextBtmNews; private WebElement elementNextBtmNews;
@FindBy(id= "date_from") @FindBy(id = "date_from")
private WebElement elementDateFrom; private WebElement elementDateFrom;
@FindBy(css= " .table-condensed td") @FindBy(css = " .table-condensed td")
private List<WebElement> elementDateNumber; private List<WebElement> elementDateNumber;
@FindBy(id= "date_to") @FindBy(id = "date_to")
private WebElement elementDateTo; private WebElement elementDateTo;
@FindBy(css= ".widebox li") @FindBy(css = ".widebox li")
private List<WebElement> elementListNews; private List<WebElement> elementListNews;
@FindBy(className= "datepicker-switch") @FindBy(className = "datepicker-switch")
private WebElement elementMonth; private WebElement elementMonth;
@FindBy(className= "prev") @FindBy(className = "prev")
private WebElement elementBack; private WebElement elementBack;
public PageNews(WebDriver driver) { public PageNews(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void insertSearchText(String text){ public void insertSearchText(String text) {
elementEntryField.sendKeys(text); elementEntryField.sendKeys(text);
} }
private int strDayFirst; private int strDayFirst;
private int strDayLast; private int strDayLast;
private String strMonthFirst; private String strMonthFirst;
private String strMonthLast; private String strMonthLast;
public void clickBtmSearch(){
public void clickBtmSearch() {
elementBtnSearch.click(); elementBtnSearch.click();
} }
public void submitSearch(){
public void submitSearch() {
elementEntryField.sendKeys(Keys.RETURN); elementEntryField.sendKeys(Keys.RETURN);
try { try {
Thread.sleep(5000); Thread.sleep(5000);
@ -59,7 +62,8 @@ public class PageNews {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void clickSelectionDate(int number1){
public void clickSelectionDate(int number1) {
elementDateFrom.click(); elementDateFrom.click();
elementBack.click(); elementBack.click();
elementDateNumber.get(number1).click(); elementDateNumber.get(number1).click();
@ -67,14 +71,14 @@ public class PageNews {
strMonthFirst = elementMonth.getText(); strMonthFirst = elementMonth.getText();
} }
public void clickSelectionDateL( int number2){
public void clickSelectionDateL(int number2) {
elementDateTo.click(); elementDateTo.click();
elementDateNumber.get(number2).click(); elementDateNumber.get(number2).click();
strDayLast = Integer.parseInt(elementDateNumber.get(number2).getText()); strDayLast = Integer.parseInt(elementDateNumber.get(number2).getText());
strMonthLast =elementMonth.getText(); strMonthLast = elementMonth.getText();
driver.findElement(By.className("cats")).click(); driver.findElement(By.className("cats")).click();
@ -85,13 +89,11 @@ public class PageNews {
} }
public boolean checkSearchParametrsFirstLastDay() throws ParseException { public boolean checkSearchParametrsFirstLastDay() throws ParseException {
boolean checkSearch = false; boolean checkSearch = false;
int count = elementListNews.size(); int count = elementListNews.size();
String firstDayNewsList = elementListNews.get(0).getText().substring(0,elementListNews.get(0).getText().indexOf("\n")); String firstDayNewsList = elementListNews.get(0).getText().substring(0, elementListNews.get(0).getText().indexOf("\n"));
String enDayNewsList = elementListNews.get(count-1).getText().substring(0,elementListNews.get(count-1).getText().indexOf("\n")); String enDayNewsList = elementListNews.get(count - 1).getText().substring(0, elementListNews.get(count - 1).getText().indexOf("\n"));
String fDayNumber = elementDateFrom.getAttribute("value"); String fDayNumber = elementDateFrom.getAttribute("value");
String eDayNumber = elementDateTo.getAttribute("value"); String eDayNumber = elementDateTo.getAttribute("value");
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault()); SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
@ -102,23 +104,19 @@ public class PageNews {
Date dateFDay = newDateFormat.parse(fDayNumber); Date dateFDay = newDateFormat.parse(fDayNumber);
Date dateEDay = newDateFormat.parse(eDayNumber); Date dateEDay = newDateFormat.parse(eDayNumber);
if(dateFirstList.before(dateEDay)|| dateFirstList.equals(dateEDay)) if ((dateFirstList.before(dateEDay) || dateFirstList.equals(dateEDay)) && (dateEndList.after(dateFDay) || dateEndList.equals(dateFDay)) ) {
{
if(dateEndList.after(dateFDay) ||dateEndList.equals(dateFDay))
checkSearch = true; checkSearch = true;
} }
return checkSearch; return checkSearch;
} }
public boolean checkSearchParametrsLastDay() throws ParseException { public boolean checkSearchParametrsLastDay() throws ParseException {
boolean checkSearch = false; boolean checkSearch = false;
String firstDayNewsList = elementListNews.get(0).getText(); String firstDayNewsList = elementListNews.get(0).getText();
String dateTo = elementDateTo.getAttribute("value"); String dateTo = elementDateTo.getAttribute("value");
String dateInString = firstDayNewsList.substring(0,firstDayNewsList.indexOf("\n"));//создаю строку по заданному формату String dateInString = firstDayNewsList.substring(0, firstDayNewsList.indexOf("\n"));//создаю строку по заданному формату
String oldDateString = dateInString ; String oldDateString = dateInString;
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault()); SimpleDateFormat newDateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
SimpleDateFormat oldDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault()); SimpleDateFormat oldDateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault());
@ -127,19 +125,18 @@ public class PageNews {
Date date1 = newDateFormat.parse(dateTo); Date date1 = newDateFormat.parse(dateTo);
if(date1.after(date) || date1.equals(date)){ if (date1.after(date) || date1.equals(date)) {
checkSearch = true; checkSearch = true;
} }
return checkSearch; return checkSearch;
} }
public boolean checkSearch(){
public boolean checkSearch() {
boolean checkSearch = false; boolean checkSearch = false;
int count = elementListNews.size(); int count = elementListNews.size();
String strSearch = elementEntryField.getAttribute("value"); String strSearch = elementEntryField.getAttribute("value");
for(int i=0; i<count-1;i++){ for (int i = 0; i < count - 1; i++) {
if(elementListNews.get(i).getText().contains(strSearch)) if (elementListNews.get(i).getText().contains(strSearch))
checkSearch = true; checkSearch = true;
} }
return checkSearch; return checkSearch;

View File

@ -27,7 +27,7 @@ public class PagePartnersFirm {
public void insertSearchText(int i, String Inn, public void insertSearchText(int i, String Inn,
int i1, String email, int i1, String email,
int i2, String phone, int i2, String phone,
int i3, String name){ int i3, String name) {
elementInput.get(i).sendKeys(Inn); elementInput.get(i).sendKeys(Inn);
@ -41,9 +41,8 @@ public class PagePartnersFirm {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void clickCheckBox(int cBox, public void clickCheckBox(int cBox,
int cBox1, int cBox1,
int cBox2, int cBox2,
@ -74,23 +73,19 @@ public class PagePartnersFirm {
e.printStackTrace(); e.printStackTrace();
} }
elementInput.get(cBox4).click(); elementInput.get(cBox4).click();
} }
public void clickBtnRequest(){ public void clickBtnRequest() {
elementBtn.click(); elementBtn.click();
} }
public void submitRequest(){
public void submitRequest() {
elementBtn.sendKeys(Keys.RETURN); elementBtn.sendKeys(Keys.RETURN);
} }
public boolean displayForm(){
public boolean displayForm() {
return elementSpan.getText().contains("Благодрим вас за отправленную анкету"); return elementSpan.getText().contains("Благодрим вас за отправленную анкету");
} }
} }

View File

@ -14,20 +14,17 @@ public class PagePriceList {
@FindBy(className = "btn") @FindBy(className = "btn")
private WebElement elementBtn; private WebElement elementBtn;
private String tmpPath = "C://Users/tab35/Downloads/";
public PagePriceList(WebDriver driver) { public PagePriceList(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public String getFileName(){ public String getFileName() {
String fileName = elementBtn.getAttribute("href"); String fileName = elementBtn.getAttribute("href");
fileName = fileName.substring(fileName.lastIndexOf("/")+1); fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
return fileName; return fileName;
} }
public void clickBtn(){ public void clickBtn() {
elementBtn.click(); elementBtn.click();
try { try {
Thread.sleep(5000); Thread.sleep(5000);
@ -35,13 +32,5 @@ public class PagePriceList {
e.printStackTrace(); e.printStackTrace();
} }
} }
public boolean isFileDownloaded(String filename){
boolean check = false;
File file = new File(tmpPath+filename);
if(file.exists()) {
check = true;
}
return check;
}
} }

View File

@ -12,11 +12,11 @@ public class PageProgrammProduct {
@FindBy(css = ".dropdown a") @FindBy(css = ".dropdown a")
private List<WebElement> elementMenu; private List<WebElement> elementMenu;
public PageProgrammProduct(WebDriver driver) { public PageProgrammProduct(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickLeftMenu(int number){
public void clickLeftMenu(int number) {
elementMenu.get(number).click(); elementMenu.get(number).click();

View File

@ -23,20 +23,20 @@ public class PageSearch {
private WebElement searchBtn; private WebElement searchBtn;
private static int topMenuElementNumber = 1; private static int topMenuElementNumber = 1;
public PageSearch(WebDriver driver) { public PageSearch(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickLeftMenu(int number) {
public void clickLeftMenu(int number){
leftMenuElement.get(number).click(); leftMenuElement.get(number).click();
} }
public void clickTopMenu(){ public void clickTopMenu() {
topMenuElement.get(topMenuElementNumber).click(); topMenuElement.get(topMenuElementNumber).click();
} }
public boolean searchPage(){ public boolean searchPage() {
return driver.findElement(By.cssSelector("#pagecontentforsolr")).isDisplayed(); return driver.findElement(By.cssSelector("#pagecontentforsolr")).isDisplayed();
} }
} }

View File

@ -18,41 +18,42 @@ public class PageSystemManagment {
@FindBy(className = "scope") @FindBy(className = "scope")
private List<WebElement> elementPopUpWindow; private List<WebElement> elementPopUpWindow;
@FindBy(css = ".scope .from") @FindBy(css = ".scope .from")
private WebElement windowPopUp; private WebElement windowPopUp;
@FindBy(css = ".widebox a") @FindBy(css = ".widebox a")
private List<WebElement> elementtLinkText; private List<WebElement> elementtLinkText;
public PageSystemManagment (WebDriver driver) {
public PageSystemManagment(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickLeftMenuListPagination() { public void clickLeftMenuListPagination() {
itemLeftMenu.get(4).click(); itemLeftMenu.get(4).click();
} }
public void clickLeftMenuListWindiw() { public void clickLeftMenuListWindiw() {
itemLeftMenu.get(3).click(); itemLeftMenu.get(3).click();
} }
public void clickPaginationElement() { public void clickPaginationElement() {
paginationElement.get(3).click(); paginationElement.get(3).click();
} }
public void clickPopUpWindowElement() { public void clickPopUpWindowElement() {
elementPopUpWindow.get(0).click(); elementPopUpWindow.get(0).click();
} }
public void clickLinkText(){
public void clickLinkText() {
elementtLinkText.get(1).click(); elementtLinkText.get(1).click();
} }
public boolean paginationCheck(){
public boolean paginationCheck() {
return driver.findElement(By.cssSelector(".ndate")).isDisplayed(); return driver.findElement(By.cssSelector(".ndate")).isDisplayed();
} }
public boolean popUpWindowCheck(){
public boolean popUpWindowCheck() {
return windowPopUp.isDisplayed(); return windowPopUp.isDisplayed();
} }

View File

@ -12,31 +12,33 @@ public class PageUserCertification {
@FindBy(className = "country-list-li") @FindBy(className = "country-list-li")
private List<WebElement> itemListCountry; private List<WebElement> itemListCountry;
@FindBy(name="reg") @FindBy(name = "reg")
private WebElement selectListCity; private WebElement selectListCity;
@FindBy(xpath="//*[@id=\"pagecontentforsolr\"]/form[2]/select/option[8]")
@FindBy(xpath = "//*[@id=\"pagecontentforsolr\"]/form[2]/select/option[8]")
private WebElement itemListCity; private WebElement itemListCity;
@FindBy(css="tr") @FindBy(css = "tr")
private List<WebElement> tr; private List<WebElement> tr;
public PageUserCertification(WebDriver driver) { public PageUserCertification(WebDriver driver) {
this.driver = driver; this.driver = driver;
} }
public void clickFilterCountry(int number) {
public void clickFilterCountry(int number){
itemListCountry.get(number).click(); itemListCountry.get(number).click();
} }
public void clickFilterCity(){
public void clickFilterCity() {
selectListCity.click(); selectListCity.click();
itemListCity.click(); itemListCity.click();
} }
public boolean checkFilterCity(){ public boolean checkSortByFilterCity() {
boolean checkSearch = false; boolean checkSearch = false;
int count = tr.size(); int count = tr.size();
for(int i = 0; i<count;i++){ for (int i = 0; i < count; i++) {
if(tr.get(i).getText().contains(itemListCity.getText())) if (tr.get(i).getText().contains(itemListCity.getText()))
checkSearch = true; checkSearch = true;
} }
return checkSearch; return checkSearch;

View File

@ -23,7 +23,6 @@ public class SearchPage {
inputField.sendKeys(text); inputField.sendKeys(text);
return this; return this;
} }
public void clickSubmitButton() { public void clickSubmitButton() {
inputField.sendKeys(Keys.RETURN); inputField.sendKeys(Keys.RETURN);
} }