Search in sources :

Example 1 with CertificatePopUp

use of com.owncloud.android.test.ui.models.CertificatePopUp in project android by owncloud.

the class Actions method login.

public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException {
    LoginForm loginForm = new LoginForm(driver);
    CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
    if (!isTrusted) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        //and it doesn't appear again
        try {
            wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
            //we need to repaint the screen 
            //because of some element are misplaced
            driver.rotate(ScreenOrientation.LANDSCAPE);
            driver.rotate(ScreenOrientation.PORTRAIT);
            certificatePopUp.clickOnOkButton();
        } catch (NoSuchElementException e) {
        }
    }
    loginForm.typeUserName(user);
    loginForm.typePassword(password);
    //TODO. Assert related to check the connection?
    return loginForm.clickOnConnectButton();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) CertificatePopUp(com.owncloud.android.test.ui.models.CertificatePopUp) LoginForm(com.owncloud.android.test.ui.models.LoginForm) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Aggregations

CertificatePopUp (com.owncloud.android.test.ui.models.CertificatePopUp)1 LoginForm (com.owncloud.android.test.ui.models.LoginForm)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)1