add headers. reformat files

This commit is contained in:
purigarcia 2015-05-15 12:32:16 +02:00
parent c775fa0691
commit 8386357e68
44 changed files with 1228 additions and 166 deletions

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.actions; package com.owncloud.android.test.ui.actions;
import java.util.HashMap; import java.util.HashMap;
@ -26,15 +46,20 @@ import com.owncloud.android.test.ui.testSuites.Common;
public class Actions { public class Actions {
public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException { public static FileListView login(String url, String user, String password,
Boolean isTrusted, AndroidDriver driver)
throws InterruptedException {
LoginForm loginForm = new LoginForm(driver); LoginForm loginForm = new LoginForm(driver);
CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url); CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
if(!isTrusted){ if(!isTrusted){
WebDriverWait wait = new WebDriverWait(driver, 30); WebDriverWait wait = new WebDriverWait(driver, 30);
//sometimes the certificate has been already accept and it doesn't appear again //sometimes the certificate has been already accept
//and it doesn't appear again
try { try {
wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement())); wait.until(ExpectedConditions
//we need to repaint the screen because of some element are misplaced .visibilityOf(certificatePopUp.getOkButtonElement()));
//we need to repaint the screen
//because of some element are misplaced
driver.rotate(ScreenOrientation.LANDSCAPE); driver.rotate(ScreenOrientation.LANDSCAPE);
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
certificatePopUp.clickOnOkButton(); certificatePopUp.clickOnOkButton();
@ -49,26 +74,30 @@ public class Actions {
return loginForm.clickOnConnectButton(); return loginForm.clickOnConnectButton();
} }
public static WaitAMomentPopUp createFolder(String folderName, FileListView fileListView){ public static WaitAMomentPopUp createFolder(String folderName,
FileListView fileListView){
NewFolderPopUp newFolderPopUp = fileListView.clickOnNewFolderButton(); NewFolderPopUp newFolderPopUp = fileListView.clickOnNewFolderButton();
newFolderPopUp.typeNewFolderName(folderName); newFolderPopUp.typeNewFolderName(folderName);
WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton(); WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp
.clickOnNewFolderOkButton();
//TODO. assert here //TODO. assert here
return waitAMomentPopUp; return waitAMomentPopUp;
} }
public static AndroidElement scrollTillFindElement (String elementName, AndroidElement element, AndroidDriver driver) { public static AndroidElement scrollTillFindElement (String elementName,
AndroidElement element, AndroidDriver driver) {
AndroidElement fileElement; AndroidElement fileElement;
if(element.getAttribute("scrollable").equals("true")){ if(element.getAttribute("scrollable").equals("true")){
HashMap<String, String> scrollObject = new HashMap<String, String>(); HashMap<String, String> scrollObject = new HashMap<String,String>();
scrollObject.put("text", elementName); scrollObject.put("text", elementName);
scrollObject.put("element", ( (RemoteWebElement) element).getId()); scrollObject.put("element", ( (RemoteWebElement) element).getId());
driver.executeScript("mobile: scrollTo", scrollObject); driver.executeScript("mobile: scrollTo", scrollObject);
} }
try { try {
fileElement = (AndroidElement) driver.findElementByName(elementName); fileElement = (AndroidElement) driver
.findElementByName(elementName);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
fileElement = null; fileElement = null;
} }
@ -92,28 +121,39 @@ public class Actions {
} }
//TODO. convert deleteFodler and deleteFile in deleteElement //TODO. convert deleteFodler and deleteFile in deleteElement
public static AndroidElement deleteElement(String elementName, FileListView fileListView, AndroidDriver driver) throws Exception{ public static AndroidElement deleteElement(String elementName,
FileListView fileListView, AndroidDriver driver) throws Exception{
AndroidElement fileElement; AndroidElement fileElement;
WaitAMomentPopUp waitAMomentPopUp; WaitAMomentPopUp waitAMomentPopUp;
try{ try{
//To open directly the "file list view" and we don't need to know in which view we are //To open directly the "file list view" and
driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); //we don't need to know in which view we are
fileElement = (AndroidElement) driver.findElementByName(elementName); driver.startActivity("com.owncloud.android",
ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName); ".ui.activity.FileDisplayActivity");
RemoveConfirmationView removeConfirmationView = menuOptions.clickOnRemove();; fileElement = (AndroidElement) driver
waitAMomentPopUp = removeConfirmationView.clickOnRemoteAndLocalButton(); .findElementByName(elementName);
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); ElementMenuOptions menuOptions = fileListView
.longPressOnElement(elementName);
RemoveConfirmationView removeConfirmationView = menuOptions
.clickOnRemove();;
waitAMomentPopUp = removeConfirmationView
.clickOnRemoteAndLocalButton();
Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
}catch(NoSuchElementException e){ }catch(NoSuchElementException e){
fileElement=null; fileElement=null;
} }
return fileElement; return fileElement;
} }
public static FileListView uploadFile(String elementName, FileListView fileListView) throws InterruptedException{ public static FileListView uploadFile(String elementName,
FileListView fileListView) throws InterruptedException{
fileListView.clickOnUploadButton(); fileListView.clickOnUploadButton();
UploadFilesView uploadFilesView = fileListView.clickOnFilesElementUploadFile(); UploadFilesView uploadFilesView = fileListView
.clickOnFilesElementUploadFile();
uploadFilesView.clickOnFileName(elementName); uploadFilesView.clickOnFileName(elementName);
FileListView fileListViewAfterUploadFile = uploadFilesView.clickOnUploadButton(); FileListView fileListViewAfterUploadFile = uploadFilesView
.clickOnUploadButton();
//TO DO. detect when the file is successfully uploaded //TO DO. detect when the file is successfully uploaded
Thread.sleep(15000); Thread.sleep(15000);
return fileListViewAfterUploadFile; return fileListViewAfterUploadFile;

View file

@ -1,3 +1,22 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface FailingTestCategory extends IgnoreTestCategory {} public interface FailingTestCategory extends IgnoreTestCategory {}

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface IgnoreTestCategory {} public interface IgnoreTestCategory {}

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface NoIgnoreTestCategory { public interface NoIgnoreTestCategory {

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface OtherTestCategory extends IgnoreTestCategory {} public interface OtherTestCategory extends IgnoreTestCategory {}

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface SmokeTestCategory { public interface SmokeTestCategory {

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups; package com.owncloud.android.test.ui.groups;
public interface UnfinishedTestCategory extends IgnoreTestCategory{ public interface UnfinishedTestCategory extends IgnoreTestCategory{

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -39,7 +59,8 @@ public class ElementMenuOptions {
public RemoveConfirmationView clickOnRemove () { public RemoveConfirmationView clickOnRemove () {
removeFileElement.click(); removeFileElement.click();
RemoveConfirmationView removeConfirmationView = new RemoveConfirmationView(driver); RemoveConfirmationView removeConfirmationView =
new RemoveConfirmationView(driver);
return removeConfirmationView; return removeConfirmationView;
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import java.util.List; import java.util.List;
@ -18,7 +38,8 @@ import com.owncloud.android.test.ui.actions.Actions;
public class FileListView { public class FileListView {
final AndroidDriver driver; final AndroidDriver driver;
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"More options\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"More options\")")
private AndroidElement menuButton; private AndroidElement menuButton;
@CacheLookup @CacheLookup
@ -26,14 +47,16 @@ public class FileListView {
private AndroidElement filesLayout; private AndroidElement filesLayout;
@CacheLookup @CacheLookup
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/action_bar_title\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")")
private AndroidElement titleText; private AndroidElement titleText;
@AndroidFindBy(id = "android:id/progress_circular") @AndroidFindBy(id = "android:id/progress_circular")
private AndroidElement progressCircular; private AndroidElement progressCircular;
@CacheLookup @CacheLookup
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"New folder\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"New folder\")")
private AndroidElement newFolderButton; private AndroidElement newFolderButton;
@CacheLookup @CacheLookup
@ -52,16 +75,20 @@ public class FileListView {
private AndroidElement filesElementUploadFile; private AndroidElement filesElementUploadFile;
@CacheLookup @CacheLookup
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"List Layout\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"List Layout\")")
private AndroidElement listLayout; private AndroidElement listLayout;
private AndroidElement fileElement; private AndroidElement fileElement;
private AndroidElement fileElementLayout; private AndroidElement fileElementLayout;
private static String localFileIndicator = "com.owncloud.android:id/localFileIndicator"; private static String localFileIndicator =
private static String favoriteFileIndicator = "com.owncloud.android:id/favoriteIcon"; "com.owncloud.android:id/localFileIndicator";
private static String sharedElementIndicator = "com.owncloud.android:id/sharedIcon"; private static String favoriteFileIndicator =
"com.owncloud.android:id/favoriteIcon";
private static String sharedElementIndicator =
"com.owncloud.android:id/sharedIcon";
public FileListView (AndroidDriver driver) { public FileListView (AndroidDriver driver) {
@ -133,9 +160,12 @@ public class FileListView {
} }
public AndroidElement scrollTillFindElement (String elementName) { public AndroidElement scrollTillFindElement (String elementName) {
fileElement = Actions.scrollTillFindElement (elementName,filesLayout,driver); fileElement = Actions
.scrollTillFindElement (elementName,filesLayout,driver);
try { try {
fileElementLayout = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"LinearLayout-"+ elementName +"\")"); fileElementLayout = (AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()"
+ ".description(\"LinearLayout-"+ elementName +"\")");
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
fileElementLayout = null; fileElementLayout = null;
} }
@ -163,7 +193,8 @@ public class FileListView {
} }
public void pulldownToRefresh () throws InterruptedException { public void pulldownToRefresh () throws InterruptedException {
Point listLocation = listLayout.getLocation(); Point listLocation = listLayout.getLocation();
driver.swipe(listLocation.getX(),listLocation.getY(), listLocation.getX(),listLocation.getY()+1000, 5000); driver.swipe(listLocation.getX(),listLocation.getY(),
listLocation.getX(),listLocation.getY()+1000, 5000);
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -12,9 +32,11 @@ public class GmailEmailListView {
final AndroidDriver driver; final AndroidDriver driver;
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"me about UploadFile, on May 11, conversation read\")") @AndroidFindBy(uiAutomator = "new UiSelector().description(\""
+ "me about UploadFile, on May 11, conversation read\")")
private AndroidElement emailAmericanFormatDate; private AndroidElement emailAmericanFormatDate;
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"me about UploadFile, on 11 May, conversation read\")") @AndroidFindBy(uiAutomator = "new UiSelector().description(\""
+ "me about UploadFile, on 11 May, conversation read\")")
private AndroidElement emailEuropeanFormatDate; private AndroidElement emailEuropeanFormatDate;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -15,7 +35,8 @@ public class ImageView {
final AndroidDriver driver; final AndroidDriver driver;
@CacheLookup @CacheLookup
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"More options\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"More options\")")
private AndroidElement optionsButton; private AndroidElement optionsButton;
@AndroidFindBy(name = "Share") @AndroidFindBy(name = "Share")
@ -48,7 +69,7 @@ public class ImageView {
public void clickOnOwnCloudButton(){ public void clickOnOwnCloudButton(){
if(Common.isElementPresent(ownCloudButton)){ if(Common.isElementPresent(ownCloudButton)){
Actions.scrollTillFindElement("ownCloud", sharingAppsLayout, driver); Actions.scrollTillFindElement("ownCloud",sharingAppsLayout,driver);
ownCloudButton.click(); ownCloudButton.click();
}else if(Common.isElementPresent(shareWithOwnCloudButton)){} }else if(Common.isElementPresent(shareWithOwnCloudButton)){}
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.CacheLookup; import org.openqa.selenium.support.CacheLookup;
@ -12,7 +32,8 @@ public class LoginForm {
final AndroidDriver driver; final AndroidDriver driver;
@CacheLookup @CacheLookup
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"Server address\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"Server address\")")
private AndroidElement hostUrlInput; private AndroidElement hostUrlInput;
@CacheLookup @CacheLookup
@ -27,10 +48,12 @@ public class LoginForm {
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"Connect\")") @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Connect\")")
private AndroidElement connectButton; private AndroidElement connectButton;
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"Testing connection\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"Testing connection\")")
private AndroidElement serverStatusText; private AndroidElement serverStatusText;
@AndroidFindBy(uiAutomator = "new UiSelector().description(\"Wrong username or password\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".description(\"Wrong username or password\")")
private AndroidElement authStatusText; private AndroidElement authStatusText;
public LoginForm (AndroidDriver driver) { public LoginForm (AndroidDriver driver) {
@ -51,7 +74,8 @@ public class LoginForm {
public void typeUserName (String userName) { public void typeUserName (String userName) {
userNameInput.clear(); userNameInput.clear();
//using the \n , it not need to hide the keyboard which sometimes gives problems //using the \n , it not need to hide the keyboard
//which sometimes gives problems
userNameInput.sendKeys(userName + "\n"); userNameInput.sendKeys(userName + "\n");
//driver.hideKeyboard(); //driver.hideKeyboard();
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.PageFactory;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.PageFactory;
@ -11,10 +31,12 @@ public class NewFolderPopUp {
final AndroidDriver driver; final AndroidDriver driver;
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/button1\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".resourceId(\"android:id/button1\")")
private AndroidElement newFolderOkButton; private AndroidElement newFolderOkButton;
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"com.owncloud.android:id/user_input\")") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".resourceId(\"com.owncloud.android:id/user_input\")")
private AndroidElement newFolderNameField; private AndroidElement newFolderNameField;
public NewFolderPopUp (AndroidDriver driver) { public NewFolderPopUp (AndroidDriver driver) {

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.PageFactory;
@ -10,16 +30,20 @@ import io.appium.java_client.pagefactory.AppiumFieldDecorator;
public class PassCodeRequestView { public class PassCodeRequestView {
final AndroidDriver driver; final AndroidDriver driver;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(0)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(0)")
private AndroidElement codeElement1; private AndroidElement codeElement1;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(1)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(1)")
private AndroidElement codeElement2; private AndroidElement codeElement2;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(2)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(2)")
private AndroidElement codeElement3; private AndroidElement codeElement3;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(3)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(3)")
private AndroidElement codeElement4; private AndroidElement codeElement4;
public PassCodeRequestView (AndroidDriver driver) { public PassCodeRequestView (AndroidDriver driver) {
@ -27,8 +51,10 @@ final AndroidDriver driver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this); PageFactory.initElements(new AppiumFieldDecorator(driver), this);
} }
public void enterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ public void enterPasscode(String codeNumber1, String codeNumber2,
codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); String codeNumber3, String codeNumber4){
codeElement1
.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1);
} }
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -10,16 +30,20 @@ import org.openqa.selenium.support.PageFactory;
public class PassCodeView { public class PassCodeView {
final AndroidDriver driver; final AndroidDriver driver;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(0)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(0)")
private AndroidElement codeElement1; private AndroidElement codeElement1;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(1)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(1)")
private AndroidElement codeElement2; private AndroidElement codeElement2;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(2)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(2)")
private AndroidElement codeElement3; private AndroidElement codeElement3;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(3)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.EditText\").index(3)")
private AndroidElement codeElement4; private AndroidElement codeElement4;
@AndroidFindBy(name = "Cancel") @AndroidFindBy(name = "Cancel")
@ -30,12 +54,16 @@ public class PassCodeView {
PageFactory.initElements(new AppiumFieldDecorator(driver), this); PageFactory.initElements(new AppiumFieldDecorator(driver), this);
} }
public PassCodeView enterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ public PassCodeView enterPasscode(String codeNumber1, String codeNumber2,
codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); String codeNumber3, String codeNumber4){
codeElement1
.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1);
return this; return this;
} }
public SettingsView reenterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ public SettingsView reenterPasscode(String codeNumber1,
codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); String codeNumber2, String codeNumber3, String codeNumber4){
codeElement1
.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1);
SettingsView settingsView = new SettingsView(driver); SettingsView settingsView = new SettingsView(driver);
return settingsView; return settingsView;
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -30,7 +50,8 @@ public class SettingsView {
@AndroidFindBy(name = "Add account") @AndroidFindBy(name = "Add account")
private AndroidElement addAccountElement; private AndroidElement addAccountElement;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.CheckBox\").index(0)") @AndroidFindBy(uiAutomator = "new UiSelector()"
+ ".className(\"android.widget.CheckBox\").index(0)")
private AndroidElement passcodeCheckbox; private AndroidElement passcodeCheckbox;
public SettingsView (AndroidDriver driver) { public SettingsView (AndroidDriver driver) {

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -36,7 +56,8 @@ public class UploadFilesView{
//change to scrollTillFindElement //change to scrollTillFindElement
public void scrollTillFindFile (String fileName) { public void scrollTillFindFile (String fileName) {
fileElement = Actions.scrollTillFindElement (fileName,filesLayout,driver); fileElement = Actions
.scrollTillFindElement(fileName,filesLayout,driver);
} }
public void clickOnFileName (String fileName) { public void clickOnFileName (String fileName) {

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models; package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.PageFactory;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -34,16 +54,21 @@ public class Common{
capabilities.setCapability("deviceName", "test"); capabilities.setCapability("deviceName", "test");
capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.owncloud.android"); capabilities.setCapability("appPackage", "com.owncloud.android");
capabilities.setCapability("appActivity", ".ui.activity.FileDisplayActivity"); capabilities.setCapability("appActivity",
capabilities.setCapability("appWaitActivity", ".authentication.AuthenticatorActivity"); ".ui.activity.FileDisplayActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); capabilities.setCapability("appWaitActivity",
driver.manage().timeouts().implicitlyWait(waitingTime, TimeUnit.SECONDS); ".authentication.AuthenticatorActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
driver.manage().timeouts().implicitlyWait(waitingTime,
TimeUnit.SECONDS);
wait = new WebDriverWait(driver, waitingTime, 50); wait = new WebDriverWait(driver, waitingTime, 50);
return driver; return driver;
} }
protected boolean waitForTextPresent(String text, AndroidElement element) throws InterruptedException{ protected boolean waitForTextPresent(String text, AndroidElement element)
throws InterruptedException{
for (int second = 0;;second++){ for (int second = 0;;second++){
if (second >= waitingTime) if (second >= waitingTime)
return false; return false;
@ -77,7 +102,8 @@ public class Common{
} }
//pollingTime in milliseconds //pollingTime in milliseconds
public static void waitTillElementIsNotPresent (AndroidElement element, int pollingTime) throws Exception { public static void waitTillElementIsNotPresent (AndroidElement element,
int pollingTime) throws Exception {
for (int time = 0;;time += pollingTime){ for (int time = 0;;time += pollingTime){
if (time >= waitingTime * 1000) //convert to milliseconds if (time >= waitingTime * 1000) //convert to milliseconds
break; break;
@ -91,24 +117,35 @@ public class Common{
throw new TimeoutException(); throw new TimeoutException();
} }
protected void takeScreenShotOnFailed (String testName) throws IOException { protected void takeScreenShotOnFailed (String testName)
File file = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE); throws IOException {
File file = ((RemoteWebDriver) driver)
.getScreenshotAs(OutputType.FILE);
SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
Date today = Calendar.getInstance().getTime(); Date today = Calendar.getInstance().getTime();
String screenShotName = "ScreenShots/" + dt1.format(today) + "/" + testName + ".png"; String screenShotName = "ScreenShots/" + dt1.format(today) + "/"
+ testName + ".png";
FileUtils.copyFile(file, new File(screenShotName)); FileUtils.copyFile(file, new File(screenShotName));
} }
protected void assertIsInFileListView() throws InterruptedException { protected void assertIsInFileListView() throws InterruptedException {
assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
assertTrue(isElementPresent((AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"Upload\")"))); .findElementByAndroidUIAutomator("new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")")));
assertTrue(isElementPresent((AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()"
+ ".description(\"Upload\")")));
} }
protected void assertIsNotInFileListView() throws InterruptedException { protected void assertIsNotInFileListView() throws InterruptedException {
AndroidElement fileElement; AndroidElement fileElement;
assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")")));
try { try {
fileElement = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"Upload\")"); fileElement = (AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()"
+ ".description(\"Upload\")");
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
fileElement = null; fileElement = null;
} }
@ -116,13 +153,19 @@ public class Common{
} }
protected void assertIsPasscodeRequestView() throws InterruptedException { protected void assertIsPasscodeRequestView() throws InterruptedException {
assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
assertTrue(((AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().text(\"Please, insert your pass code\")")).isDisplayed()); .findElementByAndroidUIAutomator("new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")")));
assertTrue(((AndroidElement) driver.findElementByAndroidUIAutomator(
"new UiSelector().text(\"Please, insert your pass code\")"))
.isDisplayed());
} }
protected void assertIsInSettingsView() throws InterruptedException { protected void assertIsInSettingsView() throws InterruptedException {
assertTrue(waitForTextPresent("Settings", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); assertTrue(waitForTextPresent("Settings", (AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")")));
} }
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -41,17 +61,21 @@ public class CreateFolderTestSuite{
public void testCreateNewFolder () throws Exception { public void testCreateNewFolder () throws Exception {
String NEW_FOLDER_NAME = "testCreateFolder"; String NEW_FOLDER_NAME = "testCreateFolder";
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL,
Config.user,Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//check if the folder already exists and if true, delete them //check if the folder already exists and if true, delete them
Actions.deleteElement(NEW_FOLDER_NAME, fileListView, driver); Actions.deleteElement(NEW_FOLDER_NAME, fileListView, driver);
WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(NEW_FOLDER_NAME, fileListView); WaitAMomentPopUp waitAMomentPopUp = Actions
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .createFolder(NEW_FOLDER_NAME, fileListView);
Common.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_NAME); fileListView.scrollTillFindElement(FOLDER_NAME);
assertNotNull(fileListView.getFileElement()); assertNotNull(fileListView.getFileElement());
assertTrue(folderHasBeenCreated=fileListView.getFileElement().isDisplayed()); assertTrue(
folderHasBeenCreated=fileListView.getFileElement().isDisplayed());
CurrentCreatedFolder = FOLDER_NAME; CurrentCreatedFolder = FOLDER_NAME;
assertEquals(FOLDER_NAME , fileListView.getFileElement().getText()); assertEquals(FOLDER_NAME , fileListView.getFileElement().getText());
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -38,15 +58,20 @@ public class DeleteFileTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testDeleteFile () throws Exception { public void testDeleteFile () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. if the file already exists, do not upload //TODO. if the file already exists, do not upload
FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(FILE_NAME, fileListView);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(
common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); fileListViewAfterUploadFile.getProgressCircular(), 1000);
common.wait.until(ExpectedConditions.visibilityOf(
fileListViewAfterUploadFile.getFileElementLayout()
.findElement(By.id(FileListView.getLocalFileIndicator()))));
Actions.deleteElement(FILE_NAME,fileListViewAfterUploadFile, driver); Actions.deleteElement(FILE_NAME,fileListViewAfterUploadFile, driver);
assertFalse(fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertFalse(fileListViewAfterUploadFile.getFileElement().isDisplayed());

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -38,19 +58,24 @@ public class DeleteFolderTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testDeleteFolder () throws Exception { public void testDeleteFolder () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. if the folder already exists, do no created //TODO. if the folder already exists, do no created
//create the folder //create the folder
WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(FOLDER_NAME, fileListView); WaitAMomentPopUp waitAMomentPopUp = Actions
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .createFolder(FOLDER_NAME, fileListView);
Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_NAME); fileListView.scrollTillFindElement(FOLDER_NAME);
assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); assertTrue(
folderHasBeenCreated = fileListView.getFileElement().isDisplayed());
//delete the folder //delete the folder
Actions.deleteElement(FOLDER_NAME, fileListView, driver); Actions.deleteElement(FOLDER_NAME, fileListView, driver);
assertFalse(folderHasBeenCreated =fileListView.getFileElement().isDisplayed()); assertFalse(
folderHasBeenCreated =fileListView.getFileElement().isDisplayed());
} }
@After @After

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -38,7 +58,8 @@ public class LoginTestSuite{
public void test1LoginPortrait () throws Exception { public void test1LoginPortrait () throws Exception {
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
} }
@ -46,7 +67,8 @@ public class LoginTestSuite{
@Category({NoIgnoreTestCategory.class}) @Category({NoIgnoreTestCategory.class})
public void test2LoginLandscape () throws Exception { public void test2LoginLandscape () throws Exception {
driver.rotate(ScreenOrientation.LANDSCAPE); driver.rotate(ScreenOrientation.LANDSCAPE);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
} }
@ -55,7 +77,8 @@ public class LoginTestSuite{
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void test3MultiAccountRotate () throws Exception { public void test3MultiAccountRotate () throws Exception {
driver.rotate(ScreenOrientation.LANDSCAPE); driver.rotate(ScreenOrientation.LANDSCAPE);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
@ -63,7 +86,8 @@ public class LoginTestSuite{
SettingsView settingsView = menu.clickOnSettingsButton(); SettingsView settingsView = menu.clickOnSettingsButton();
settingsView.tapOnAddAccount(1, 1000); settingsView.tapOnAddAccount(1, 1000);
fileListView = Actions.login(Config.URL2, Config.user2,Config.password2, Config.isTrusted2, driver); fileListView = Actions.login(Config.URL2, Config.user2,
Config.password2, Config.isTrusted2, driver);
common.assertIsInSettingsView(); common.assertIsInSettingsView();
} }
@ -71,7 +95,8 @@ public class LoginTestSuite{
@Category({NoIgnoreTestCategory.class}) @Category({NoIgnoreTestCategory.class})
public void test4ExistingAccountRotate () throws Exception { public void test4ExistingAccountRotate () throws Exception {
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
driver.rotate(ScreenOrientation.LANDSCAPE); driver.rotate(ScreenOrientation.LANDSCAPE);
@ -80,23 +105,29 @@ public class LoginTestSuite{
settingsView.tapOnAddAccount(1, 1000); settingsView.tapOnAddAccount(1, 1000);
LoginForm loginForm = new LoginForm(driver); LoginForm loginForm = new LoginForm(driver);
fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); fileListView = Actions.login(Config.URL, Config.user,Config.password,
assertTrue(common.waitForTextPresent("An account for the same user and server already exists in the device", loginForm.getAuthStatusText())); Config.isTrusted, driver);
assertTrue(common.waitForTextPresent("An account for the same user and"
+ " server already exists in the device",
loginForm.getAuthStatusText()));
} }
@Test @Test
@Category({NoIgnoreTestCategory.class}) @Category({NoIgnoreTestCategory.class})
public void test5ChangePasswordWrong () throws Exception { public void test5ChangePasswordWrong () throws Exception {
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
MenuList menu = fileListView.clickOnMenuButton(); MenuList menu = fileListView.clickOnMenuButton();
SettingsView settingsView = menu.clickOnSettingsButton(); SettingsView settingsView = menu.clickOnSettingsButton();
settingsView.tapOnAccountElement(1, 1000); settingsView.tapOnAccountElement(1, 1000);
LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement(); LoginForm changePasswordForm = settingsView
.clickOnChangePasswordElement();
changePasswordForm.typePassword("WrongPassword"); changePasswordForm.typePassword("WrongPassword");
changePasswordForm.clickOnConnectButton(); changePasswordForm.clickOnConnectButton();
assertTrue(common.waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText())); assertTrue(common.waitForTextPresent("Wrong username or password",
changePasswordForm.getAuthStatusText()));
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
@ -35,13 +55,15 @@ public class LogoutTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testLogout () throws Exception { public void testLogout () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
MenuList menulist = fileListView.clickOnMenuButton(); MenuList menulist = fileListView.clickOnMenuButton();
SettingsView settingsView = menulist.clickOnSettingsButton(); SettingsView settingsView = menulist.clickOnSettingsButton();
settingsView.tapOnAccountElement(1, 1000); settingsView.tapOnAccountElement(1, 1000);
LoginForm loginForm = settingsView.clickOnDeleteAccountElement(); LoginForm loginForm = settingsView.clickOnDeleteAccountElement();
assertEquals("Server address https://…", loginForm.gethostUrlInput().getText()); assertEquals("Server address https://…",
loginForm.gethostUrlInput().getText());
assertEquals("Username", loginForm.getUserNameInput().getText()); assertEquals("Username", loginForm.getUserNameInput().getText());
assertEquals("", loginForm.getPasswordInput().getText()); assertEquals("", loginForm.getPasswordInput().getText());
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -41,37 +61,45 @@ public class MoveFileTestSuite{
public void testMoveFile () throws Exception { public void testMoveFile () throws Exception {
WaitAMomentPopUp waitAMomentPopUp; WaitAMomentPopUp waitAMomentPopUp;
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); //Common.waitTillElementIsNotPresent(
//fileListView.getProgressCircular(), 1000);
//check if the folder already exists and if true, delete them //check if the folder already exists and if true, delete them
Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver); Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver);
Actions.deleteElement(FILE_NAME, fileListView, driver); Actions.deleteElement(FILE_NAME, fileListView, driver);
//Create the folder where the other is gone to be moved //Create the folder where the other is gone to be moved
waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, fileListView); waitAMomentPopUp = Actions
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .createFolder(FOLDER_WHERE_MOVE, fileListView);
Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
assertTrue(fileListView.getFileElement().isDisplayed()); assertTrue(fileListView.getFileElement().isDisplayed());
FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(FILE_NAME, fileListView);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
//select to move the file //select to move the file
ElementMenuOptions menuOptions = fileListView.longPressOnElement(FILE_NAME); ElementMenuOptions menuOptions = fileListView
.longPressOnElement(FILE_NAME);
MoveView moveView = menuOptions.clickOnMove(); MoveView moveView = menuOptions.clickOnMove();
//to move to a folder //to move to a folder
moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
waitAMomentPopUp = moveView.clickOnChoose(); waitAMomentPopUp = moveView.clickOnChoose();
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
//check that the folder moved is inside the other //check that the folder moved is inside the other
fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
1000);
Thread.sleep(1000); Thread.sleep(1000);
fileListView.scrollTillFindElement(FILE_NAME); fileListView.scrollTillFindElement(FILE_NAME);
assertEquals(FILE_NAME , fileListView.getFileElement().getText()); assertEquals(FILE_NAME , fileListView.getFileElement().getText());

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -41,39 +61,47 @@ public class MoveFolderTestSuite{
public void testMoveFolder () throws Exception { public void testMoveFolder () throws Exception {
WaitAMomentPopUp waitAMomentPopUp; WaitAMomentPopUp waitAMomentPopUp;
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); //Common.waitTillElementIsNotPresent(
//fileListView.getProgressCircular(), 1000);
//check if the folder already exists and if true, delete them //check if the folder already exists and if true, delete them
Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver); Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver);
Actions.deleteElement(FOLDER_TO_MOVE, fileListView, driver); Actions.deleteElement(FOLDER_TO_MOVE, fileListView, driver);
//Create the folder where the other is gone to be moved //Create the folder where the other is gone to be moved
waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, fileListView); waitAMomentPopUp = Actions
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .createFolder(FOLDER_WHERE_MOVE, fileListView);
Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
assertTrue(fileListView.getFileElement().isDisplayed()); assertTrue(fileListView.getFileElement().isDisplayed());
//Create the folder which is going to be moved //Create the folder which is going to be moved
waitAMomentPopUp = Actions.createFolder(FOLDER_TO_MOVE, fileListView); waitAMomentPopUp = Actions.createFolder(FOLDER_TO_MOVE, fileListView);
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_TO_MOVE); fileListView.scrollTillFindElement(FOLDER_TO_MOVE);
assertTrue(fileListView.getFileElement().isDisplayed()); assertTrue(fileListView.getFileElement().isDisplayed());
//select to move the folder //select to move the folder
ElementMenuOptions menuOptions = fileListView.longPressOnElement(FOLDER_TO_MOVE); ElementMenuOptions menuOptions = fileListView
.longPressOnElement(FOLDER_TO_MOVE);
MoveView moveView = menuOptions.clickOnMove(); MoveView moveView = menuOptions.clickOnMove();
//to move to a folder //to move to a folder
moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
waitAMomentPopUp = moveView.clickOnChoose(); waitAMomentPopUp = moveView.clickOnChoose();
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); Common.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
//check that the folder moved is inside the other //check that the folder moved is inside the other
fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
1000);
Thread.sleep(1000); Thread.sleep(1000);
fileListView.scrollTillFindElement(FOLDER_TO_MOVE); fileListView.scrollTillFindElement(FOLDER_TO_MOVE);
assertEquals(FOLDER_TO_MOVE , fileListView.getFileElement().getText()); assertEquals(FOLDER_TO_MOVE , fileListView.getFileElement().getText());

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidDriver;
@ -37,25 +57,33 @@ public class PasscodeTestSuite {
@Category({NoIgnoreTestCategory.class}) @Category({NoIgnoreTestCategory.class})
public void testPincodeEnable () throws Exception { public void testPincodeEnable () throws Exception {
driver.rotate(ScreenOrientation.PORTRAIT); driver.rotate(ScreenOrientation.PORTRAIT);
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
MenuList menu = fileListView.clickOnMenuButton(); MenuList menu = fileListView.clickOnMenuButton();
SettingsView settingsView = menu.clickOnSettingsButton(); SettingsView settingsView = menu.clickOnSettingsButton();
PassCodeView passCodeview = settingsView.EnablePassCode(); PassCodeView passCodeview = settingsView.EnablePassCode();
PassCodeView passCodeview2 = passCodeview.enterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); PassCodeView passCodeview2 = passCodeview.enterPasscode(
passCodeview2.reenterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); Config.passcode1, Config.passcode2, Config.passcode3,
Config.passcode4);
passCodeview2.reenterPasscode(Config.passcode1, Config.passcode2,
Config.passcode3, Config.passcode4);
driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME);
//TO DO. Open the app instead of start an activity //TO DO. Open the app instead of start an activity
driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); driver.startActivity("com.owncloud.android",
//here we check that we are not in the fileDisplayActivity, because pincode is asked ".ui.activity.FileDisplayActivity");
//here we check that we are not in the fileDisplayActivity,
//because pincode is asked
common.assertIsNotInFileListView(); common.assertIsNotInFileListView();
common.assertIsPasscodeRequestView(); common.assertIsPasscodeRequestView();
PassCodeRequestView passCodeReequestView = new PassCodeRequestView(driver); PassCodeRequestView passCodeReequestView = new
passCodeReequestView.enterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); PassCodeRequestView(driver);
passCodeReequestView.enterPasscode(Config.passcode1, Config.passcode2,
Config.passcode3, Config.passcode4);
common.assertIsInFileListView(); common.assertIsInFileListView();
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -34,9 +54,11 @@ public class RefreshFolderTestSuite{
@Test @Test
@Category({UnfinishedTestCategory.class}) @Category({UnfinishedTestCategory.class})
public void testPulldownToRefreshFolder () throws Exception { public void testPulldownToRefreshFolder () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. Remove the sleep and check why is not working the assert when using waitTillElementIsNotPresent //TODO. Remove the sleep and check why is not working the assert
//when using waitTillElementIsNotPresent
Thread.sleep(5000); Thread.sleep(5000);
//waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); //waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000);
fileListView.pulldownToRefresh(); fileListView.pulldownToRefresh();

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -44,29 +64,39 @@ public class RenameFileTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testRenameFile () throws Exception { public void testRenameFile () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. if the file already exists, do not upload //TODO. if the file already exists, do not upload
FileListView fileListViewAfterUploadFile = Actions.uploadFile(OLD_FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(OLD_FILE_NAME, fileListView);
//check if the file with the new name already exists, if true delete it //check if the file with the new name already exists, if true delete it
Actions.deleteElement(FILE_NAME, fileListView, driver); Actions.deleteElement(FILE_NAME, fileListView, driver);
fileListViewAfterUploadFile.scrollTillFindElement(OLD_FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(OLD_FILE_NAME);
assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
.getFileElement().isDisplayed());
CurrentCreatedFile = OLD_FILE_NAME; CurrentCreatedFile = OLD_FILE_NAME;
Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile
common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); .getProgressCircular(), 1000);
ElementMenuOptions menuOptions = fileListViewAfterUploadFile.longPressOnElement(OLD_FILE_NAME); common.wait.until(ExpectedConditions.visibilityOf(
fileListViewAfterUploadFile.getFileElementLayout()
.findElement(By.id(FileListView.getLocalFileIndicator()))));
ElementMenuOptions menuOptions = fileListViewAfterUploadFile
.longPressOnElement(OLD_FILE_NAME);
NewFolderPopUp newFolderPopUp = menuOptions.clickOnRename(); NewFolderPopUp newFolderPopUp = menuOptions.clickOnRename();
newFolderPopUp.typeNewFolderName(FILE_NAME); newFolderPopUp.typeNewFolderName(FILE_NAME);
WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton(); WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .clickOnNewFolderOkButton();
Common.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
assertNotNull(fileListViewAfterUploadFile.getFileElement()); assertNotNull(fileListViewAfterUploadFile.getFileElement());
assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
assertEquals(FILE_NAME , fileListViewAfterUploadFile.getFileElement().getText()); assertEquals(FILE_NAME , fileListViewAfterUploadFile.getFileElement()
.getText());
CurrentCreatedFile = FILE_NAME; CurrentCreatedFile = FILE_NAME;
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -43,30 +63,38 @@ public class RenameFolderTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testRenameFolder () throws Exception { public void testRenameFolder () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. if the folder already exists, do no created //TODO. if the folder already exists, do no created
//create the folder to rename //create the folder to rename
WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(OLD_FOLDER_NAME, fileListView); WaitAMomentPopUp waitAMomentPopUp = Actions
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); .createFolder(OLD_FOLDER_NAME, fileListView);
Common.waitTillElementIsNotPresent(
waitAMomentPopUp.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(OLD_FOLDER_NAME); fileListView.scrollTillFindElement(OLD_FOLDER_NAME);
assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); assertTrue(
folderHasBeenCreated = fileListView.getFileElement().isDisplayed());
//check if the folder with the new name already exists and if true, delete them //check if the folder with the new name already exists
//and if true, delete them
Actions.deleteElement(FOLDER_NAME, fileListView, driver); Actions.deleteElement(FOLDER_NAME, fileListView, driver);
CurrentCreatedFolder = OLD_FOLDER_NAME; CurrentCreatedFolder = OLD_FOLDER_NAME;
ElementMenuOptions menuOptions = fileListView.longPressOnElement(OLD_FOLDER_NAME); ElementMenuOptions menuOptions = fileListView
.longPressOnElement(OLD_FOLDER_NAME);
NewFolderPopUp FolderPopUp = menuOptions.clickOnRename(); NewFolderPopUp FolderPopUp = menuOptions.clickOnRename();
FolderPopUp.typeNewFolderName(FOLDER_NAME); FolderPopUp.typeNewFolderName(FOLDER_NAME);
FolderPopUp.clickOnNewFolderOkButton(); FolderPopUp.clickOnNewFolderOkButton();
CurrentCreatedFolder = FOLDER_NAME; CurrentCreatedFolder = FOLDER_NAME;
Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); Common.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
fileListView.scrollTillFindElement(FOLDER_NAME); fileListView.scrollTillFindElement(FOLDER_NAME);
assertNotNull(fileListView.getFileElement()); assertNotNull(fileListView.getFileElement());
assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); assertTrue(
folderHasBeenCreated = fileListView.getFileElement().isDisplayed());
assertEquals(FOLDER_NAME , fileListView.getFileElement().getText()); assertEquals(FOLDER_NAME , fileListView.getFileElement().getText());
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import org.junit.experimental.categories.Categories.ExcludeCategory; import org.junit.experimental.categories.Categories.ExcludeCategory;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import org.junit.experimental.categories.Categories.ExcludeCategory; import org.junit.experimental.categories.Categories.ExcludeCategory;

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -38,24 +58,34 @@ public class ShareLinkFileTestSuite{
@Test @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
public void testShareLinkFile () throws Exception { public void testShareLinkFile () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//TODO. if the file already exists, do not upload //TODO. if the file already exists, do not upload
FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(FILE_NAME, fileListView);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
.getFileElement().isDisplayed());
ElementMenuOptions elementMenuOption = fileListViewAfterUploadFile.longPressOnElement(FILE_NAME); ElementMenuOptions elementMenuOption = fileListViewAfterUploadFile
.longPressOnElement(FILE_NAME);
ShareView shareView = elementMenuOption.clickOnShareLinkElement(); ShareView shareView = elementMenuOption.clickOnShareLinkElement();
Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(), driver).click(); Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(),
driver).click();
GmailSendMailView gmailSendMailView = new GmailSendMailView(driver); GmailSendMailView gmailSendMailView = new GmailSendMailView(driver);
gmailSendMailView.typeToEmailAdress(Config.gmailAccount); gmailSendMailView.typeToEmailAdress(Config.gmailAccount);
gmailSendMailView.clickOnSendButton(); gmailSendMailView.clickOnSendButton();
Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile
common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator())))); .getProgressCircular(), 1000);
assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator())).isDisplayed()); common.wait.until(ExpectedConditions.visibilityOf(
fileListViewAfterUploadFile.getFileElementLayout()
.findElement(By.id(FileListView.getSharedElementIndicator()))));
assertTrue(fileListViewAfterUploadFile.getFileElementLayout()
.findElement(By.id(FileListView.getSharedElementIndicator()))
.isDisplayed());
} }

View file

@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author purigarcia
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites; package com.owncloud.android.test.ui.testSuites;
@ -55,29 +75,39 @@ public class UploadTestSuite{
@Category(NoIgnoreTestCategory.class) @Category(NoIgnoreTestCategory.class)
public void testUploadFile () throws Exception { public void testUploadFile () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
//check if the file already exists and if true, delete it //check if the file already exists and if true, delete it
Actions.deleteElement(FILE_NAME, fileListView, driver); Actions.deleteElement(FILE_NAME, fileListView, driver);
FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(FILE_NAME, fileListView);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(
common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); fileListViewAfterUploadFile.getProgressCircular(), 1000);
assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())).isDisplayed()); 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 = new FileListView(driver);
fileListView.scrollTillFindElement(FILE_NAME); fileListView.scrollTillFindElement(FILE_NAME);
assertTrue(fileHasBeenUploaded = fileListView.getFileElement().isDisplayed()); assertTrue(
fileHasBeenUploaded = fileListView.getFileElement().isDisplayed());
} }
@Test @Test
@Category(UnfinishedTestCategory.class) @Category(UnfinishedTestCategory.class)
public void testUploadFromGmail () throws Exception { public void testUploadFromGmail () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
driver.startActivity("com.google.android.gm", ".ConversationListActivityGmail"); Config.password, Config.isTrusted, driver);
driver.startActivity("com.google.android.gm",
".ConversationListActivityGmail");
GmailEmailListView gmailEmailListView = new GmailEmailListView(driver); GmailEmailListView gmailEmailListView = new GmailEmailListView(driver);
Thread.sleep(3000); Thread.sleep(3000);
GmailEmailView gmailEmailView = gmailEmailListView.clickOnEmail(); GmailEmailView gmailEmailView = gmailEmailListView.clickOnEmail();
@ -93,12 +123,16 @@ public class UploadTestSuite{
UploadView uploadView = new UploadView(driver); UploadView uploadView = new UploadView(driver);
uploadView.clickOUploadButton(); uploadView.clickOUploadButton();
driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME);
driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); driver.startActivity("com.owncloud.android",
common.wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME))); ".ui.activity.FileDisplayActivity");
assertEquals(Config.fileToTestSendByEmailName , driver.findElementByName(FILE_GMAIL_NAME).getText()); common.wait.until(ExpectedConditions
.visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME)));
assertEquals(Config.fileToTestSendByEmailName ,
driver.findElementByName(FILE_GMAIL_NAME).getText());
fileListView = new FileListView(driver); fileListView = new FileListView(driver);
fileListView.scrollTillFindElement(FILE_GMAIL_NAME); fileListView.scrollTillFindElement(FILE_GMAIL_NAME);
assertTrue(fileHasBeenUploadedFromGmail = fileListView.getFileElement().isDisplayed()); assertTrue(fileHasBeenUploadedFromGmail = fileListView
.getFileElement().isDisplayed());
//TODO. correct assert if fileListView is shown in grid mode //TODO. correct assert if fileListView is shown in grid mode
} }
@ -107,22 +141,30 @@ public class UploadTestSuite{
@Category({FailingTestCategory.class}) @Category({FailingTestCategory.class})
public void testKeepFileUpToDate () throws Exception { public void testKeepFileUpToDate () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); FileListView fileListView = Actions.login(Config.URL, Config.user,
Config.password, Config.isTrusted, driver);
common.assertIsInFileListView(); common.assertIsInFileListView();
Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
1000);
FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); FileListView fileListViewAfterUploadFile = Actions
.uploadFile(FILE_NAME, fileListView);
fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
ElementMenuOptions menuOptions = fileListViewAfterUploadFile.longPressOnElement(FILE_NAME); ElementMenuOptions menuOptions = fileListViewAfterUploadFile
.longPressOnElement(FILE_NAME);
FileDetailsView fileDetailsView = menuOptions.clickOnDetails(); FileDetailsView fileDetailsView = menuOptions.clickOnDetails();
fileDetailsView.checkKeepFileUpToDateCheckbox(); fileDetailsView.checkKeepFileUpToDateCheckbox();
Thread.sleep(3000); Thread.sleep(3000);
driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
assertTrue(common.isElementPresent(fileListViewAfterUploadFile.getFileElementLayout(), MobileBy.id(FileListView.getFavoriteFileIndicator()))); assertTrue(common.isElementPresent(
assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getFavoriteFileIndicator())).isDisplayed()); fileListViewAfterUploadFile.getFileElementLayout(),
MobileBy.id(FileListView.getFavoriteFileIndicator())));
assertTrue(fileListViewAfterUploadFile.getFileElementLayout()
.findElement(By.id(FileListView.getFavoriteFileIndicator()))
.isDisplayed());
} }