Rukavishnikova #13

Closed
kotenok-339 wants to merge 1 commits from Rukavishnikova into master
15 changed files with 757 additions and 0 deletions

35
Rukavishnikova/pom.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>project_testing</groupId>
<artifactId>project_testing</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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(); }
}

View File

@ -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();
}
}

View File

@ -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);
//}
}

View File

@ -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();
}
}

View File

@ -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"));
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}