Kochkaleva #12

Closed
Ekaterina_Kochkaleva wants to merge 5 commits from Kochkaleva into master
6 changed files with 123 additions and 13 deletions
Showing only changes of commit 6039438f6e - Show all commits

View File

@ -72,4 +72,12 @@ public class Email {
public void logInButtonClick() {
logInButton.click();
}
public void logInButtonDisplayed() {
if (logInButton != null) {
} else {
throw new IllegalStateException("Element is missing, should be displayed");
}
}
}

View File

@ -18,7 +18,7 @@ public class Navigation {
@FindBy(xpath = "/html/body/div[7]/div[1]/div/div[4]/div/a[1]")
private WebElement yesCityButton;
@FindBy(xpath = "//*[@id=\"cat_cat308680401\"]/a")
@FindBy(id = "cat_cat308680401")
private WebElement saleLink;
@FindBy(xpath = "//*[@id=\"cat_cat308680401\"]/div/div/div/div/ul/li[1]/a")
@ -30,6 +30,51 @@ public class Navigation {
@FindBy(xpath = "//*[@id=\"atg_store_footer\"]/div[3]/div/ul/li[2]/div[1]/div/a[2]")
private WebElement socialElementLink;
@FindBy(xpath = "//*[@id=\"group\"]/div[1]/div[2]/div[2]/h2")
private WebElement pageName;
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/ul/li[1]")
private WebElement displayedPromo;
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/h1")
private WebElement mainTitle;
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div/div[1]/div/div[1]/a")
private WebElement womenSales;
public void womaneSalesLink() {
if (womenSales != null) {}
else {
throw new IllegalStateException("element is missing");
}
}
public void setMainTitle() {
String title = mainTitle.getAttribute("InnerText");
if (title.equals("Распродажа женской одежды O`STIN")) {
} else {
throw new IllegalStateException("something went wrong");
}
}
public void setDisplayedPromo() {
if (displayedPromo != null) {
} else {
throw new IllegalStateException("element is missing");
}
}
public void setPageName() {
String title = pageName.getAttribute("InnerText");
if (title.equals("O'STIN | ОСТИН")) {
} else {
throw new IllegalStateException("something went wrong");
}
}
private void setCurrentCity() {
if (yesCityButton != null) {
yesCityButton.click();

View File

@ -53,6 +53,17 @@ public class Sort {
@FindBy(id = "atg_store_searchInput")
private WebElement searchField;
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[3]/div/div/b[1]")
private WebElement searchingRequset;
public void setSearchingRequset() {
if (searchingRequset != null) {
} else {
throw new IllegalStateException(" this");
}
}
public static int random(int lowerBound, int upperBound) {
return (lowerBound + (int) Math.round(Math.random()
* (upperBound - lowerBound)));

View File

@ -48,7 +48,7 @@ public class EmailTests {
public void checkForLogIn() {
boolean pass = false;
email.logInLinkCLick();
// В кавычках ниже заполнить данными
//В кавычках ниже заполнить данными
email.fillFields("lkdlfr@mail.ru", "jhbhjbjbj");
email.logInButtonClick();
try {
@ -56,17 +56,23 @@ public class EmailTests {
} catch (IllegalStateException e) {
pass = true;
}
Assert.assertTrue("login link is missing,successfully log", pass);
Assert.assertTrue("login link is missing, successfully log", pass);
}
@Test
public void checkForLogOut() {
boolean pass = false;
email.logInLinkCLick();
email.fillFields("asda@dasd.asd", "12312eqs");
email.logInButtonClick();
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://ostin.com/#"));
try {
email.logInButtonDisplayed();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("test passed", pass);
}
@After

View File

@ -35,33 +35,65 @@ public class NavigationTests {
@Test
public void checkForSaleRedirect() {
boolean pass = false;
navigation.saleLinkClick();
String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://ostin.com/ru/ru/catalog/sale/?m=SaleMarker"));
/*String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://ostin.com/ru/ru/catalog/sale/?m=SaleMarker"));*/
try {
navigation.womaneSalesLink();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("test passed", pass);
}
@Test
public void checkForFemalesSaleRedirect() {
boolean pass = false;
navigation.saleFemaleLinkClick();
String url = context.getDriver().getCurrentUrl();
/*String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url
.contains("https://ostin.com/ru/ru/catalog/jenskaya_odejda/jenskaya_odejda_sale/?m=SaleMarker"));
.contains("https://ostin.com/ru/ru/catalog/jenskaya_odejda/jenskaya_odejda_sale/?m=SaleMarker"));*/
try {
navigation.setMainTitle();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("passed", pass);
}
@Test
public void checkForBasementLinkRedirect() {
boolean pass = false;
navigation.basementLinkClick();
String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://ostin.com/ru/ru/pages/promo/"));
/*String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://ostin.com/ru/ru/pages/promo/"));*/
try {
navigation.setDisplayedPromo();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("passed", pass);
}
@Test
public void checkForFollowSocialLink() {
boolean pass = false;
navigation.socialElementLinkClcik();
Set<String> tabs = context.getDriver().getWindowHandles();
context.getDriver().switchTo().window(Iterators.getLast(tabs.iterator()));
String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://vk.com/club20367999"));
/*String url = context.getDriver().getCurrentUrl();
Assert.assertTrue(url.contains("https://vk.com/club20367999"));*/
try {
navigation.setPageName();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("passed", pass);
}
@After

View File

@ -96,8 +96,16 @@ public class SortTests {
@Test
public void checkForSearch() {
boolean pass = false;
sort.searching("куртка");
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
try {
sort.setSearchingRequset();
pass = true;
} catch (IllegalStateException e) {
e.printStackTrace();
}
Assert.assertTrue("passed", pass);
}
@After