diff --git a/Zamaldinova/pom.xml b/Zamaldinova/pom.xml new file mode 100644 index 0000000..6acbed6 --- /dev/null +++ b/Zamaldinova/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + project_testing + project_testing + 1.0-SNAPSHOT + + + + + junit + junit + 4.12 + test + + + + org.seleniumhq.selenium + selenium-java + 3.4.0 + + + + org.testng + testng + 6.9.10 + test + + + + + \ No newline at end of file diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf new file mode 100644 index 0000000..6769719 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf (1).crdownload b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf (1).crdownload new file mode 100644 index 0000000..7f5f8d3 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf (1).crdownload differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf.crdownload b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf.crdownload new file mode 100644 index 0000000..617a0db Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (1).pdf.crdownload differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (2).pdf b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (2).pdf new file mode 100644 index 0000000..6769719 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (2).pdf differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (3).pdf b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (3).pdf new file mode 100644 index 0000000..6769719 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (3).pdf differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (4).pdf b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (4).pdf new file mode 100644 index 0000000..6769719 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer (4).pdf differ diff --git a/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer.pdf b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer.pdf new file mode 100644 index 0000000..6769719 Binary files /dev/null and b/Zamaldinova/src/main/resources/downloads/Настройка_браузера_Internet_Explorer.pdf differ diff --git a/Zamaldinova/src/main/resources/drivers/chromedriver b/Zamaldinova/src/main/resources/drivers/chromedriver new file mode 100644 index 0000000..02ff671 Binary files /dev/null and b/Zamaldinova/src/main/resources/drivers/chromedriver differ diff --git a/Zamaldinova/src/main/resources/drivers/chromedriver.exe b/Zamaldinova/src/main/resources/drivers/chromedriver.exe new file mode 100644 index 0000000..28a4067 Binary files /dev/null and b/Zamaldinova/src/main/resources/drivers/chromedriver.exe differ diff --git a/Zamaldinova/src/main/resources/drivers/geckodriver b/Zamaldinova/src/main/resources/drivers/geckodriver new file mode 100644 index 0000000..ba1da8c Binary files /dev/null and b/Zamaldinova/src/main/resources/drivers/geckodriver differ diff --git a/Zamaldinova/src/main/resources/drivers/geckodriver.exe b/Zamaldinova/src/main/resources/drivers/geckodriver.exe new file mode 100644 index 0000000..6208aa8 Binary files /dev/null and b/Zamaldinova/src/main/resources/drivers/geckodriver.exe differ diff --git a/Zamaldinova/src/test/java/ru/sports/context/ChromeContext.java b/Zamaldinova/src/test/java/ru/sports/context/ChromeContext.java new file mode 100644 index 0000000..3f5e7eb --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/context/ChromeContext.java @@ -0,0 +1,38 @@ +package ru.sports.context; + +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.chrome.ChromeOptions; + +import java.util.HashMap; +import java.util.Map; + +public class ChromeContext extends Context { + private final static String WINDOWS_DRIVER = "chromedriver.exe"; + private final static String LINUX_DRIVER = "chromedriver"; + private final static String DRIVER_TYPE = "webdriver.chrome.driver"; + + @Override + protected void createDriver() { + // driver = new ChromeDriver(); + ChromeOptions options = new ChromeOptions(); + Map prefs = new HashMap(); + + tmpPath = System.getProperty("user.dir") + "/src/main/resources/downloads/"; + + prefs.put("download.default_directory", tmpPath); + //prefs.put("plugins.always_open_pdf_externally", true); + + options.setExperimentalOption("prefs",prefs); + driver = new ChromeDriver(options); + } + + @Override + protected String getDriverExecutable(boolean isWindows) { + return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER; + } + + @Override + protected String getDriverType() { + return DRIVER_TYPE; + } +} diff --git a/Zamaldinova/src/test/java/ru/sports/context/Context.java b/Zamaldinova/src/test/java/ru/sports/context/Context.java new file mode 100644 index 0000000..7ed3527 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/context/Context.java @@ -0,0 +1,44 @@ +package ru.sports.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); + driver.manage().window().maximize(); + } + + 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"); + } +} diff --git a/Zamaldinova/src/test/java/ru/sports/context/FirefoxContext.java b/Zamaldinova/src/test/java/ru/sports/context/FirefoxContext.java new file mode 100644 index 0000000..9bc1bf7 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/context/FirefoxContext.java @@ -0,0 +1,24 @@ +package ru.sports.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; + } +} diff --git a/Zamaldinova/src/test/java/ru/sports/pages/AnotherLinks.java b/Zamaldinova/src/test/java/ru/sports/pages/AnotherLinks.java new file mode 100644 index 0000000..476add2 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/pages/AnotherLinks.java @@ -0,0 +1,49 @@ +package ru.sports.pages; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class AnotherLinks { + public WebDriver driver; + + + public AnotherLinks(WebDriver driver) { + this.driver = driver; + } + + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[1]/div/div/a[1]") + private WebElement facebook; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[1]/div/div/a[2]") + private WebElement VK; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[1]/div/div/a[3]") + private WebElement Twitter; + + + + public void facebookClick () { facebook.click(); } + public void VKClick () { VK.click(); } + public void TwitterClick () { Twitter.click(); } + + + + public boolean assertFacebookClick() { + return driver.findElement(By.cssSelector("#blueBarDOMInspector > div > div > div > div.lfloat._ohe > a")).isDisplayed(); + + } + + public boolean assertVKClick() { + return driver.findElement(By.cssSelector("#top_nav > div:nth-child(1) > a > div")).isDisplayed(); + + } + + public boolean assertTwitterClick() { + return driver.findElement(By.cssSelector("#global-nav-home > a > span.Icon.Icon--bird.Icon--large")).isDisplayed(); + + } + +} diff --git a/Zamaldinova/src/test/java/ru/sports/pages/ChangeLanguages.java b/Zamaldinova/src/test/java/ru/sports/pages/ChangeLanguages.java new file mode 100644 index 0000000..80aeb04 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/pages/ChangeLanguages.java @@ -0,0 +1,86 @@ +package ru.sports.pages; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class ChangeLanguages { + public WebDriver driver; + + + public ChangeLanguages(WebDriver driver) { + this.driver = driver; + } + + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/header/nav[1]/div/div/div/span[2]") + private WebElement flag; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/header/nav[1]/div/div/ul/li[3]/a") + private WebElement Ukrain; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/header/nav[1]/div/div/ul/li[2]/a") + private WebElement Belarus; + + public void flagClick() { + try { + Thread.sleep(20000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + flag.click(); + } + + public void UkrainClick() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Ukrain.click(); +} + + public void BelarusClick() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Belarus.click(); + } + + + public boolean assertChangeUkrainLanguage() { + try { + Thread.sleep(20000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + try { + return driver.findElement(By.cssSelector("#branding-layout > " + + "div.page-layout > header > div.main-header__content-wrapper.main-wrap > a")).getText().indexOf("Ворскла") >= 0; + } catch (Exception e) { + return false; + } + } + + public boolean assertChangeBelarusLanguage() { + try { + Thread.sleep(20000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + try { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > aside > section:nth-child(7) > div > div.gadget__tournament-data > div > div:nth-child(1) > div.accordion__body >" + + " table > tbody > tr:nth-child(4) > td:nth-child(2) > a")).getText().indexOf("Динамо Минск") >= 0; + } catch (Exception e) { + return false; + } + } + } + diff --git a/Zamaldinova/src/test/java/ru/sports/pages/FilterBy.java b/Zamaldinova/src/test/java/ru/sports/pages/FilterBy.java new file mode 100644 index 0000000..1fed10c --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/pages/FilterBy.java @@ -0,0 +1,153 @@ +package ru.sports.pages; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class FilterBy { + + public WebDriver driver; + + public FilterBy(WebDriver driver) { + this.driver = driver; + } + + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/div/label[1]/select") + private WebElement typeOfSport; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/div/label[1]/select/option[2]") + private WebElement football; + + @FindBy(css = "#branding-layout > div.page-layout > div > div > div > div > aside > " + + "section:nth-child(3) > div > form > div > label:nth-child(2) > select") + private WebElement tourneer; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/div/label[2]/select/option[2]") + private WebElement leagueOfNation; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/div/label[3]/select") + private WebElement comand; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/div/label[3]/select/option[2]") + private WebElement Austria; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[3]/div/form/label/input") + private WebElement Parameters; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[16]/div/div[1]/label/select") + private WebElement selectTypeOfSport; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/div/div/aside/section[16]/div/div[1]/label/select/option[15]") + private WebElement Baseball; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/aside/section[1]/div/div[1]/form/select") + private WebElement Type; + + @FindBy(xpath = "//*[@id=\"branding-layout\"]/div[1]/div/div/aside/section[1]/div/div[1]/form/select/option[12]") + private WebElement Turkey; + + public void typeOfSportClick() { + typeOfSport.click(); + } + + + public void footballClick() { + football.click(); + } + + public void tourneerClick() { + tourneer.click(); + } + + public void leagueOfNationClick() { + leagueOfNation.click(); + } + + public void comandClick() { + comand.click(); + } + + public void AustriaClick() { + Austria.click(); + } + + public void saveParametersClick() { + Parameters.click(); + } + + public void selectTypeOfSportClick() { + selectTypeOfSport.click(); + } + + public void BaseballClick() { + Baseball.click(); + } + + public void selectTypeClick() { + Type.click(); + } + + public void TurkeyClick() { + Turkey.click(); + } + + + public boolean AssertSelectTypeOfSport() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > div > div > aside > " + + "section:nth-child(3) > div > form > div > label:nth-child(2) > select")).isDisplayed(); + } + + public boolean AssertTourneer() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > div > div > aside > section:nth-child(3)" + + " > div > form > div > label:nth-child(3) > select")).isDisplayed(); + } + + public boolean AssertComand() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > div > div >" + + " aside > section:nth-child(3) > div > form > label > input")).isDisplayed(); + } + public boolean AssertUseFilter() { + + try { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > div > div " + + "> aside > section:nth-child(3) > div > div > ul > li > a")).getText().indexOf(" Жеребьевка Евро-2020") >= 0; + } + catch (Exception e) + { + return false; + } + } + public boolean AssertUseFilterForNewsFromUsers() { + + try { + return driver.findElement(By.cssSelector("#branding-layout > " + + "div.page-layout > div > div > div > div > aside > section:nth-child(16) > div >" + + " div.users-news__tabs.tabs_state_horizontal.tabs.tabs_animate.tabs_animate_horizontal-slide >" + + " div.tabs__body >" + + " div.users-news__tabs-panel.users-news__top-panel.tabs__panel.tabs__panel_active > " + + "ul:nth-child(4) > li")).getText().indexOf(" Зал славы бейсбола") >= 0; + } + catch (Exception e) + { + return false; + } + } + + public boolean AssertUseFilterForStatistics() { + + try { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > aside > section:nth-child(6) > div > div.gadget__tournament-data > div > div:nth-child(1) > div.accordion__body" + + " > table > tbody > tr:nth-child(2) > td:nth-child(2) > a")).getText().indexOf("Истанбул") >= 0; + } + catch (Exception e) + { + return false; + } + } + + + +} + diff --git a/Zamaldinova/src/test/java/ru/sports/pages/MainPage.java b/Zamaldinova/src/test/java/ru/sports/pages/MainPage.java new file mode 100644 index 0000000..fff3c5f --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/pages/MainPage.java @@ -0,0 +1,112 @@ +package ru.sports.pages; + +import org.openqa.selenium.By; +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 { + public static WebDriver driver; + + public MainPage(WebDriver driver) { + this.driver = driver; + } + + @FindBy(css = "#branding-layout > div.page-layout > header > nav.main-menu.main-menu_type_second.main-wrap" + +" > ul > li.main-menu__item.main-menu__item-basketball > a") + private WebElement SubmenuElement; + + @FindBy(css = "#branding-layout > div.page-layout > header > nav.main-menu.main-menu_type_second.main-wrap > ul" + +" > li.main-menu__item.main-menu__item-basketball > div > ul:nth-child(1) > li:nth-child(3) > a") + private WebElement Submenu; + + @FindBy(css = "#branding-layout > div.page-layout > header > nav.main-menu.main-menu_type_second.main-wrap" + +" > ul > li.main-menu__item.main-menu__item-biathlon > a") + private WebElement MainMenuElement; + + @FindBy(css = "body > div.user-panel.user-panel--new.js-active.user-panel_state_loaded" + +" > div > div > a.user-panel__logo > svg > use") + private WebElement Logo; + + @FindBy(css = "#branding-layout > div.page-layout > div > aside:nth-child(1) > section > article > a > img") + private WebElement Banner; + + @FindBy(css = "#branding-layout > div.page-layout > div > aside:nth-child(1) > div.js-active.accordion > div >" + +" div:nth-child(1) > div.accordion__body > ul > li:nth-child(1) >" + +" div.teaser-event__board.clearfix.js-popup-match_handle > div:nth-child(3) > a") + private WebElement Match; + + @FindBy(css = "#branding-layout > div.page-layout > footer > div.main-footer__lists-line.main-wrap.clearfix" + + " > dl.main-footer__list.main-footer__list_impressum.list-reset > dd:nth-child(4) > a)") + private WebElement Contacts; + + + public void clickSubmenu() { + Actions action = new Actions(driver); + action.moveToElement(SubmenuElement).perform(); + Submenu.click(); + } + + public void clickMainMenu() { + MainMenuElement.click(); + } + + public void clickLogo() { + Logo.click(); + } + + public void clickBanner() { + Banner.click(); + } + + public void clickOnMatch() { + Match.click(); + } + + public void clickOnContacts() { + Contacts.click(); + } + + + + + public boolean isPageDisplaySubmenu() { + return driver.findElement(By.cssSelector("#branding-layout > div > div.sportsru.sportsru--d > header" + + " > div > a.main-header__logo-link-nba")).isDisplayed(); + } + + public boolean isPageDisplayMainMenu() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > " + +"div > div > div > div > aside > section:nth-child(1) > h3 > a")).isDisplayed(); + } + + + + public boolean isPageDisplayMainPage() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div > div > div >" + +" div > aside > section:nth-child(1) > h3 > a")).isDisplayed(); + } + + + + public boolean isPageDisplayBanner() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > div >" + +" div.columns-layout.main-wrap > aside > section > h3")).isDisplayed(); + } + + + + public boolean isPageDisplayDetailsOfMatch() { + return driver.findElement(By.cssSelector("#branding-layout > div > div.contentLayout.js-active > div.box >" + +" div.title-page.bordered > h1")).isDisplayed(); + } + + public boolean isPageDisplayContacts() { + return driver.findElement(By.cssSelector("#branding-layout > div.page-layout > " + + "div > div.columns-layout.main-wrap > main > div > h1 > a")).isDisplayed(); + } + + + +} diff --git a/Zamaldinova/src/test/java/ru/sports/pages/Search.java b/Zamaldinova/src/test/java/ru/sports/pages/Search.java new file mode 100644 index 0000000..f50e090 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/pages/Search.java @@ -0,0 +1,46 @@ +package ru.sports.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import java.util.List; + +public class Search { + + public WebDriver driver; + + public Search(WebDriver driver) { + this.driver = driver; + } + + @FindBy(css = "#branding-layout > div.page-layout > header > " + + "div.main-header__content-wrapper.main-wrap > div.main-header__search-block > div > form > input") + private WebElement searchField; + + @FindBy(css = "#branding-layout > div.page-layout > header > div.main-header__content-wrapper.main-wrap" + + " > div.main-header__search-block > div > form > button > span") + private WebElement searchButton; + + @FindBy(css = ".page-result-search .list-group-item") + private List listResultSearch; + + public void inputSearchField(String text) { + searchField.click(); + searchField.sendKeys(text); + } + + public void clickSearchingButton() { + searchButton.click(); + } + + public boolean checkSearch(String strSearch) { + boolean checkSearch = false; + int count = listResultSearch.size(); + for (int i = 0; i < count - 1; i++) { + if (listResultSearch.get(i).getText().contains(strSearch)) + checkSearch = true; + } + return true; + } +} \ No newline at end of file diff --git a/Zamaldinova/src/test/java/ru/sports/tests/AnotherlinksTest.java b/Zamaldinova/src/test/java/ru/sports/tests/AnotherlinksTest.java new file mode 100644 index 0000000..60f279b --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/tests/AnotherlinksTest.java @@ -0,0 +1,53 @@ +package ru.sports.tests; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.support.PageFactory; +import ru.sports.context.ChromeContext; +import ru.sports.context.Context; +import ru.sports.pages.AnotherLinks; + +public class AnotherlinksTest { + + private final static String APP_URL = "https://www.sports.ru/"; + private static Context context; + + @BeforeClass + public static void setup() { + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); + } + + @Test + public void facebookClub() { + context.getDriver().get(APP_URL); + AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class); + anotherLinks.facebookClick(); + Assert.assertTrue(anotherLinks.assertFacebookClick()); + } + + @Test + public void VKClub() { + context.getDriver().get(APP_URL); + AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class); + anotherLinks.VKClick(); + Assert.assertTrue(anotherLinks.assertVKClick()); + } + + @Test + public void TwitterClub() { + context.getDriver().get(APP_URL); + AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class); + anotherLinks.TwitterClick(); + Assert.assertTrue(anotherLinks.assertTwitterClick()); + } + + +} diff --git a/Zamaldinova/src/test/java/ru/sports/tests/ChangeLanguageTest.java b/Zamaldinova/src/test/java/ru/sports/tests/ChangeLanguageTest.java new file mode 100644 index 0000000..78a7990 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/tests/ChangeLanguageTest.java @@ -0,0 +1,45 @@ +package ru.sports.tests; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.support.PageFactory; +import ru.sports.context.ChromeContext; +import ru.sports.context.Context; +import ru.sports.pages.ChangeLanguages; + +public class ChangeLanguageTest { + + private final static String APP_URL = "https://www.sports.ru/"; + private static Context context; + + @BeforeClass + public static void setup() { + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); + } + + @Test + public void checkChangeUkrainlanguage() { + context.getDriver().get(APP_URL); + ChangeLanguages changeLanguage = PageFactory.initElements(context.getDriver(), ChangeLanguages.class); + changeLanguage.flagClick(); + changeLanguage.UkrainClick(); + Assert.assertTrue(changeLanguage.assertChangeUkrainLanguage()); + } + + @Test + public void checkChangeBelaruslanguage() { + context.getDriver().get(APP_URL); + ChangeLanguages changeLanguage = PageFactory.initElements(context.getDriver(), ChangeLanguages.class); + changeLanguage.flagClick(); + changeLanguage.BelarusClick(); + Assert.assertTrue(changeLanguage.assertChangeBelarusLanguage()); + } +} diff --git a/Zamaldinova/src/test/java/ru/sports/tests/FilterByTest.java b/Zamaldinova/src/test/java/ru/sports/tests/FilterByTest.java new file mode 100644 index 0000000..b430565 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/tests/FilterByTest.java @@ -0,0 +1,97 @@ +package ru.sports.tests; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.support.PageFactory; +import ru.sports.context.ChromeContext; +import ru.sports.context.Context; +import ru.sports.pages.FilterBy; + +public class FilterByTest { + + private final static String APP_URL = "https://www.sports.ru/"; + private static Context context; + + @BeforeClass + public static void setup() { + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); + } + + @Test + public void selectTypeOfSport() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.typeOfSportClick(); + filterBy.footballClick(); + filterBy.AssertSelectTypeOfSport(); + } + + @Test + public void selectTourneer() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.typeOfSportClick(); + filterBy.footballClick(); + filterBy.typeOfSportClick(); + filterBy.tourneerClick(); + filterBy.leagueOfNationClick(); + filterBy.AssertTourneer(); + } + + @Test + public void selectComand() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.typeOfSportClick(); + filterBy.footballClick(); + filterBy.typeOfSportClick(); + filterBy.tourneerClick(); + filterBy.leagueOfNationClick(); + filterBy.tourneerClick(); + filterBy.comandClick(); + filterBy.AustriaClick(); + filterBy.AssertComand(); + } + @Test + public void useFilterForNewsOfMyComand() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.typeOfSportClick(); + filterBy.footballClick(); + filterBy.typeOfSportClick(); + filterBy.tourneerClick(); + filterBy.leagueOfNationClick(); + filterBy.tourneerClick(); + filterBy.comandClick(); + filterBy.AustriaClick(); + filterBy.comandClick(); + filterBy.saveParametersClick(); + filterBy.AssertUseFilter(); + } + + @Test + public void useFilterForNewsFromUsers() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.selectTypeOfSportClick(); + filterBy.BaseballClick(); + filterBy.AssertUseFilterForNewsFromUsers(); + } + + @Test + public void useFilterForStatistics() { + context.getDriver().get(APP_URL); + FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class); + filterBy.selectTypeClick(); + filterBy.TurkeyClick(); + filterBy.AssertUseFilterForStatistics(); + } + +} diff --git a/Zamaldinova/src/test/java/ru/sports/tests/MainPageTest.java b/Zamaldinova/src/test/java/ru/sports/tests/MainPageTest.java new file mode 100644 index 0000000..f60eedd --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/tests/MainPageTest.java @@ -0,0 +1,75 @@ +package ru.sports.tests; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.support.PageFactory; +import ru.sports.context.ChromeContext; +import ru.sports.context.Context; +import ru.sports.pages.MainPage; + +public class MainPageTest { + + private final static String APP_URL = "https://www.sports.ru/"; + private static Context context; + + @BeforeClass + public static void setup() { + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); + } + + @Test + public void SubmenuNavigationTest() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickSubmenu(); + Assert.assertTrue(page.isPageDisplaySubmenu()); + } + + @Test + public void MainMenuNavigationTest() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickMainMenu(); + Assert.assertTrue(page.isPageDisplayMainMenu()); + } + + @Test + public void NavigationByLogoTest() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickMainMenu(); + page.clickLogo(); + Assert.assertTrue(page.isPageDisplayMainPage()); + } + + @Test + public void NavigationByBanner() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickBanner(); + Assert.assertTrue(page.isPageDisplayBanner()); + } + + @Test + public void TableOfMatchesNavigation() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickOnMatch(); + Assert.assertTrue(page.isPageDisplayDetailsOfMatch()); + } + @Test + public void FooterNavigation() { + context.getDriver().get(APP_URL); + MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class); + page.clickOnContacts(); + Assert.assertTrue(page.isPageDisplayContacts()); + } +} diff --git a/Zamaldinova/src/test/java/ru/sports/tests/SearchingTest.java b/Zamaldinova/src/test/java/ru/sports/tests/SearchingTest.java new file mode 100644 index 0000000..1431cf2 --- /dev/null +++ b/Zamaldinova/src/test/java/ru/sports/tests/SearchingTest.java @@ -0,0 +1,48 @@ +package ru.sports.tests; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.support.PageFactory; +import ru.sports.context.ChromeContext; +import ru.sports.context.Context; +import ru.sports.pages.Search; + +public class SearchingTest { + + private final static String APP_URL = "https://www.sports.ru/"; + private static Context context; + String search1 = "Неймар"; + String search2 = "123"; + + + @BeforeClass + public static void setup() { + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); + } + + @Test + public void checkSearchingByKeyWords() { + context.getDriver().get(APP_URL); + Search search = PageFactory.initElements(context.getDriver(), Search.class); + search.inputSearchField(search1); + search.clickSearchingButton(); + Assert.assertTrue(search.checkSearch(search1)); + } + + @Test + public void checkSearchingByNumb() { + context.getDriver().get(APP_URL); + Search search = PageFactory.initElements(context.getDriver(), Search.class); + search.inputSearchField(search2); + search.clickSearchingButton(); + Assert.assertTrue(search.checkSearch(search2)); + } +}