Search in sources :

Example 6 with AndroidElement

use of io.appium.java_client.android.AndroidElement in project android by owncloud.

the class ShareLinkFileTestSuite method testShareLinkFileByGmail.

@Test
@Category({ NoIgnoreTestCategory.class })
public void testShareLinkFileByGmail() throws Exception {
    AndroidElement sharedElementIndicator;
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    //TODO. if the file already exists, do not upload
    FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView);
    fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
    assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed());
    sharedElementIndicator = Actions.shareLinkElementByGmail(FILE_NAME, fileListViewAfterUploadFile, driver, common);
    assertTrue(sharedElementIndicator.isDisplayed());
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) AndroidElement(io.appium.java_client.android.AndroidElement) Category(org.junit.experimental.categories.Category) InProgressCategory(com.owncloud.android.test.ui.groups.InProgressCategory) SmokeTestCategory(com.owncloud.android.test.ui.groups.SmokeTestCategory) IgnoreTestCategory(com.owncloud.android.test.ui.groups.IgnoreTestCategory) NoIgnoreTestCategory(com.owncloud.android.test.ui.groups.NoIgnoreTestCategory) Test(org.junit.Test)

Example 7 with AndroidElement

use of io.appium.java_client.android.AndroidElement in project android by nextcloud.

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 8 with AndroidElement

use of io.appium.java_client.android.AndroidElement in project android by nextcloud.

the class Actions method scrollTillFindElement.

public static AndroidElement scrollTillFindElement(String elementName, AndroidElement element, AndroidDriver driver) {
    AndroidElement fileElement;
    if (element.getAttribute("scrollable").equals("true")) {
        HashMap<String, String> scrollObject = new HashMap<String, String>();
        scrollObject.put("text", elementName);
        scrollObject.put("element", ((RemoteWebElement) element).getId());
        driver.executeScript("mobile: scrollTo", scrollObject);
    }
    try {
        fileElement = (AndroidElement) driver.findElementByName(elementName);
    } catch (NoSuchElementException e) {
        fileElement = null;
    }
    return fileElement;
}
Also used : HashMap(java.util.HashMap) AndroidElement(io.appium.java_client.android.AndroidElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 9 with AndroidElement

use of io.appium.java_client.android.AndroidElement in project android by nextcloud.

the class ShareLinkFileTestSuite method testShareLinkFileByGmail.

@Test
@Category({ NoIgnoreTestCategory.class })
public void testShareLinkFileByGmail() throws Exception {
    AndroidElement sharedElementIndicator;
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    // TODO. if the file already exists, do not upload
    FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView);
    fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
    assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed());
    sharedElementIndicator = Actions.shareLinkElementByGmail(FILE_NAME, fileListViewAfterUploadFile, driver, common);
    assertTrue(sharedElementIndicator.isDisplayed());
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) AndroidElement(io.appium.java_client.android.AndroidElement) Category(org.junit.experimental.categories.Category) InProgressCategory(com.owncloud.android.test.ui.groups.InProgressCategory) SmokeTestCategory(com.owncloud.android.test.ui.groups.SmokeTestCategory) IgnoreTestCategory(com.owncloud.android.test.ui.groups.IgnoreTestCategory) NoIgnoreTestCategory(com.owncloud.android.test.ui.groups.NoIgnoreTestCategory) Test(org.junit.Test)

Example 10 with AndroidElement

use of io.appium.java_client.android.AndroidElement in project android by nextcloud.

the class ShareLinkFileTestSuite method testUnshareLinkFile.

@Test
@Category({ IgnoreTestCategory.class, SmokeTestCategory.class })
public void testUnshareLinkFile() throws Exception {
    AndroidElement sharedElementIndicator;
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();
    // TODO. if the file already exists, do not upload
    FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView);
    fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
    assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed());
    sharedElementIndicator = Actions.shareLinkElementByCopyLink(FILE_NAME, fileListViewAfterUploadFile, driver, common);
    assertTrue(sharedElementIndicator.isDisplayed());
    Actions.unshareLinkElement(FILE_NAME, fileListViewAfterUploadFile, driver, common);
    assertFalse(sharedElementIndicator.isDisplayed());
}
Also used : FileListView(com.owncloud.android.test.ui.models.FileListView) AndroidElement(io.appium.java_client.android.AndroidElement) Category(org.junit.experimental.categories.Category) InProgressCategory(com.owncloud.android.test.ui.groups.InProgressCategory) SmokeTestCategory(com.owncloud.android.test.ui.groups.SmokeTestCategory) IgnoreTestCategory(com.owncloud.android.test.ui.groups.IgnoreTestCategory) NoIgnoreTestCategory(com.owncloud.android.test.ui.groups.NoIgnoreTestCategory) Test(org.junit.Test)

Aggregations

AndroidElement (io.appium.java_client.android.AndroidElement)19 NoSuchElementException (org.openqa.selenium.NoSuchElementException)10 Test (org.junit.Test)8 IgnoreTestCategory (com.owncloud.android.test.ui.groups.IgnoreTestCategory)6 InProgressCategory (com.owncloud.android.test.ui.groups.InProgressCategory)6 NoIgnoreTestCategory (com.owncloud.android.test.ui.groups.NoIgnoreTestCategory)6 SmokeTestCategory (com.owncloud.android.test.ui.groups.SmokeTestCategory)6 ElementMenuOptions (com.owncloud.android.test.ui.models.ElementMenuOptions)6 FileListView (com.owncloud.android.test.ui.models.FileListView)6 Category (org.junit.experimental.categories.Category)6 ShareView (com.owncloud.android.test.ui.models.ShareView)4 WaitAMomentPopUp (com.owncloud.android.test.ui.models.WaitAMomentPopUp)4 GmailSendMailView (com.owncloud.android.test.ui.models.GmailSendMailView)2 RemoveConfirmationView (com.owncloud.android.test.ui.models.RemoveConfirmationView)2 HashMap (java.util.HashMap)2 RemoteDevice (com.qaprosoft.carina.commons.models.RemoteDevice)1 Device (com.qaprosoft.carina.core.foundation.webdriver.device.Device)1 MobileElement (io.appium.java_client.MobileElement)1 Activity (io.appium.java_client.android.Activity)1 StartsActivity (io.appium.java_client.android.StartsActivity)1