Stroeva #7
94
Stroeva/src/test/java/AccountTests.java
Normal file
94
Stroeva/src/test/java/AccountTests.java
Normal file
@ -0,0 +1,94 @@
|
||||
import context.ChromeContext;
|
||||
import context.Context;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.*;
|
||||
|
||||
public class AccountTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials_2017/5812-mertv-na-99.html";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignIn() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
Assertions.assertTrue(page.isUserPresent());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignInVK() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.clickSignIn();
|
||||
page.clickVkButton();
|
||||
VKPage pageVk = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
String str = context.getDriver().getWindowHandle();
|
||||
pageVk.switchToSocial();
|
||||
Assertions.assertTrue(pageVk.isUserPresent());
|
||||
pageVk.closeSocial();
|
||||
pageVk.switchToOld(str);
|
||||
Thread.sleep(1000);
|
||||
page.clickToCloseFormButton();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEditAcc() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clearEmail();
|
||||
pageAn.editEmail("Test2018t@mail.ru");
|
||||
pageAn.clickToButtonSave();
|
||||
Assertions.assertTrue(pageAn.checkEmail("Test2018t@mail.ru"));
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFavoritePage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clickToFavorite();
|
||||
Assertions.assertTrue(pageAn.isFavoritePage());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFuturePage() {
|
||||
context.getDriver().get(APP_URL);
|
||||
LoginPage page = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
page.login();
|
||||
page.clickAccUser();
|
||||
AccUserPage pageAn = PageFactory.initElements(context.getDriver(), AccUserPage.class);
|
||||
pageAn.clickToFuture();
|
||||
Assertions.assertTrue(pageAn.isFavoritePage());
|
||||
page.clickAccUser();
|
||||
page.clickExitAccUser();
|
||||
}
|
||||
}
|
61
Stroeva/src/test/java/FilterTests.java
Normal file
61
Stroeva/src/test/java/FilterTests.java
Normal file
@ -0,0 +1,61 @@
|
||||
import context.ChromeContext;
|
||||
import context.Context;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.*;
|
||||
|
||||
public class FilterTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials/";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearch() {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickSearchButton();
|
||||
page.insertSearchText("Древние");
|
||||
page.insertEnterSearchText();
|
||||
SearchPage pageAn = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountryList() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickCountry();
|
||||
Thread.sleep(2000);
|
||||
page.clickSerial();
|
||||
ExSerialPage pageAn = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
Assertions.assertTrue(pageAn.isCountryPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenreList() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
SerialPage page = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
page.clickGenre();
|
||||
Thread.sleep(2000);
|
||||
page.clickSerial();
|
||||
ExSerialPage pageAn = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
Assertions.assertTrue(pageAn.isGenrePresent());
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ public class NavigationTests {
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
//context.close();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -47,7 +47,7 @@ public class NavigationTests {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickRating();
|
||||
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class NavigationTests {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickYear();
|
||||
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class NavigationTests {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickCountry();
|
||||
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class NavigationTests {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickGenre();
|
||||
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class NavigationTests {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.clickMenu();
|
||||
FilterPage pageAn = PageFactory.initElements(context.getDriver(), FilterPage.class);
|
||||
NavFilterPage pageAn = PageFactory.initElements(context.getDriver(), NavFilterPage.class);
|
||||
Assertions.assertTrue(pageAn.isUserPresent());
|
||||
}
|
||||
}
|
||||
|
95
Stroeva/src/test/java/VideoTests.java
Normal file
95
Stroeva/src/test/java/VideoTests.java
Normal file
@ -0,0 +1,95 @@
|
||||
import context.ChromeContext;
|
||||
import context.Context;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.Dimension;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import page.ExSerialPage;
|
||||
import page.LoginPage;
|
||||
import page.SearchPage;
|
||||
import page.SerialPage;
|
||||
|
||||
public class VideoTests {
|
||||
private final static String APP_URL = "http://amovies.cc/serials_2017/5812-mertv-na-99.html";
|
||||
|
||||
private static Context context;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().setSize(new Dimension(1366, 768));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenFilter() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
String str = page.getGenre();
|
||||
page.clickGenre();
|
||||
SerialPage pageAn = PageFactory.initElements(context.getDriver(), SerialPage.class);
|
||||
pageAn.clickSerial();
|
||||
Assertions.assertTrue(page.checkGenre(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToFavorite() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickToFavorite();
|
||||
Assertions.assertTrue(page.isFavoritePresent());
|
||||
page.clickToFavorite();
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToFuture() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickToFuture();
|
||||
Assertions.assertTrue(page.isFuturePresent());
|
||||
page.clickToFuture();
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRating() {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
int count = page.getRatingUpNum();
|
||||
page.clickRating();
|
||||
Assertions.assertTrue(page.getRatingUpNum() >= count );
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComment() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);
|
||||
ExSerialPage page = PageFactory.initElements(context.getDriver(), ExSerialPage.class);
|
||||
LoginPage loginPage = PageFactory.initElements(context.getDriver(), LoginPage.class);
|
||||
loginPage.login();
|
||||
page.clickCommentButton();
|
||||
page.commentWrite("Отличный фильм!");
|
||||
page.clickCommentAdd();
|
||||
Thread.sleep(2000);
|
||||
Assertions.assertTrue(page.isCommentPresent());
|
||||
loginPage.clickAccUser();
|
||||
loginPage.clickExitAccUser();
|
||||
}
|
||||
}
|
57
Stroeva/src/test/java/page/AccUserPage.java
Normal file
57
Stroeva/src/test/java/page/AccUserPage.java
Normal file
@ -0,0 +1,57 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class AccUserPage {
|
||||
WebDriver driver;
|
||||
@FindBy(xpath = "//*[@id=\"userinfo\"]/div[2]/div[4]/div/div[1]/span[2]/input")
|
||||
private WebElement email;
|
||||
|
||||
@FindBy(css = ".submit-user")
|
||||
private WebElement buttonSave;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/like/']")
|
||||
private WebElement favoritButton;
|
||||
|
||||
@FindBy(css = ".short-film")
|
||||
private WebElement favoritElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/tosee/']")
|
||||
private WebElement futureButton;
|
||||
|
||||
public AccUserPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void editEmail(String str) {
|
||||
email.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickToButtonSave() {
|
||||
buttonSave.click();
|
||||
}
|
||||
|
||||
public void clickToFavorite() {
|
||||
favoritButton.click();
|
||||
}
|
||||
|
||||
public void clickToFuture() {
|
||||
futureButton.click();
|
||||
}
|
||||
|
||||
public boolean checkEmail(String str){
|
||||
if(email.getAttribute("value").equals(str))
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public void clearEmail() {
|
||||
email.clear();
|
||||
}
|
||||
|
||||
public boolean isFavoritePage() {
|
||||
return favoritElement.isDisplayed();
|
||||
}
|
||||
}
|
122
Stroeva/src/test/java/page/ExSerialPage.java
Normal file
122
Stroeva/src/test/java/page/ExSerialPage.java
Normal file
@ -0,0 +1,122 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExSerialPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/russia/']")
|
||||
private WebElement countrySerialElement;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/boeviki_2018/']")
|
||||
private WebElement genreSerialElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"dle-content\"]/article/span/div[1]/div[1]/div[4]/div/div[1]/div[2]/a[1]")
|
||||
private WebElement genreAnySerialElement;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"dle-content\"]/article/span/div[1]/div[1]/div[4]/div/div[1]/div[2]")
|
||||
private List<WebElement> genreListElement;
|
||||
|
||||
@FindBy(id = "film-favorite")
|
||||
private WebElement toFavorites;
|
||||
|
||||
@FindBy(id = "film-future")
|
||||
private WebElement toFuture;
|
||||
|
||||
@FindBy(css = "#film-favorite.in")
|
||||
private WebElement toFavoritesIn;
|
||||
|
||||
@FindBy(css = "#film-future.in")
|
||||
private WebElement toFutureIn;
|
||||
|
||||
@FindBy(id = "rating-btn")
|
||||
private WebElement rating;
|
||||
|
||||
@FindBy(id = "rating-up")
|
||||
private WebElement ratingUp;
|
||||
|
||||
@FindBy(css = ".write-comm")
|
||||
private WebElement commentButton;
|
||||
|
||||
@FindBy(id = "comments")
|
||||
private WebElement commentWrite;
|
||||
|
||||
@FindBy(css = ".fbutton")
|
||||
private WebElement commentAdd;
|
||||
|
||||
@FindBy(xpath = "//a[@href='http://amovies.cc/user/test2018/']")
|
||||
private WebElement checkComment;
|
||||
|
||||
public ExSerialPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickGenre() {
|
||||
genreAnySerialElement.click();
|
||||
}
|
||||
|
||||
public String getGenre() {
|
||||
return genreAnySerialElement.getText();
|
||||
}
|
||||
|
||||
public boolean checkGenre(String genre) {
|
||||
for (WebElement el:
|
||||
genreListElement) {
|
||||
if(el.getText().contains(genre))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clickToFavorite() {
|
||||
toFavorites.click();
|
||||
}
|
||||
|
||||
public void clickToFuture() {
|
||||
toFuture.click();
|
||||
}
|
||||
|
||||
public void clickRating() {
|
||||
rating.click();
|
||||
}
|
||||
|
||||
public int getRatingUpNum() {
|
||||
return Integer.parseInt(ratingUp.getText());
|
||||
}
|
||||
|
||||
public void clickCommentButton() {
|
||||
commentButton.click();
|
||||
}
|
||||
|
||||
public void commentWrite(String str) {
|
||||
commentWrite.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickCommentAdd() {
|
||||
commentAdd.click();
|
||||
}
|
||||
|
||||
public boolean isCountryPresent() {
|
||||
return countrySerialElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isGenrePresent() {
|
||||
return genreSerialElement.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isFavoritePresent() {
|
||||
return toFavoritesIn.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isFuturePresent() {
|
||||
return toFutureIn.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean isCommentPresent() {
|
||||
return checkComment.isDisplayed();
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import org.openqa.selenium.support.FindBy;
|
||||
public class HolderPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".holder")
|
||||
@FindBy(css = ".box-text")
|
||||
private WebElement holderElement;
|
||||
|
||||
public HolderPage(WebDriver driver) {
|
||||
|
82
Stroeva/src/test/java/page/LoginPage.java
Normal file
82
Stroeva/src/test/java/page/LoginPage.java
Normal file
@ -0,0 +1,82 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LoginPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".login")
|
||||
private WebElement signIn;
|
||||
|
||||
@FindBy(id = "login_name")
|
||||
private WebElement login;
|
||||
|
||||
@FindBy(id = "login_password")
|
||||
private WebElement pass;
|
||||
|
||||
@FindBy(css = ".login-button")
|
||||
private WebElement buttonLogin;
|
||||
|
||||
@FindBy(css = ".user")
|
||||
private WebElement user;
|
||||
|
||||
@FindBy(css = ".ulogin-button-vkontakte")
|
||||
private WebElement vkButton;
|
||||
|
||||
@FindBy(xpath = "//a[@href='/index.php?action=logout']")
|
||||
private WebElement exitButton;
|
||||
|
||||
@FindBy(css = ".fa.fa-times.overlay-close")
|
||||
private WebElement closeFormButton;
|
||||
|
||||
public LoginPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickSignIn() {
|
||||
signIn.click();
|
||||
}
|
||||
|
||||
public void insertLogin(String str) {
|
||||
login.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertPass(String str) {
|
||||
pass.sendKeys(str);
|
||||
}
|
||||
|
||||
public void clickToButtonLogin() {
|
||||
buttonLogin.click();
|
||||
}
|
||||
|
||||
public void login(){
|
||||
clickSignIn();
|
||||
insertLogin("test2018");
|
||||
insertPass("q1w2e3r4t5");
|
||||
clickToButtonLogin();
|
||||
}
|
||||
|
||||
public void clickAccUser() {
|
||||
user.click();
|
||||
}
|
||||
|
||||
public void clickExitAccUser() {
|
||||
exitButton.click();
|
||||
}
|
||||
|
||||
public void clickToCloseFormButton() {
|
||||
closeFormButton.click();
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return user.isDisplayed();
|
||||
}
|
||||
|
||||
public void clickVkButton() {
|
||||
vkButton.click();
|
||||
}
|
||||
}
|
@ -4,13 +4,13 @@ import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class FilterPage {
|
||||
public class NavFilterPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "dle-content")
|
||||
private WebElement ratingElement;
|
||||
|
||||
public FilterPage(WebDriver driver) {
|
||||
public NavFilterPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
20
Stroeva/src/test/java/page/SearchPage.java
Normal file
20
Stroeva/src/test/java/page/SearchPage.java
Normal file
@ -0,0 +1,20 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class SearchPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(css = ".res-search")
|
||||
private WebElement searchElement;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return searchElement.isDisplayed();
|
||||
}
|
||||
}
|
61
Stroeva/src/test/java/page/SerialPage.java
Normal file
61
Stroeva/src/test/java/page/SerialPage.java
Normal file
@ -0,0 +1,61 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SerialPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "show-search")
|
||||
private WebElement searchButton;
|
||||
|
||||
@FindBy(id = "story")
|
||||
private WebElement searchText;
|
||||
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[3]/div[1]/div[2]/div/div/div[2]/button[2]")
|
||||
private WebElement countryList;
|
||||
|
||||
@FindBy(css = "#dle-content .short-film")
|
||||
private WebElement serialElement;
|
||||
|
||||
@FindBy(xpath = "/html/body/div[1]/div[2]/div[3]/div[2]/div[2]/div/div/div[2]/button[3]")
|
||||
private WebElement genreList;
|
||||
|
||||
public SerialPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public void clickSearchButton() {
|
||||
searchButton.click();
|
||||
}
|
||||
|
||||
public void insertSearchText(String str) {
|
||||
searchText.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertEnterSearchText() {
|
||||
searchText.sendKeys(Keys.ENTER);
|
||||
}
|
||||
|
||||
public void clickCountry() {
|
||||
countryList.click();
|
||||
}
|
||||
|
||||
public void clickSerial() {
|
||||
serialElement.click();
|
||||
}
|
||||
|
||||
public void clickGenre() {
|
||||
genreList.click();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public boolean isUserPresent() {
|
||||
// return holderElement.isDisplayed();
|
||||
// }
|
||||
}
|
34
Stroeva/src/test/java/page/VKPage.java
Normal file
34
Stroeva/src/test/java/page/VKPage.java
Normal file
@ -0,0 +1,34 @@
|
||||
package page;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class VKPage {
|
||||
WebDriver driver;
|
||||
|
||||
@FindBy(id = "login_submit")
|
||||
private WebElement element;
|
||||
|
||||
public VKPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isUserPresent() {
|
||||
return element.isDisplayed();
|
||||
}
|
||||
|
||||
public void switchToSocial(){
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public void switchToOld(String str){
|
||||
driver.switchTo().window(str);
|
||||
}
|
||||
|
||||
public void closeSocial(){
|
||||
driver.close();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user