diff --git a/Rukavishnikova/pom.xml b/Rukavishnikova/pom.xml new file mode 100644 index 0000000..6acbed6 --- /dev/null +++ b/Rukavishnikova/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/Rukavishnikova/src/test/java/ru/oriflame/pages/AnotherLinks.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/AnotherLinks.java new file mode 100644 index 0000000..6bc6f04 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/AnotherLinks.java @@ -0,0 +1,36 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class AnotherLinks { + public WebDriver driver; + + public AnotherLinks(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(className = "shipping-info-link") + private WebElement delivery; + + @FindBy(linkText = "Контакты Сервисных Центров Орифлэйм") + private WebElement contactsServicesCenters; + + @FindBy(css = "nav.w-grid > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)") + private WebElement oriLogo; + + public void deliveryClicking () { + delivery.click(); + } + + public void clickingContactsServicesCenters() { + contactsServicesCenters.click(); + } + + public void clickingOrifalemLogo() { + oriLogo.click(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java new file mode 100644 index 0000000..a6a2960 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java @@ -0,0 +1,30 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class ChangeLanguages { + + public WebDriver driver; + + public ChangeLanguages(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(xpath = "//*[@id=\"accordion-2\"]") + private WebElement asiaButton; + + @FindBy(xpath = "//*[@id=\"sect2\"]/ul[1]/li[1]/a/span") + private WebElement chinaLink; + + public void asiaButtonClicking() { + asiaButton.click(); + } + + public void chinaLinking() { + chinaLink.click(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/FilterBy.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/FilterBy.java new file mode 100644 index 0000000..b8b6deb --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/FilterBy.java @@ -0,0 +1,71 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class FilterBy { + + public WebDriver driver; + + public FilterBy(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a") + private WebElement face; + + // "Фильтровать по" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[1]/div[1]") + private WebElement openedFilterrBy; + + // "Показаниям" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[2]/h3") + private WebElement filetrByIndications; + + // "Возрасту" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[5]/h3") + private WebElement filterByAge; + + // "По преимуществу" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/h3") + private WebElement filterByAdvantage; + + // "Брендам" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[6]/h3") + private WebElement filterByBrand; + + // "По преимуществу" пункт - осветление + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[7]/a") + private WebElement filterByAdvantageOsv; + + public void faceClick() { + face.click(); + } + + public void openingFilterBy() { + openedFilterrBy.click(); + } + + public void clickingFilterByIndications() { + filetrByIndications.click(); + } + + public void clickingFilterByAge() { + filterByAge.click(); + } + + public void clickingFilterByAdvantage () { + filterByAdvantage.click(); + } + + public void clickingFilterByBrand() { + filterByBrand.click(); + } + + public void clickingFilterByAdvantageOsv () { + filterByAdvantageOsv.click(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java new file mode 100644 index 0000000..c2322aa --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java @@ -0,0 +1,51 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class MainPage { + + public WebDriver driver; + + public MainPage(WebDriver driver) { + PageFactory.initElements(driver, this); + } + + // Переход по верхнему меню ("Лицо") + @FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a") + private WebElement face; + + // Переход по кнопке в шапке профиля ("Регистрация") + @FindBy(css = "body > header > div > div.ui-sticky-bar.js-sticky-bar > div.w-sticky-bar-list.clearfix > ul > li:nth-child(3) > a") + private WebElement registr; + + // Переход по кнопке в подвале профиля ("Выбор страны") + @FindBy(css = "body > footer > div.ui-standard-footer.w-grid > ul > li:nth-child(3) > a") + private WebElement podval; + + // Переход по баннеру + @FindBy(css = "#hero-promo-slider > div.rsOverflow > div > div.rsSlide.rsActiveSlide > div > article > a > div.image-A1 > img") + private WebElement banner; + + // Переход на продукт + @FindBy(css = "#main > div > div:nth-child(2) > div > div > div > section.tab.ui-product-list.g-all.active > a:nth-child(1) > div.figure > img") + private WebElement product; + + public void faceClick() { + face.click(); + } + + public void registrClick() { + registr.click(); + } + + public void podvalClick() { + podval.click(); + } + + public void bannerClick() { banner.click(); } + + public void productClick() { product.click(); } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/MultiMedia.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/MultiMedia.java new file mode 100644 index 0000000..498c4e6 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/MultiMedia.java @@ -0,0 +1,31 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class MultiMedia { + + public WebDriver driver; + + public MultiMedia(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(xpath = "//*[@id=\"block-block-5\"]/p/a") + private WebElement playVideo; + + @FindBy(css = "body > div.mfp-wrap.mfp-close-btn-in.mfp-auto-cursor.mfp-ready > div > div > div > button") + private WebElement closeButton; + + public void playVideoElement() { + playVideo.click(); + } + + public void closeButton() { + closeButton.click(); + } + +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java new file mode 100644 index 0000000..b0b6743 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java @@ -0,0 +1,34 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class Search { + + public WebDriver driver; + + public Search(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(css = "#global-search") + private WebElement searchField; + + @FindBy(css = "#form-search > fieldset > button") + private WebElement searchButton; + + public void inputSearchField(String keyWord) { + searchField.sendKeys(keyWord); + } + + public void clickSearchingButton() { + searchButton.click(); + } + + //public void enterTap() { + // searchField.sendKeys(Keys.ENTER); + //} +} \ No newline at end of file diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/SortBy.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/SortBy.java new file mode 100644 index 0000000..695e369 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/SortBy.java @@ -0,0 +1,38 @@ +package ru.oriflame.pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class SortBy { + public WebDriver driver; + + public SortBy(WebDriver driver) { + PageFactory.initElements(driver, this); + this.driver = driver; + } + + @FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a") + private WebElement face; + + //"Сортировать по" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[1]/div[2]") + private WebElement sortingBy; + + //"По популярности" + @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[2]/ul/li[2]/span/label") + private WebElement byPopular; + + public void faceClick() { + face.click(); + } + + public void sortByClick() { + sortingBy.click(); + } + + public void sortByPopularClick() { + byPopular.click(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/AnotherlinksTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/AnotherlinksTest.java new file mode 100644 index 0000000..4fe7bf7 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/AnotherlinksTest.java @@ -0,0 +1,56 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import ru.oriflame.pages.AnotherLinks; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class AnotherlinksTest { + + public static WebDriver driver; + public static AnotherLinks anotherLinks; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + anotherLinks = new AnotherLinks(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://www.oriflame.ru/products/product?code=32418"); + } + + // Открытие формы на странице + @Test + public void checkDeliveryClick() { + TestCase.assertTrue("Testing if true holds", true); + anotherLinks.deliveryClicking(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://www.oriflame.ru/products/product?code=32418")); + } + + // Внешняя ссылка + @Test + public void checkContactsSCClick() { + TestCase.assertTrue("Testing if true holds", true); + anotherLinks.deliveryClicking(); + anotherLinks.clickingContactsServicesCenters(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://www.oriflame.ru/products/~/link.aspx?_id=C4D5FBB327A943F5AC38D85A6D69ED21&_z=z")); + } + + // Переход на главную страницу по логотипу + @Test + public void checkOriflameLogoClickingFromMainPage() { + TestCase.assertTrue("Testing if true holds", true); + anotherLinks.clickingOrifalemLogo(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://www.oriflame.ru")); + } + +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java new file mode 100644 index 0000000..a3af7d9 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java @@ -0,0 +1,44 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import ru.oriflame.pages.ChangeLanguages; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class ChangeLanguageTest { + + public static WebDriver driver; + public static ChangeLanguages changeLanguage; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + changeLanguage = new ChangeLanguages(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://oriflame.com/"); + } + + // Перевод на другой язык + @Test + public void checkChangelanguage() { + TestCase.assertTrue("Testing if true holds", true); + changeLanguage.asiaButtonClicking(); + changeLanguage.chinaLinking(); + driver.manage().timeouts().implicitlyWait(50, SECONDS); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://cn.oriflame.com/")); + } + + @AfterClass + public static void closeChrome() { + driver.close(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/FilterByTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/FilterByTest.java new file mode 100644 index 0000000..8ed577e --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/FilterByTest.java @@ -0,0 +1,98 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import ru.oriflame.pages.FilterBy; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class FilterByTest { + public static WebDriver driver; + public static FilterBy filterBy; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + filterBy = new FilterBy(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://www.oriflame.ru"); + } + + //Раскрытие пунктов фильтрации + @Test + public void checkOpenFilters() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Раскрытие фильтров "По показаниям" + @Test + public void checkFilterByIndications() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + filterBy.clickingFilterByIndications(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Раскрытие фильтров "По возрасту" + @Test + public void checkFilterByAge() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + filterBy.clickingFilterByAge(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Раскрытие фильтров "Преимуществу" + @Test + public void checkFilterByAdvantage() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + filterBy.clickingFilterByAdvantage(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Раскрытие фильтров "По бренду" + @Test + public void checkFilterByBrand() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + filterBy.clickingFilterByBrand(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Раскрытие фильтров "По преимуществу" и выбор подпункта + @Test + public void checkFilterByAdvantageOsv() { + TestCase.assertTrue("Testing if true holds", true); + filterBy.faceClick(); + filterBy.openingFilterBy(); + filterBy.clickingFilterByAdvantage(); + filterBy.clickingFilterByAdvantageOsv(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare/?benefits=fairness"))); + } + + @AfterClass + public static void closeChrome() { + driver.close(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/MainPageTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/MainPageTest.java new file mode 100644 index 0000000..2348263 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/MainPageTest.java @@ -0,0 +1,81 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import ru.oriflame.pages.MainPage; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class MainPageTest { + + private static WebDriver driver; + private static MainPage mainPage; + + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + mainPage = new MainPage(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://www.oriflame.ru/"); + } + + // Переход на пункты в верхнем меню ("Лицо") + @Test + public void checkHeightMenu() { + TestCase.assertTrue("Testing if true holds", true); + mainPage.faceClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Переход на пункты в шапке + @Test + public void checkProfileCap() { + TestCase.assertTrue("Testing if true holds", true); + mainPage.registrClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://www.oriflame.ru/business-opportunity/become-consultant")); + } + + // Переход на пункты в подвале + @Test + public void checkDown() { + TestCase.assertTrue("Testing if true holds", true); + mainPage.podvalClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://oriflame.com"))); + } + + + // Переход по баннеру + @Test + public void checkBasementLink() { + TestCase.assertTrue("Testing if true holds", true); + mainPage.bannerClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/products/product?code=33959"))); + } + + // Переход по продукт + @Test + public void checkProduct() { + TestCase.assertTrue("Testing if true holds", true); + mainPage.productClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/products/product?code=32440"))); + } + + @AfterClass + public static void chromeClose() { + driver.quit(); + } + +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java new file mode 100644 index 0000000..f7def0e --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java @@ -0,0 +1,44 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import ru.oriflame.pages.MultiMedia; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class MultiMediaTest { + + public static WebDriver driver; + public static MultiMedia multiMedia; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + multiMedia = new MultiMedia(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("http://investors.oriflame.com/"); + } + + // Запуск видео + @Test + public void checkVideoPlay() { + TestCase.assertTrue("Testing if true holds", true); + multiMedia.playVideoElement(); + driver.manage().timeouts().implicitlyWait(15, SECONDS); + multiMedia.closeButton(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("http://investors.oriflame.com")); + } + + @AfterClass + public static void closeChrome() { + driver.close(); + } +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/SearchingTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/SearchingTest.java new file mode 100644 index 0000000..589bba3 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/SearchingTest.java @@ -0,0 +1,53 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import ru.oriflame.pages.Search; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class SearchingTest { + public static WebDriver driver; + public static Search search; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + search = new Search(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://oriflame.ru/"); + } + + // Работа "поиска" по сайту (по ключевым словам) + @Test + public void checkSearchingByKeyWords() throws InterruptedException { + TestCase.assertTrue("Testing if true holds", true); + search.inputSearchField("шампунь"); + search.clickSearchingButton(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/search?query=шампунь"))); + } + + // Работа "поиска" по сайту (по цифрам) + @Test + public void checkSearchingByNumb() throws InterruptedException { + TestCase.assertTrue("Testing if true holds", true); + search.inputSearchField("123"); + search.clickSearchingButton(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/search?query=123"))); + } + + @AfterClass + public static void cromeClose() { + driver.close(); + } + +} diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/SortByTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/SortByTest.java new file mode 100644 index 0000000..92bac05 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/SortByTest.java @@ -0,0 +1,55 @@ +package ru.oriflame.tests; + +import junit.framework.TestCase; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import ru.oriflame.pages.SortBy; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public class SortByTest { + + public static WebDriver driver; + public static SortBy sortBy; + + @BeforeClass + public static void setup() { + System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); + driver = new ChromeDriver(); + sortBy = new SortBy(driver); + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(20, SECONDS); + driver.get("https://www.oriflame.ru"); + } + + // Открытие выпадающего меню + @Test + public void checkShowMenuSort() { + + TestCase.assertTrue("Testing if true holds", true); + sortBy.faceClick(); + sortBy.sortByClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare"))); + } + + // Сортировка по популярности + @Test + public void checkLinkBySort() { + TestCase.assertTrue("Testing if true holds", true); + sortBy.faceClick(); + sortBy.sortByClick(); + sortBy.sortByPopularClick(); + String url = driver.getCurrentUrl(); + Assert.assertTrue(url.contains("https://www.oriflame.ru/skincare/?sort=popular")); + } + + @AfterClass + public static void closeChrome() { + driver.close(); + } +}