Skalkin #6
@ -5,6 +5,7 @@ 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.Keys;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
@ -34,27 +35,37 @@ public class AutorizationTests {
|
||||
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню
|
||||
page.clickButtonLogin();
|
||||
page.switchToCalcFrame();
|
||||
page.isButtonVK();
|
||||
//Thread.sleep(20000);
|
||||
|
||||
//page.clickButtonVK();
|
||||
|
||||
Thread.sleep(5000);
|
||||
//page.isButtonVK();
|
||||
//Thread.sleep(20000);
|
||||
page.frameLogin();
|
||||
|
||||
|
||||
page.clickButtonVK();
|
||||
page.frameDefault();
|
||||
page.switchToSocial();
|
||||
|
||||
VKPage pageTo = PageFactory.initElements(context.getDriver(), VKPage.class);
|
||||
Assertions.assertTrue(pageTo.isUserPresent());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginEmail(){
|
||||
public void testLoginEmail() throws InterruptedException {
|
||||
context.getDriver().get(APP_URL);//Открыта страница фильма
|
||||
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);//Выбрать пункт меню
|
||||
page.clickButtonLogin();
|
||||
page.isButtonVK();
|
||||
|
||||
page.clickButtonVK();
|
||||
Thread.sleep(5000);
|
||||
page.frameLogin();
|
||||
page.insertEmail("sefyijupsi@tutye.com");
|
||||
page.insertPassword("q1w2e3r4t5y6");
|
||||
Thread.sleep(1000);
|
||||
page.insertSignInEnter();
|
||||
page.frameDefault();
|
||||
|
||||
Assertions.assertTrue(page.isAutorization());
|
||||
|
||||
}
|
||||
}
|
@ -41,9 +41,21 @@ public class MainPage {
|
||||
@FindBy(css = ".social-auth__item.social-auth__item_code_vk")
|
||||
private WebElement buttonVK;
|
||||
|
||||
@FindBy(css = ".header-fresh-user-partial-component__button.header-fresh-user-partial-component__button_selected")
|
||||
@FindBy(css = ".header-fresh-user-partial-component__avatar")
|
||||
private WebElement elementAvatar;
|
||||
|
||||
@FindBy(name = "login")
|
||||
private WebElement elementEmail;
|
||||
|
||||
@FindBy(name = "password")
|
||||
private WebElement elementPassword;
|
||||
|
||||
@FindBy(css = ".link.link_secondary.auth__signup-link")
|
||||
private WebElement elementRegister;
|
||||
|
||||
@FindBy(css = ".kp2-authapi-iframe")
|
||||
private WebElement signInFrame;
|
||||
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
//this.driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
|
||||
@ -54,9 +66,6 @@ public class MainPage {
|
||||
builder.moveToElement(mainElement).perform();
|
||||
|
||||
menuElement.sendKeys(Keys.RETURN);
|
||||
|
||||
|
||||
//menuElement.click();
|
||||
}
|
||||
|
||||
public void clickLogo() {
|
||||
@ -87,29 +96,51 @@ public class MainPage {
|
||||
buttonVK.click();
|
||||
}
|
||||
|
||||
public void insertEmail(String str) {
|
||||
elementEmail.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertPassword(String str) {
|
||||
elementPassword.sendKeys(str);
|
||||
}
|
||||
|
||||
public void insertSignInEnter() {
|
||||
elementPassword.sendKeys(Keys.ENTER);
|
||||
}
|
||||
|
||||
public void isButtonVK() {
|
||||
// WebElement dynamicElement = (new WebDriverWait(driver, 30))
|
||||
// WebElement dynamicElement = (new WebDriverWait(driver, 30))
|
||||
// .until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("kp2-authapi-iframe"));
|
||||
// .until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".social-auth__item.social-auth__item_code_vk")));
|
||||
// dynamicElement.click();
|
||||
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
(new WebDriverWait(driver, 10))
|
||||
.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("kp2-authapi-iframe"));
|
||||
|
||||
driver.findElement(By.cssSelector(".social-auth__item_code_vk")).click();
|
||||
//dynamicElement.click();
|
||||
//driver.switchTo().frame(driver.findElement(By.cssSelector(".kp2-authapi-iframe")));
|
||||
|
||||
driver.switchTo().frame(signInFrame);
|
||||
|
||||
//driver.findElement(By.cssSelector(".social-auth__item_code_vk")).click();
|
||||
buttonVK.click();
|
||||
driver.switchTo().defaultContent();
|
||||
}
|
||||
|
||||
@FindBy(css = ".kp2-authapi-iframe")
|
||||
private WebElement signInFrame;
|
||||
public void frameDefault(){
|
||||
driver.switchTo().defaultContent();
|
||||
}
|
||||
|
||||
|
||||
public void switchToCalcFrame(){
|
||||
|
||||
|
||||
public void frameLogin(){
|
||||
driver.switchTo().frame(signInFrame);
|
||||
driver.switchTo().frame(null);
|
||||
}
|
||||
|
||||
public void switchToSocial(){
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user