Search in sources :

Example 1 with LoginForm

use of com.owncloud.android.test.ui.models.LoginForm 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)

Example 2 with LoginForm

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

the class LoginTestSuite method test5ChangePasswordWrong.

@Test
@Category({ NoIgnoreTestCategory.class })
public void test5ChangePasswordWrong() throws Exception {
    driver.rotate(ScreenOrientation.PORTRAIT);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();
    settingsView.tapOnAccountElement(1, 1, 1000);
    LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement();
    changePasswordForm.typePassword("WrongPassword");
    changePasswordForm.clickOnConnectButton();
    assertTrue(common.waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText()));
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) MenuList(com.owncloud.android.test.ui.models.MenuList) LoginForm(com.owncloud.android.test.ui.models.LoginForm) SettingsView(com.owncloud.android.test.ui.models.SettingsView) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 3 with LoginForm

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

the class LoginTestSuite method test4ExistingAccountRotate.

@Test
@Category({ NoIgnoreTestCategory.class })
public void test4ExistingAccountRotate() throws Exception {
    driver.rotate(ScreenOrientation.PORTRAIT);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    driver.rotate(ScreenOrientation.LANDSCAPE);
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();
    settingsView.tapOnAddAccount(1, 1000);
    LoginForm loginForm = new LoginForm(driver);
    fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    assertTrue(common.waitForTextPresent("An account for the same user and" + " server already exists in the device", loginForm.getAuthStatusText()));
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) MenuList(com.owncloud.android.test.ui.models.MenuList) LoginForm(com.owncloud.android.test.ui.models.LoginForm) SettingsView(com.owncloud.android.test.ui.models.SettingsView) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 4 with LoginForm

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

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)

Example 5 with LoginForm

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

the class LoginTestSuite method test5ChangePasswordWrong.

@Test
@Category({ NoIgnoreTestCategory.class })
public void test5ChangePasswordWrong() throws Exception {
    driver.rotate(ScreenOrientation.PORTRAIT);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();
    settingsView.tapOnAccountElement(1, 1, 1000);
    LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement();
    changePasswordForm.typePassword("WrongPassword");
    changePasswordForm.clickOnConnectButton();
    assertTrue(common.waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText()));
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) MenuList(com.owncloud.android.test.ui.models.MenuList) LoginForm(com.owncloud.android.test.ui.models.LoginForm) SettingsView(com.owncloud.android.test.ui.models.SettingsView) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Aggregations

LoginForm (com.owncloud.android.test.ui.models.LoginForm)8 FileListView (com.owncloud.android.test.ui.models.FileListView)6 MenuList (com.owncloud.android.test.ui.models.MenuList)6 SettingsView (com.owncloud.android.test.ui.models.SettingsView)6 Test (org.junit.Test)6 Category (org.junit.experimental.categories.Category)6 NoIgnoreTestCategory (com.owncloud.android.test.ui.groups.NoIgnoreTestCategory)2 SmokeTestCategory (com.owncloud.android.test.ui.groups.SmokeTestCategory)2 CertificatePopUp (com.owncloud.android.test.ui.models.CertificatePopUp)2 NoSuchElementException (org.openqa.selenium.NoSuchElementException)2 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)2