Compare commits
2 Commits
Rukavishni
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
0ea8df6c32 | ||
|
0ba38238af |
@ -1,35 +0,0 @@
|
||||
<?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>
|
@ -1,51 +0,0 @@
|
||||
package ru.oriflame.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(className = "shipping-info-link")
|
||||
private WebElement form;
|
||||
|
||||
@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 formClicking () { form.click(); }
|
||||
|
||||
public void clickingContactsServicesCenters() {
|
||||
contactsServicesCenters.click();
|
||||
}
|
||||
|
||||
public void clickingOrifalemLogo() { oriLogo.click(); }
|
||||
|
||||
public boolean assertMainMenu() { return driver.findElement(By.cssSelector("#main > div")).isDisplayed(); }
|
||||
|
||||
public boolean assertContactsServicesCenters() {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return driver.findElement(By.cssSelector("body > div.w-grid")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFormClick() {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return driver.findElement(By.cssSelector("#pdp-shipping-popup")).isDisplayed();
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package ru.oriflame.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=\"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();
|
||||
}
|
||||
|
||||
public boolean assertChangelanguag() {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
return driver.findElement(By.cssSelector("body > header > div > div.ui-sticky-bar.js-sticky-bar > div.w-sticky-bar-list.clearfix > ul > li.catalogue.left.only-for-desktop-size > a")).getText().indexOf("产品目录") >= 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
package ru.oriflame.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=\"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[5]/div/ul[1]/li[1]/a")
|
||||
private WebElement age12;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[1]/a")
|
||||
private WebElement anti;
|
||||
|
||||
public void faceClick() {
|
||||
face.click();
|
||||
}
|
||||
|
||||
public void FilterByAdvantageAnti() {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
anti.click();
|
||||
}
|
||||
|
||||
public void filterByAge12() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
age12.click();
|
||||
}
|
||||
|
||||
public void openingFilterBy() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
openedFilterrBy.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByIndications() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filetrByIndications.click(); }
|
||||
|
||||
public void clickingFilterByAge() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByAge.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByAdvantage () {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByAdvantage.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByBrand() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByBrand.click();
|
||||
}
|
||||
|
||||
public boolean AssertFilterBy() {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean AssertByIndications() {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByBrand() {
|
||||
return driver.findElement(By.cssSelector("li.facet:nth-child(6) > div:nth-child(2) > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByAdvantage() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByAge() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("12+") >= 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean assertFilterByAdvantageAnti() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("Антивозрастной Уход") >= 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,66 +0,0 @@
|
||||
package ru.oriflame.pages;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class MainPage {
|
||||
public static WebDriver driver;
|
||||
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a")
|
||||
private WebElement face;
|
||||
|
||||
@FindBy(css = "body > header > div > div.ui-header-bar > nav > div > div.ui-logo > a > span > svg")
|
||||
private WebElement main;
|
||||
|
||||
@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:nth-child(5) > div > section > section > a:nth-child(1) > div.figure > img")
|
||||
private WebElement product;
|
||||
|
||||
public void faceClick() { face.click(); }
|
||||
|
||||
public void mainClick() { main.click(); }
|
||||
|
||||
public void registrClick() { registr.click(); }
|
||||
|
||||
public void podvalClick() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
podval.click();
|
||||
}
|
||||
|
||||
public void bannerClick() { banner.click(); }
|
||||
|
||||
public void productClick() { product.click(); }
|
||||
|
||||
public static boolean assertHeightMenu() { return driver.findElement(By.cssSelector("#main > div.w-top-area-banner.category-skincare.with-background.with-img > div.ui-banner-image > img")).isDisplayed(); }
|
||||
|
||||
public static boolean assertBanner() { return driver.findElement(By.cssSelector("#facets-search-results > section")).isDisplayed(); }
|
||||
|
||||
public static boolean assertProduct() { return driver.findElement(By.cssSelector("#pdp-image-slider > div.rsOverflow > div > div:nth-child(1) > div > img")).isDisplayed(); }
|
||||
|
||||
public static boolean assertRegister() { return driver.findElement(By.cssSelector("#main > div.w-content > div > div > p")).isDisplayed(); }
|
||||
|
||||
public static boolean assertDown() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}return driver.findElement(By.cssSelector("#main > div > div > div")).isDisplayed(); }
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package ru.oriflame.pages;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class MultiMedia {
|
||||
|
||||
public WebDriver driver;
|
||||
|
||||
public MultiMedia(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"block-block-5\"]/p/a")
|
||||
private WebElement playVideo;
|
||||
|
||||
public void playVideoElement() {
|
||||
playVideo.click();
|
||||
}
|
||||
|
||||
public boolean assertVideoPlay() {
|
||||
return driver.findElement(By.cssSelector("body > div.mfp-wrap.mfp-close-btn-in.mfp-auto-cursor.mfp-ready > div > div > div > button")).isDisplayed();
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package ru.oriflame.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 = "#global-search")
|
||||
private WebElement searchField;
|
||||
|
||||
@FindBy(css = "#form-search > fieldset > button")
|
||||
private WebElement searchButton;
|
||||
|
||||
@FindBy(css = "#main > div.w-content.ui-search-content.mode-products-search")
|
||||
private List<WebElement> 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;
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package ru.oriflame.pages;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class SortBy {
|
||||
|
||||
public WebDriver driver;
|
||||
|
||||
public SortBy(WebDriver driver) {
|
||||
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() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sortingBy.click();
|
||||
}
|
||||
|
||||
public void sortByPopularClick() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
byPopular.click();
|
||||
}
|
||||
|
||||
public boolean assertShowMenuSort() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-sort-box.fixed > ul")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertcheckLinkBySort() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("популярности") >= 0;
|
||||
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.AnotherLinks;
|
||||
|
||||
public class AnotherlinksTest {
|
||||
|
||||
private final static String APP_URL = "https://www.oriflame.ru/products/product?code=32418";
|
||||
private static Context context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFormClick() {
|
||||
context.getDriver().get(APP_URL);
|
||||
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
|
||||
anotherLinks.formClicking();
|
||||
Assert.assertTrue(anotherLinks.assertFormClick());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkContactsSCClick() {
|
||||
context.getDriver().get(APP_URL);
|
||||
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
|
||||
anotherLinks.formClicking();
|
||||
anotherLinks.clickingContactsServicesCenters();
|
||||
Assert.assertTrue(anotherLinks.assertContactsServicesCenters());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkOriflameLogoClickingFromMainPage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
|
||||
anotherLinks.clickingOrifalemLogo();
|
||||
Assert.assertTrue(anotherLinks.assertMainMenu());
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.ChangeLanguages;
|
||||
import ru.oriflame.pages.MainPage;
|
||||
|
||||
public class ChangeLanguageTest {
|
||||
|
||||
private final static String APP_URL = "https://www.oriflame.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 checkChangelanguage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.podvalClick();
|
||||
ChangeLanguages changeLanguage = PageFactory.initElements(context.getDriver(), ChangeLanguages.class);
|
||||
changeLanguage.asiaButtonClicking();
|
||||
changeLanguage.chinaLinking();
|
||||
Assert.assertTrue(changeLanguage.assertChangelanguag());
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.FilterBy;
|
||||
|
||||
public class FilterByTest {
|
||||
|
||||
private final static String APP_URL = "https://www.oriflame.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 checkOpenFilters() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.AssertFilterBy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFilterByIndications() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.clickingFilterByIndications();
|
||||
filterBy.AssertByIndications();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFilterByBrand() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.clickingFilterByBrand();
|
||||
Assert.assertTrue(filterBy.assertFilterByBrand());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFilterByAge() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.clickingFilterByAge();
|
||||
filterBy.filterByAge12();
|
||||
Assert.assertTrue(filterBy.assertFilterByAge());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFilterByAdvantage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.clickingFilterByAdvantage();
|
||||
Assert.assertTrue(filterBy.assertFilterByAdvantage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFilterByAdvantageOsv() {
|
||||
context.getDriver().get(APP_URL);
|
||||
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
|
||||
filterBy.faceClick();
|
||||
filterBy.openingFilterBy();
|
||||
filterBy.clickingFilterByAdvantage();
|
||||
filterBy.FilterByAdvantageAnti();
|
||||
Assert.assertTrue(filterBy.assertFilterByAdvantageAnti());
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.MainPage;
|
||||
|
||||
public class MainPageTest {
|
||||
|
||||
private final static String APP_URL = "https://www.oriflame.ru/products/product?code=32418";
|
||||
private static Context context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkHeightMenu() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.faceClick();
|
||||
Assert.assertTrue(MainPage.assertHeightMenu());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkProfileCap() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.registrClick();
|
||||
Assert.assertTrue(MainPage.assertRegister());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkDown() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.mainClick();
|
||||
mainPage.podvalClick();
|
||||
Assert.assertTrue(MainPage.assertDown());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkBasementLink() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.mainClick();
|
||||
mainPage.bannerClick();
|
||||
Assert.assertTrue(MainPage.assertBanner());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkProduct() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
mainPage.faceClick();
|
||||
mainPage.productClick();
|
||||
Assert.assertTrue(MainPage.assertProduct());
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.MultiMedia;
|
||||
|
||||
public class MultiMediaTest {
|
||||
|
||||
private final static String APP_URL = "http://investors.oriflame.com/";
|
||||
private static Context context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVideoPlay() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MultiMedia multiMedia = PageFactory.initElements(context.getDriver(), MultiMedia.class);
|
||||
multiMedia.playVideoElement();
|
||||
Assert.assertTrue(multiMedia.assertVideoPlay());
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.Search;
|
||||
|
||||
public class SearchingTest {
|
||||
|
||||
private final static String APP_URL = "https://oriflame.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));
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package ru.oriflame.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.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.SortBy;
|
||||
|
||||
public class SortByTest {
|
||||
|
||||
private final static String APP_URL = "https://www.oriflame.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 checkShowMenuSort() {
|
||||
context.getDriver().get(APP_URL);
|
||||
SortBy sortBy = PageFactory.initElements(context.getDriver(), SortBy.class);
|
||||
sortBy.faceClick();
|
||||
sortBy.sortByClick();
|
||||
Assert.assertTrue(sortBy.assertShowMenuSort());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkLinkBySort() {
|
||||
context.getDriver().get(APP_URL);
|
||||
SortBy sortBy = PageFactory.initElements(context.getDriver(), SortBy.class);
|
||||
sortBy.faceClick();
|
||||
sortBy.sortByClick();
|
||||
sortBy.sortByPopularClick();
|
||||
Assert.assertTrue(sortBy.assertcheckLinkBySort());
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ru.oriflame.context;
|
||||
package context;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
@ -7,7 +7,6 @@ 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) {
|
||||
@ -19,8 +18,8 @@ public abstract class Context {
|
||||
public void start() {
|
||||
System.setProperty(getDriverType(), getDriverExecutablePath());
|
||||
createDriver();
|
||||
// это плохая инструкция для автотестов, т.к. лучше задавать для конкретного элемента или кейса
|
||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||
driver.manage().window().maximize();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
@ -12,7 +12,7 @@ public class SearchPage {
|
||||
@FindBy(css = "input.header-search-input")
|
||||
private WebElement inputField;
|
||||
|
||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
||||
@FindBy(xpath = "//a[contains(@href, 'Users')]")
|
||||
private WebElement usersLink;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
|
Loading…
Reference in New Issue
Block a user