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;
}
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()));
}
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) {
}
}
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
}
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());
}
Aggregations