From 653dc6fd716be87d2e67204d39bc422cca5c84c3 Mon Sep 17 00:00:00 2001 From: Rukavishnikova Date: Tue, 20 Nov 2018 02:41:01 +0400 Subject: [PATCH] InitialCommit --- Rukavishnikova/pom.xml | 35 +++++++ .../java/ru/oriflame/pages/AnotherLinks.java | 36 ++++++++ .../ru/oriflame/pages/ChangeLanguages.java | 30 ++++++ .../test/java/ru/oriflame/pages/FilterBy.java | 65 +++++++++++++ .../test/java/ru/oriflame/pages/MainPage.java | 46 ++++++++++ .../java/ru/oriflame/pages/MultiMedia.java | 31 +++++++ .../test/java/ru/oriflame/pages/Search.java | 30 ++++++ .../test/java/ru/oriflame/pages/SortBy.java | 36 ++++++++ .../ru/oriflame/tests/AnotherlinksTest.java | 53 +++++++++++ .../ru/oriflame/tests/ChangeLanguageTest.java | 43 +++++++++ .../java/ru/oriflame/tests/FilterByTest.java | 92 +++++++++++++++++++ .../java/ru/oriflame/tests/MainPageTest.java | 75 +++++++++++++++ .../ru/oriflame/tests/MultiMediaTest.java | 43 +++++++++ .../java/ru/oriflame/tests/SearchingTest.java | 51 ++++++++++ .../java/ru/oriflame/tests/SortByTest.java | 53 +++++++++++ 15 files changed, 719 insertions(+) create mode 100644 Rukavishnikova/pom.xml create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/AnotherLinks.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/ChangeLanguages.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/FilterBy.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/MultiMedia.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/pages/SortBy.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/AnotherlinksTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/FilterByTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/MainPageTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/SearchingTest.java create mode 100644 Rukavishnikova/src/test/java/ru/oriflame/tests/SortByTest.java 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..3910f8b --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/FilterBy.java @@ -0,0 +1,65 @@ +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..7c636f0 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java @@ -0,0 +1,46 @@ +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..0c59976 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.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 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(); + } +} \ 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..2277a09 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/SortBy.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 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..9aa0743 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/AnotherlinksTest.java @@ -0,0 +1,53 @@ +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..8e7d453 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java @@ -0,0 +1,43 @@ +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..6f0eb80 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/FilterByTest.java @@ -0,0 +1,92 @@ +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..95d2e15 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/MainPageTest.java @@ -0,0 +1,75 @@ +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..6db0216 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java @@ -0,0 +1,43 @@ +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..83e40cc --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/SearchingTest.java @@ -0,0 +1,51 @@ +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..f55c113 --- /dev/null +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/SortByTest.java @@ -0,0 +1,53 @@ +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(); + } +}