use of io.appium.java_client.android.AndroidElement in project android by nextcloud.
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;
}
use of io.appium.java_client.android.AndroidElement in project android by nextcloud.
the class Actions method shareLinkElementByGmail.
public static AndroidElement shareLinkElementByGmail(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("Gmail", shareView.getListViewLayout(), driver).click();
GmailSendMailView gmailSendMailView = new GmailSendMailView(driver);
gmailSendMailView.typeToEmailAdress(Config.gmailAccount);
gmailSendMailView.clickOnSendButton();
Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 1000);
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()));
}
use of io.appium.java_client.android.AndroidElement in project android by nextcloud.
the class Common method assertIsNotInFileListView.
protected void assertIsNotInFileListView() throws InterruptedException {
AndroidElement fileElement;
assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector()" + ".resourceId(\"android:id/action_bar_title\")")));
try {
fileElement = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector()" + ".description(\"Upload\")");
} catch (NoSuchElementException e) {
fileElement = null;
}
assertNull(fileElement);
}
use of io.appium.java_client.android.AndroidElement in project android by nextcloud.
the class ShareLinkFileTestSuite method testShareLinkFileByCopyLink.
@Test
@Category({ NoIgnoreTestCategory.class, SmokeTestCategory.class })
public void testShareLinkFileByCopyLink() 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());
}
Aggregations