Search in sources :

Example 21 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method deleteElement.

public static AndroidElement deleteElement(String elementName, FileListView fileListView, AndroidDriver driver) throws Exception {
    AndroidElement fileElement;
    WaitAMomentPopUp waitAMomentPopUp;
    try {
        //To open directly the "file list view" and
        //we don't need to know in which view we are
        driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
        fileElement = (AndroidElement) driver.findElementByName(elementName);
        ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName);
        RemoveConfirmationView removeConfirmationView = menuOptions.clickOnRemove();
        ;
        waitAMomentPopUp = removeConfirmationView.clickOnRemoteAndLocalButton();
        Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
    } catch (NoSuchElementException e) {
        fileElement = null;
    }
    return fileElement;
}
Also used : RemoveConfirmationView(com.owncloud.android.test.ui.models.RemoveConfirmationView) ElementMenuOptions(com.owncloud.android.test.ui.models.ElementMenuOptions) AndroidElement(io.appium.java_client.android.AndroidElement) WaitAMomentPopUp(com.owncloud.android.test.ui.models.WaitAMomentPopUp) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 22 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method shareLinkElementByCopyLink.

public static AndroidElement shareLinkElementByCopyLink(String elementName, FileListView fileListView, AndroidDriver driver, Common common) throws Exception {
    try {
        //To open directly the "file list view" and
        //we don't need to know in which view we are
        driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
        ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName);
        ShareView shareView = menuOptions.clickOnShareLinkElement();
        Actions.scrollTillFindElement("Copy link", shareView.getListViewLayout(), driver).click();
        WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
        Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
        common.wait.until(ExpectedConditions.visibilityOf(fileListView.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator()))));
    } catch (NoSuchElementException e) {
        return null;
    }
    return (AndroidElement) fileListView.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator()));
}
Also used : ShareView(com.owncloud.android.test.ui.models.ShareView) ElementMenuOptions(com.owncloud.android.test.ui.models.ElementMenuOptions) AndroidElement(io.appium.java_client.android.AndroidElement) WaitAMomentPopUp(com.owncloud.android.test.ui.models.WaitAMomentPopUp) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 23 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class Actions method unshareLinkElement.

public static void unshareLinkElement(String elementName, FileListView fileListView, AndroidDriver driver, Common common) throws Exception {
    try {
        //To open directly the "file list view" and
        //we don't need to know in which view we are
        driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
        ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName);
        WaitAMomentPopUp waitAMomentPopUp = menuOptions.clickOnUnshareLinkElement();
        Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
        Common.waitTillElementIsNotPresent((AndroidElement) fileListView.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator())), 100);
    } catch (NoSuchElementException e) {
    }
}
Also used : ElementMenuOptions(com.owncloud.android.test.ui.models.ElementMenuOptions) WaitAMomentPopUp(com.owncloud.android.test.ui.models.WaitAMomentPopUp) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 24 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class UploadTestSuite method testUploadFromGmail.

@Test
@Category(UnfinishedTestCategory.class)
public void testUploadFromGmail() throws Exception {
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    driver.startActivity("com.google.android.gm", ".ConversationListActivityGmail");
    GmailEmailListView gmailEmailListView = new GmailEmailListView(driver);
    Thread.sleep(3000);
    GmailEmailView gmailEmailView = gmailEmailListView.clickOnEmail();
    ImageView imageView = gmailEmailView.clickOnfileButton();
    imageView.clickOnOptionsButton();
    imageView.clickOnShareButton();
    imageView.clickOnOwnCloudButton();
    //justonce button do not appear always
    try {
        imageView.clickOnJustOnceButton();
    } catch (NoSuchElementException e) {
    }
    UploadView uploadView = new UploadView(driver);
    uploadView.clickOUploadButton();
    driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME);
    driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
    common.wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME)));
    assertEquals(Config.fileToTestSendByEmailName, driver.findElementByName(FILE_GMAIL_NAME).getText());
    fileListView = new FileListView(driver);
    fileListView.scrollTillFindElement(FILE_GMAIL_NAME);
    assertTrue(fileHasBeenUploadedFromGmail = fileListView.getFileElement().isDisplayed());
