Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0ea8df6c32 | ||
|
0ba38238af | ||
|
9d8b87da1b |
@ -1,44 +0,0 @@
|
|||||||
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;
|
|
||||||
import page.*;
|
|
||||||
|
|
||||||
public class ExternalLinks {
|
|
||||||
private final static String APP_URL = "http://www.lukoil.ru/";
|
|
||||||
private static Context context;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void setup() {
|
|
||||||
context = new ChromeContext();
|
|
||||||
context.start();
|
|
||||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void quit() {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementFooterExternalLinksTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickFooterLinksElement();
|
|
||||||
ExternalPage externalPage = PageFactory.initElements(context.getDriver(), ExternalPage.class);
|
|
||||||
Assertions.assertTrue(externalPage.isPageDisplayExternalFooter());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementSidebarExternalLinksTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickSidebarExternalElement();
|
|
||||||
ExternalPage externalPage = PageFactory.initElements(context.getDriver(), ExternalPage.class);
|
|
||||||
Assertions.assertTrue(externalPage.isPageDisplayExternalSidebar());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
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;
|
|
||||||
import page.*;
|
|
||||||
|
|
||||||
public class NavigationMenu {
|
|
||||||
private final static String APP_URL = "http://www.lukoil.ru/";
|
|
||||||
private static Context context;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void setup() {
|
|
||||||
context = new ChromeContext();
|
|
||||||
context.start();
|
|
||||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void quit() {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void logotypeNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickLogoElement();
|
|
||||||
Assertions.assertTrue(page.isPageDisplayMain());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void menuMainNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanyMenu();
|
|
||||||
Assertions.assertTrue(page.isPageDisplayMenu());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void submenuMainNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
Assertions.assertTrue(subPage.isPageDisplaySubmenu());
|
|
||||||
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementFooterNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickFooterElement();
|
|
||||||
FooterPage footerPage = PageFactory.initElements(context.getDriver(), FooterPage.class);
|
|
||||||
Assertions.assertTrue(footerPage.isPageDisplayFooter());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementAdditionalInfoNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanyMenu();
|
|
||||||
page.clickAdditionalInfoMenu();
|
|
||||||
AboutCompanyPage aboutPage = PageFactory.initElements(context.getDriver(), AboutCompanyPage.class);
|
|
||||||
Assertions.assertTrue(aboutPage.isPageDisplayAboutCompany());
|
|
||||||
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementNextPreviousNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanyMenu();
|
|
||||||
page.clickAdditionalInfoMenu();
|
|
||||||
AboutCompanyPage aboutPage = PageFactory.initElements(context.getDriver(), AboutCompanyPage.class);
|
|
||||||
aboutPage.clickNextElement();
|
|
||||||
ActivitiesCompanyPage activitiesCompanyPage = PageFactory.initElements(context.getDriver(), ActivitiesCompanyPage.class);
|
|
||||||
activitiesCompanyPage.clickPreviousElement();
|
|
||||||
Assertions.assertTrue(aboutPage.isPageDisplayAboutCompany());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementPlusNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickPlus();
|
|
||||||
SubMenuPage sub = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
sub.clickPlus();
|
|
||||||
Assertions.assertTrue(sub.isPageDisplayMinus());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementMinusNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickPlus();
|
|
||||||
SubMenuPage sub = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
sub.clickPlus();
|
|
||||||
subPage.clickPlus();
|
|
||||||
Assertions.assertTrue(subPage.isPageDisplayMinus());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementBreadcrumbsNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickBreadcrumbsElement();
|
|
||||||
Assertions.assertTrue(page.isPageDisplayMenu());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void elementSidebarHyperlinkNavigationTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickHyperlink();
|
|
||||||
FAQPage faqPage = PageFactory.initElements(context.getDriver(), FAQPage.class);
|
|
||||||
Assertions.assertTrue(faqPage.isPageDisplayFAQ());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
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;
|
|
||||||
import page.MainPage;
|
|
||||||
import page.SearchPage;
|
|
||||||
|
|
||||||
public class Search {
|
|
||||||
private final static String APP_URL = "http://www.lukoil.ru/";
|
|
||||||
private static Context context;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void setup() {
|
|
||||||
context = new ChromeContext();
|
|
||||||
context.start();
|
|
||||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void quit() {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void searchHeaderTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.insertSearchHeaderText("Проекты");
|
|
||||||
page.submitSearchHeader();
|
|
||||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
|
||||||
Assertions.assertTrue(searchPage.checkSearch());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void searchHeaderTestWithFilter() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.insertSearchHeaderText("Проекты");
|
|
||||||
page.submitSearchHeader();
|
|
||||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
|
||||||
searchPage.clickSearchFilterElement();
|
|
||||||
Assertions.assertTrue(searchPage.checkSearch());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void searchHeaderTestWithSorting() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.insertSearchHeaderText("Проекты");
|
|
||||||
page.submitSearchHeader();
|
|
||||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
|
||||||
searchPage.clickSearchSortingElement();
|
|
||||||
Assertions.assertTrue(searchPage.checkSearch());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
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;
|
|
||||||
import page.MainPage;
|
|
||||||
import page.MyFavoritesPage;
|
|
||||||
import page.SubMenuPage;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class WorkWithDocument {
|
|
||||||
private final static String APP_URL = "http://www.lukoil.ru/";
|
|
||||||
private static Context context;
|
|
||||||
private static String tmpPath;
|
|
||||||
@BeforeAll
|
|
||||||
public static void setup() {
|
|
||||||
context = new ChromeContext();
|
|
||||||
context.start();
|
|
||||||
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
|
||||||
tmpPath = context.getTmpPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void quit() {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void addToFavoritesTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanyMenu();
|
|
||||||
page.clickAddToFavoritesElement();
|
|
||||||
Assertions.assertTrue(page.isMessageDisplay());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void myFavoritesTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickCompanySubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickMyFavoritesElement();
|
|
||||||
MyFavoritesPage myFavoritesPage = PageFactory.initElements(context.getDriver(), MyFavoritesPage.class);
|
|
||||||
Assertions.assertTrue(myFavoritesPage.isPageDisplayMyFavorites());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void addToFavoritesDocumentTest() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickDocumentSubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickAddDocumentToFavoritesElement();
|
|
||||||
Assertions.assertTrue(subPage.isMessageDisplay());
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void testOpenDocumentChrome() {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickDocumentSubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
subPage.clickOpenDocumentElement();
|
|
||||||
String fileName = subPage.getFileName();
|
|
||||||
Assertions.assertTrue(subPage.checkOpen(fileName));
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void testDownloandDocument() throws InterruptedException {
|
|
||||||
context.getDriver().get(APP_URL);
|
|
||||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
|
||||||
page.clickDocumentSubmenu();
|
|
||||||
SubMenuPage subPage = PageFactory.initElements(context.getDriver(), SubMenuPage.class);
|
|
||||||
Assertions.assertTrue(subPage.isPageDisplayDocuments());
|
|
||||||
subPage.clickDownloandDocumentElement();
|
|
||||||
String fileName = subPage.getFileName();
|
|
||||||
checkDownload(fileName,100,100);
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package context;
|
|
||||||
|
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
|
||||||
|
|
||||||
public class ChromeContext extends Context {
|
|
||||||
private final static String WINDOWS_DRIVER = "chromedriver.exe";
|
|
||||||
private final static String LINUX_DRIVER = "chromedriver";
|
|
||||||
private final static String DRIVER_TYPE = "webdriver.chrome.driver";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void createDriver() {
|
|
||||||
driver = new ChromeDriver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDriverExecutable(boolean isWindows) {
|
|
||||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDriverType() {
|
|
||||||
return DRIVER_TYPE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package context;
|
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public abstract class Context {
|
|
||||||
private final static String DRIVER_LOCATION = "drivers/%s";
|
|
||||||
protected WebDriver driver;
|
|
||||||
protected String tmpPath;
|
|
||||||
public WebDriver getDriver() {
|
|
||||||
if (driver != null) {
|
|
||||||
return driver;
|
|
||||||
}
|
|
||||||
throw new IllegalStateException("WebDriver is not initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() {
|
|
||||||
System.setProperty(getDriverType(), getDriverExecutablePath());
|
|
||||||
createDriver();
|
|
||||||
// это плохая инструкция для автотестов, т.к. лучше задавать для конкретного элемента или кейса
|
|
||||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
driver.quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void createDriver();
|
|
||||||
|
|
||||||
protected abstract String getDriverType();
|
|
||||||
|
|
||||||
protected abstract String getDriverExecutable(boolean windows);
|
|
||||||
|
|
||||||
private String getDriverExecutablePath() {
|
|
||||||
return Context.class.getClassLoader().getResource(
|
|
||||||
String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isWindows() {
|
|
||||||
return System.getProperty("os.name").toLowerCase().contains("windows");
|
|
||||||
}
|
|
||||||
public String getTmpPath(){
|
|
||||||
return tmpPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package context;
|
|
||||||
|
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
|
||||||
|
|
||||||
public class FirefoxContext extends Context {
|
|
||||||
private final static String WINDOWS_DRIVER = "geckodriver.exe";
|
|
||||||
private final static String LINUX_DRIVER = "geckodriver";
|
|
||||||
private final static String DRIVER_TYPE = "webdriver.gecko.driver";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void createDriver() {
|
|
||||||
driver = new FirefoxDriver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDriverExecutable(boolean isWindows) {
|
|
||||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDriverType() {
|
|
||||||
return DRIVER_TYPE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
|
|
||||||
public class AboutCompanyPage {
|
|
||||||
WebDriver driver;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[1]/div/div/div/ul/li[2]/a")
|
|
||||||
private WebElement nextElement;
|
|
||||||
|
|
||||||
public void clickNextElement() {
|
|
||||||
nextElement.click();
|
|
||||||
}
|
|
||||||
public AboutCompanyPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayAboutCompany() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"О Компании\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
|
|
||||||
public class ActivitiesCompanyPage {
|
|
||||||
WebDriver driver;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[1]/div/div/div/ul/li[1]/a")
|
|
||||||
private WebElement previousElement;
|
|
||||||
public void clickPreviousElement() {
|
|
||||||
previousElement.click();
|
|
||||||
}
|
|
||||||
public ActivitiesCompanyPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayActivitiesCompany() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Деятельность Компании\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
|
|
||||||
public class ExternalPage {
|
|
||||||
WebDriver driver;
|
|
||||||
|
|
||||||
public ExternalPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayExternalFooter() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id=\"page_info_wrap\"]/div/div/div[1]/div")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayExternalSidebar() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id=\"bd\"]/h2")).isDisplayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
|
|
||||||
public class FAQPage {
|
|
||||||
WebDriver driver;
|
|
||||||
|
|
||||||
public FAQPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayFAQ() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Часто задаваемые вопросы\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Keys;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.interactions.Actions;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
|
|
||||||
public class FooterPage {
|
|
||||||
WebDriver driver;
|
|
||||||
|
|
||||||
public FooterPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayFooter() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Проекты роста\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.Keys;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.interactions.Actions;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
|
|
||||||
public class MainPage {
|
|
||||||
WebDriver driver;
|
|
||||||
|
|
||||||
@FindBy(id = "f38c8d5a-cf09-4504-be96-82de9efae7b2")
|
|
||||||
private WebElement companyElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"navbar-submenu\"]/div[1]/div[1]/div[2]/div[1]/div[2]/ul/li[1]/a")
|
|
||||||
private WebElement companySubmenuElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"footer\"]/div/div/div[5]/ul/li[3]/a")
|
|
||||||
private WebElement footerElementExternalLinks;
|
|
||||||
@FindBy(xpath = "//*[@id=\"footer\"]/div/div/div[3]/ul/li[1]/a")
|
|
||||||
private WebElement footerElementNavigation;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[2]/div[1]/div/div/div/div/div[1]/div/ul/li/a")
|
|
||||||
private WebElement additionalInfoElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"topSearchForm\"]/input[1]")
|
|
||||||
private WebElement searchHeaderElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[2]/div[2]/div[3]/ul/li[1]/a/span")
|
|
||||||
private WebElement addToFavoritesElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"navbar-submenu\"]/div[1]/div[1]/div[2]/div[1]/div[2]/ul/li[5]/a")
|
|
||||||
private WebElement documentsSubmenuElement;
|
|
||||||
public MainPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public void insertSearchHeaderText(String text) {
|
|
||||||
searchHeaderElement.sendKeys(text);
|
|
||||||
}
|
|
||||||
public void clickCompanyMenu() {
|
|
||||||
companyElement.click();
|
|
||||||
}
|
|
||||||
public void clickAdditionalInfoMenu() {
|
|
||||||
additionalInfoElement.click();
|
|
||||||
}
|
|
||||||
public void clickAddToFavoritesElement() {
|
|
||||||
addToFavoritesElement.click();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayMenu() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id='main']/div/div[2]")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayMain() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id=\"main\"]/div/div[2]/div[1]/div/a")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isMessageDisplay() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id=\"home\"]/div[8]/div/div/div/div/div/div[1]")).isDisplayed();
|
|
||||||
}
|
|
||||||
public void clickCompanySubmenu() {
|
|
||||||
Actions action = new Actions(driver);
|
|
||||||
action.moveToElement(companyElement).perform();
|
|
||||||
companySubmenuElement.sendKeys(Keys.ENTER);
|
|
||||||
}
|
|
||||||
public void clickDocumentSubmenu() {
|
|
||||||
Actions action = new Actions(driver);
|
|
||||||
action.moveToElement(companyElement).perform();
|
|
||||||
documentsSubmenuElement.sendKeys(Keys.ENTER);
|
|
||||||
}
|
|
||||||
public void clickFooterElement() {
|
|
||||||
footerElementNavigation.click();
|
|
||||||
}
|
|
||||||
public void clickFooterLinksElement() {
|
|
||||||
footerElementExternalLinks.click();
|
|
||||||
}
|
|
||||||
public void submitSearchHeader() {
|
|
||||||
searchHeaderElement.sendKeys(Keys.RETURN);
|
|
||||||
try {
|
|
||||||
Thread.sleep(5000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
|
|
||||||
public class MyFavoritesPage {
|
|
||||||
WebDriver driver;
|
|
||||||
private WebElement addToFavoritesElement;
|
|
||||||
public MyFavoritesPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayMyFavorites() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Избранное\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SearchPage {
|
|
||||||
WebDriver driver;
|
|
||||||
@FindBy(css = ".page-result-search .list-group-item")
|
|
||||||
private List<WebElement> listResultSearch;
|
|
||||||
@FindBy(xpath = "//*[@id=\"topSearchForm\"]/input[1]")
|
|
||||||
private WebElement searchHeaderElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div/div[4]/button[2]")
|
|
||||||
private WebElement searchFilterElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div/div[5]/a[2]")
|
|
||||||
private WebElement searchSortingElement;
|
|
||||||
public SearchPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public void clickSearchFilterElement() {
|
|
||||||
searchFilterElement.click();
|
|
||||||
}
|
|
||||||
public void clickSearchSortingElement() {
|
|
||||||
searchSortingElement.click();
|
|
||||||
}
|
|
||||||
public boolean checkSearch() {
|
|
||||||
boolean checkSearch = false;
|
|
||||||
int count = listResultSearch.size();
|
|
||||||
String strSearch = searchHeaderElement.getAttribute("value");
|
|
||||||
for (int i = 0; i < count - 1; i++) {
|
|
||||||
if (listResultSearch.get(i).getText().contains(strSearch))
|
|
||||||
checkSearch = true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package page;
|
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.WebElement;
|
|
||||||
import org.openqa.selenium.support.FindBy;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class SubMenuPage {
|
|
||||||
WebDriver driver;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[1]/div/div/div/div[3]/div[1]/a")
|
|
||||||
private WebElement plusElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[1]/ul/li[2]/a/span")
|
|
||||||
private WebElement hyperlinkElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"header\"]/div[2]/div/div/div[1]/div/a")
|
|
||||||
private WebElement logotypeElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[2]/div[1]/ol/li[2]/a")
|
|
||||||
private WebElement breadcrumbsElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[2]/ul/li[2]/a/span")
|
|
||||||
private WebElement sidebarElementExternalLinks;
|
|
||||||
@FindBy(xpath = "//*[@id=\"main\"]/div/div[3]/div[2]/div[3]/ul/li[2]/a/span")
|
|
||||||
private WebElement myFavoritesElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[1]")
|
|
||||||
private WebElement addDocumentToFavoritesElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[3]")
|
|
||||||
private WebElement openDocumentElement;
|
|
||||||
@FindBy(xpath = "//*[@id=\"collapsable-div-9ecd7f1d-3608-4b3f-a869-dff93a057a2a\"]/ul/li[1]/div/a[2]")
|
|
||||||
private WebElement downloandDocumentElement;
|
|
||||||
public boolean isMessageDisplay() {
|
|
||||||
return driver.findElement(By.xpath("//*[@id=\"home\"]/div[8]/div/div/div/div/div/div[1]")).isDisplayed();
|
|
||||||
}
|
|
||||||
public void clickBreadcrumbsElement() {
|
|
||||||
breadcrumbsElement.click();
|
|
||||||
}
|
|
||||||
public void clickSidebarExternalElement() {
|
|
||||||
sidebarElementExternalLinks.click();
|
|
||||||
}
|
|
||||||
public void clickMyFavoritesElement() {
|
|
||||||
myFavoritesElement.click();
|
|
||||||
}
|
|
||||||
public void clickAddDocumentToFavoritesElement() {
|
|
||||||
addDocumentToFavoritesElement.click();
|
|
||||||
}
|
|
||||||
public void clickOpenDocumentElement() {
|
|
||||||
openDocumentElement.click();
|
|
||||||
}
|
|
||||||
public void clickDownloandDocumentElement() {
|
|
||||||
downloandDocumentElement.click();
|
|
||||||
}
|
|
||||||
public void clickPlus() {
|
|
||||||
plusElement.click();
|
|
||||||
}
|
|
||||||
public void clickHyperlink() {
|
|
||||||
hyperlinkElement.click();
|
|
||||||
}
|
|
||||||
public void clickLogoElement() {
|
|
||||||
logotypeElement.click();
|
|
||||||
}
|
|
||||||
public SubMenuPage(WebDriver driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
public boolean isPageDisplaySubmenu() {
|
|
||||||
return driver.findElement(By.className("panel-heading")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayPlus() {
|
|
||||||
return driver.findElement(By.cssSelector(".collapse.in")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayMinus() {
|
|
||||||
return driver.findElement(By.cssSelector("div[aria-expanded='false']")).isDisplayed();
|
|
||||||
}
|
|
||||||
public boolean isPageDisplayDocuments() {
|
|
||||||
return driver.findElement(By.xpath("//div[@class=\"page-title\"]/h1[@title=\"Внутренние документы\"]")).isDisplayed();
|
|
||||||
}
|
|
||||||
public String getFileName() {
|
|
||||||
String fileName = openDocumentElement.getAttribute("href");
|
|
||||||
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkOpen(String str) {
|
|
||||||
boolean check = false;
|
|
||||||
File f = new File(str);
|
|
||||||
String s = driver.getCurrentUrl();
|
|
||||||
if (s.contains(str))
|
|
||||||
check = true;
|
|
||||||
return check;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -3,5 +3,6 @@ package ru.ulstu.tis;
|
|||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
System.out.println("666");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class SearchPage {
|
|||||||
@FindBy(css = "input.header-search-input")
|
@FindBy(css = "input.header-search-input")
|
||||||
private WebElement inputField;
|
private WebElement inputField;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
@FindBy(xpath = "//a[contains(@href, 'Users')]")
|
||||||
private WebElement usersLink;
|
private WebElement usersLink;
|
||||||
|
|
||||||
public SearchPage(WebDriver driver) {
|
public SearchPage(WebDriver driver) {
|
||||||
|
Loading…
Reference in New Issue
Block a user