//TODO. correct assert if fileListView is shown in grid mode
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) UploadView(com.owncloud.android.test.ui.models.UploadView) GmailEmailView(com.owncloud.android.test.ui.models.GmailEmailView) GmailEmailListView(com.owncloud.android.test.ui.models.GmailEmailListView) ImageView(com.owncloud.android.test.ui.models.ImageView) NoSuchElementException(org.openqa.selenium.NoSuchElementException) InProgressCategory(com.owncloud.android.test.ui.groups.InProgressCategory) SmokeTestCategory(com.owncloud.android.test.ui.groups.SmokeTestCategory) UnfinishedTestCategory(com.owncloud.android.test.ui.groups.UnfinishedTestCategory) FailingTestCategory(com.owncloud.android.test.ui.groups.FailingTestCategory) Category(org.junit.experimental.categories.Category) NoIgnoreTestCategory(com.owncloud.android.test.ui.groups.NoIgnoreTestCategory) Test(org.junit.Test)

Example 25 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project android by owncloud.

the class UploadTestSuite method testUploadBigFile.

@Test
@Category({ UnfinishedTestCategory.class })
public void testUploadBigFile() throws Exception {
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    //check if the file already exists and if true, delete it
    Actions.deleteElement(BIG_FILE_NAME, fileListView, driver);
    FileListView fileListViewAfterUploadFile = Actions.uploadFile(BIG_FILE_NAME, fileListView);
    driver.openNotifications();
    NotificationView notificationView = new NotificationView(driver);
    try {
        if (notificationView.getUploadingNotification().isDisplayed()) {
            Common.waitTillElementIsPresent(notificationView.getUploadSucceededNotification(), 300000);
            driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME);
            driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
        }
    } catch (NoSuchElementException e) {
        driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME);
        driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity");
    }
    fileListViewAfterUploadFile.scrollTillFindElement(BIG_FILE_NAME);
    assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
    Common.waitTillElementIsNotPresentWithoutTimeout(fileListViewAfterUploadFile.getProgressCircular(), 1000);
    common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator()))));
    assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())).isDisplayed());
    fileListView = new FileListView(driver);
    fileListView.scrollTillFindElement(BIG_FILE_NAME);
    assertTrue(fileHasBeenUploaded = fileListView.getFileElement().isDisplayed());
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) NotificationView(com.owncloud.android.test.ui.models.NotificationView) NoSuchElementException(org.openqa.selenium.NoSuchElementException) InProgressCategory(com.owncloud.android.test.ui.groups.InProgressCategory) SmokeTestCategory(com.owncloud.android.test.ui.groups.SmokeTestCategory) UnfinishedTestCategory(com.owncloud.android.test.ui.groups.UnfinishedTestCategory) FailingTestCategory(com.owncloud.android.test.ui.groups.FailingTestCategory) Category(org.junit.experimental.categories.Category) NoIgnoreTestCategory(com.owncloud.android.test.ui.groups.NoIgnoreTestCategory) Test(org.junit.Test)

Aggregations

NoSuchElementException (org.openqa.selenium.NoSuchElementException)32 WebElement (org.openqa.selenium.WebElement)18 AndroidElement (io.appium.java_client.android.AndroidElement)5 Select (org.openqa.selenium.support.ui.Select)5 ElementMenuOptions (com.owncloud.android.test.ui.models.ElementMenuOptions)4 WaitAMomentPopUp (com.owncloud.android.test.ui.models.WaitAMomentPopUp)3 Test (org.junit.Test)3 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)2 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)2 FailingTestCategory (com.owncloud.android.test.ui.groups.FailingTestCategory)2 InProgressCategory (com.owncloud.android.test.ui.groups.InProgressCategory)2 NoIgnoreTestCategory (com.owncloud.android.test.ui.groups.NoIgnoreTestCategory)2 SmokeTestCategory (com.owncloud.android.test.ui.groups.SmokeTestCategory)2 UnfinishedTestCategory (com.owncloud.android.test.ui.groups.UnfinishedTestCategory)2 FileListView (com.owncloud.android.test.ui.models.FileListView)2 ShareView (com.owncloud.android.test.ui.models.ShareView)2 VisualEditorPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.visualeditor.VisualEditorPageObject)2 Category (org.junit.experimental.categories.Category)2