Merge branch 'develop' into automationTest
authorpurigarcia <pgarcia@solidgear.es>
Mon, 11 May 2015 06:16:43 +0000 (08:16 +0200)
committerpurigarcia <pgarcia@solidgear.es>
Mon, 11 May 2015 06:16:43 +0000 (08:16 +0200)
36 files changed:
automationTest/.classpath [new file with mode: 0644]
automationTest/.gitignore [new file with mode: 0644]
automationTest/.project [new file with mode: 0644]
automationTest/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
automationTest/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
automationTest/.settings/org.eclipse.m2e.core.prefs [new file with mode: 0644]
automationTest/pom.xml [new file with mode: 0644]
automationTest/src/test/java/androidtest/actions/Actions.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/AppDetailsView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/CertificatePopUp.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/ElementMenuOptions.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/FilesView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/LoginForm.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/MainView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/MenuList.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/MoveView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/NewFolderPopUp.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/RemoveConfirmationView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/SettingsView.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/models/WaitAMomentPopUp.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/.gitignore [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/Common.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/Config.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/CreateFolderTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/DeleteFileTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/DeleteFolderTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/LoginTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/LogoutTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/MoveFileTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/MoveFolderTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/RenameFolderTestSuite.java [new file with mode: 0644]
automationTest/src/test/java/androidtest/tests/UploadTestSuite.java [new file with mode: 0644]
res/layout/file_details_empty.xml
res/layout/files.xml
res/values/strings.xml

diff --git a/automationTest/.classpath b/automationTest/.classpath
new file mode 100644 (file)
index 0000000..069344d
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" output="target/classes" path="src/main/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" path="resources"/>
+       <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/automationTest/.gitignore b/automationTest/.gitignore
new file mode 100644 (file)
index 0000000..3fe891d
--- /dev/null
@@ -0,0 +1,2 @@
+/target/
+src/test/java/androidtest/tests/Config.java
diff --git a/automationTest/.project b/automationTest/.project
new file mode 100644 (file)
index 0000000..b1e5840
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>androidtest</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/automationTest/.settings/org.eclipse.core.resources.prefs b/automationTest/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..f9fe345
--- /dev/null
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
diff --git a/automationTest/.settings/org.eclipse.jdt.core.prefs b/automationTest/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..6249222
--- /dev/null
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/automationTest/.settings/org.eclipse.m2e.core.prefs b/automationTest/.settings/org.eclipse.m2e.core.prefs
new file mode 100644 (file)
index 0000000..f897a7f
--- /dev/null
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/automationTest/pom.xml b/automationTest/pom.xml
new file mode 100644 (file)
index 0000000..773f1a6
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<modelVersion>4.0.0</modelVersion>
+
+<groupId>com.owncloud</groupId>
+<artifactId>androidtest</artifactId>
+<version>1.0-SNAPSHOT</version>
+  <build>
+    <pluginManagement>
+      <plugins>
+               <plugin>
+                       <groupId>org.apache.maven.plugins</groupId>
+                       <artifactId>maven-surefire-plugin</artifactId>
+                       <version>2.18.1</version>
+                       <configuration>
+                       <includes>
+                               <include>**/*Test**.java</include>
+                       </includes>
+                       </configuration>
+               </plugin>
+               <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-compiler-plugin</artifactId>
+               <version>3.3</version>
+               <configuration>
+               <source>1.7</source>
+               <target>1.7</target>
+        </configuration>
+      </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+<dependencies>
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.11</version>
+    </dependency>
+    <dependency>
+        <groupId>org.seleniumhq.selenium</groupId>
+        <artifactId>selenium-java</artifactId>
+        <version>2.45.0</version>
+    </dependency>
+    <dependency>
+        <groupId>io.selendroid</groupId>
+        <version>0.9.0</version>
+        <artifactId>selendroid-standalone</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>io.selendroid</groupId>
+        <version>0.9.0</version>
+        <artifactId>selendroid-client</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>io.appium</groupId>
+        <artifactId>java-client</artifactId>
+        <version>2.1.0</version>
+    </dependency>
+    <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.6</version>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.httpcomponents</groupId>
+        <artifactId>httpclient</artifactId>
+        <version>4.3.1</version>
+    </dependency>
+    <dependency>
+       <groupId>com.google.android</groupId>
+       <artifactId>android</artifactId>
+       <version>4.1.1.4</version>
+       <scope>provided</scope>
+  </dependency>
+</dependencies>
+</project>
\ No newline at end of file
diff --git a/automationTest/src/test/java/androidtest/actions/Actions.java b/automationTest/src/test/java/androidtest/actions/Actions.java
new file mode 100644 (file)
index 0000000..a89f5de
--- /dev/null
@@ -0,0 +1,112 @@
+package androidtest.actions;
+
+import java.util.HashMap;
+
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.remote.RemoteWebElement;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import androidtest.models.CertificatePopUp;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.FilesView;
+import androidtest.models.LoginForm;
+import androidtest.models.MainView;
+import androidtest.models.MenuList;
+import androidtest.models.NewFolderPopUp;
+import androidtest.models.RemoveConfirmationView;
+import androidtest.models.SettingsView;
+import androidtest.models.WaitAMomentPopUp;
+import androidtest.tests.Common;
+
+public class Actions {
+
+       public static MainView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException {
+               LoginForm loginForm = new LoginForm(driver);
+               CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url); 
+               if(!isTrusted){
+                       driver.runAppInBackground(3);
+                       WebDriverWait wait = new WebDriverWait(driver, 30);
+                       wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
+                       certificatePopUp.clickOnOkButton();
+               }
+               loginForm.typeUserName(user);
+               loginForm.typePassword(password);
+               //TODO. Assert related to check the connection?
+               return loginForm.clickOnConnectButton();
+       }
+
+       public static WaitAMomentPopUp createFolder(String folderName, MainView mainView){
+               NewFolderPopUp newFolderPopUp = mainView.clickOnNewFolderButton();
+               newFolderPopUp.typeNewFolderName(folderName);
+               WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton();
+               //TODO. assert here
+               return waitAMomentPopUp;
+       }
+
+
+       public static AndroidElement scrollTillFindElement (String elementName, AndroidElement element, AndroidDriver driver) {
+               AndroidElement fileElement;
+
+               if(element.getAttribute("scrollable").equals("true")){
+                       HashMap<String, String> scrollObject = new HashMap<String, String>();
+                       scrollObject.put("text", elementName);
+                       scrollObject.put("element", ( (RemoteWebElement) element).getId());
+                       driver.executeScript("mobile: scrollTo", scrollObject);
+               }
+               try {
+                       fileElement = (AndroidElement) driver.findElementByName(elementName);
+               } catch (NoSuchElementException e) {
+                       fileElement = null;
+               }
+               return fileElement;
+       }
+
+
+       public static void deleteAccount (MainView mainView) {  
+               MenuList menulist = mainView.clickOnMenuButton();
+               SettingsView settingView = menulist.clickOnSettingsButton();
+               deleteAccount(settingView);
+       }
+
+       public static void deleteAccount (SettingsView settingsView) {
+               settingsView.tapOnAccountElement(1, 1000);
+               settingsView.clickOnDeleteAccountElement();
+       }
+
+       public static void clickOnMainLayout(AndroidDriver driver){
+               driver.tap(1, 0, 0, 1);
+       }
+
+       //TODO. convert deleteFodler and deleteFile in deleteElement
+       public static AndroidElement deleteElement(String elementName,  MainView mainView, AndroidDriver driver) throws Exception{
+               AndroidElement fileElement;
+               WaitAMomentPopUp waitAMomentPopUp;
+               try{
+                       fileElement = (AndroidElement) driver.findElementByName(elementName);
+                       ElementMenuOptions menuOptions = mainView.longPressOnElement(elementName);
+                       RemoveConfirmationView removeConfirmationView = menuOptions.clickOnRemove();;
+                       waitAMomentPopUp = removeConfirmationView.clickOnRemoteAndLocalButton();
+                       Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               }catch(NoSuchElementException e){
+                       fileElement=null;
+               }
+               return fileElement;
+       }
+
+       public static MainView uploadFile(String elementName,  MainView mainView) throws InterruptedException{
+               mainView.clickOnUploadButton();
+               FilesView filesView = mainView.clickOnFilesElementUploadFile();
+               filesView.clickOnFileName(elementName);
+               MainView mainViewAfterUploadFile = filesView.clickOnUploadButton();
+               //TO DO. detect when the file is successfully uploaded
+               Thread.sleep(15000);
+               return mainViewAfterUploadFile; 
+       }
+
+
+}
diff --git a/automationTest/src/test/java/androidtest/models/AppDetailsView.java b/automationTest/src/test/java/androidtest/models/AppDetailsView.java
new file mode 100644 (file)
index 0000000..75ce4d9
--- /dev/null
@@ -0,0 +1,41 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+
+public class AppDetailsView {
+       final AndroidDriver driver;
+       
+       @CacheLookup
+       @AndroidFindBy(name = "Keep file up to date")
+       private AndroidElement keepFileUpToDateCheckbox;
+       
+       @AndroidFindBy(id = "com.owncloud.android:id/fdProgressBar")
+       private AndroidElement progressBar;
+       
+       public AppDetailsView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public void checkKeepFileUpToDateCheckbox () {
+               if(keepFileUpToDateCheckbox.getAttribute("checked").equals("false")){
+                       keepFileUpToDateCheckbox.click();
+               }
+       }
+       
+       public void unCheckKeepFileUpToDateCheckbox () {
+               if(keepFileUpToDateCheckbox.getAttribute("checked").equals("true")){
+                       keepFileUpToDateCheckbox.click();
+               }
+       }
+       
+       public AndroidElement getProgressBar (){
+               return progressBar;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/CertificatePopUp.java b/automationTest/src/test/java/androidtest/models/CertificatePopUp.java
new file mode 100644 (file)
index 0000000..dbcffcc
--- /dev/null
@@ -0,0 +1,29 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.PageFactory;
+
+public class CertificatePopUp {
+       final AndroidDriver driver;     
+       
+       @AndroidFindBy(name = "OK")
+       private AndroidElement okButton;
+       
+       public CertificatePopUp (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public void clickOnOkButton () {
+               okButton.click();
+       }
+       
+       public AndroidElement getOkButtonElement () {
+               return okButton;
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/models/ElementMenuOptions.java b/automationTest/src/test/java/androidtest/models/ElementMenuOptions.java
new file mode 100644 (file)
index 0000000..090e038
--- /dev/null
@@ -0,0 +1,55 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.PageFactory;
+
+public class ElementMenuOptions {
+
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(name = "Details")
+       private AndroidElement detailsFileElement;
+       
+       @AndroidFindBy(name = "Rename")
+       private AndroidElement renameFileElement;
+       
+       @AndroidFindBy(name = "Remove")
+       private AndroidElement removeFileElement;
+       
+       @AndroidFindBy(name = "Move")
+       private AndroidElement moveElement;
+       
+       public ElementMenuOptions (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public AppDetailsView clickOnDetails () {
+               detailsFileElement.click();
+               AppDetailsView appDetailsView = new AppDetailsView(driver);
+               return appDetailsView;
+       }
+       
+       public RemoveConfirmationView clickOnRemove () {
+               removeFileElement.click();
+               RemoveConfirmationView removeConfirmationView = new RemoveConfirmationView(driver);
+               return removeConfirmationView;
+       }
+       
+
+       public MoveView clickOnMove () {
+               moveElement.click();
+               MoveView moveView = new MoveView(driver);
+               return moveView;
+       }
+
+       public NewFolderPopUp clickOnRename () {
+               renameFileElement.click();
+               NewFolderPopUp newFolderPopUp = new NewFolderPopUp(driver);
+               return newFolderPopUp;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/FilesView.java b/automationTest/src/test/java/androidtest/models/FilesView.java
new file mode 100644 (file)
index 0000000..c913b10
--- /dev/null
@@ -0,0 +1,44 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+import androidtest.actions.Actions;
+
+public class FilesView{
+       final AndroidDriver driver;
+       
+       @CacheLookup
+       @AndroidFindBy(id = "com.owncloud.android:id/list_root")
+       private AndroidElement filesLayout;
+       
+       @CacheLookup
+       @AndroidFindBy(id = "com.owncloud.android:id/upload_files_btn_upload")
+       private AndroidElement uploadButton;
+       
+       private AndroidElement fileElement;
+       
+       public FilesView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public MainView clickOnUploadButton () {
+               uploadButton.click();
+               MainView mainView = new MainView (driver);
+               return mainView;
+       }
+       
+       //change to scrollTillFindElement
+       public void scrollTillFindFile (String fileName) {
+               fileElement = Actions.scrollTillFindElement (fileName,filesLayout,driver);
+       }
+       
+       public void clickOnFileName (String fileName) {
+               scrollTillFindFile(fileName);
+               fileElement.click();
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/LoginForm.java b/automationTest/src/test/java/androidtest/models/LoginForm.java
new file mode 100644 (file)
index 0000000..ea78102
--- /dev/null
@@ -0,0 +1,90 @@
+package androidtest.models;
+
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+public class LoginForm {
+       final AndroidDriver driver;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Server address\")")
+       private AndroidElement hostUrlInput;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Username\")")
+       private AndroidElement userNameInput;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Password\")")
+       private AndroidElement passwordInput;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Connect\")")
+       private AndroidElement connectButton;
+       
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Testing connection\")")
+       private AndroidElement serverStatusText;
+       
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Wrong username or password\")")
+       private AndroidElement authStatusText;
+       
+       public LoginForm (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+
+       public CertificatePopUp typeHostUrl (String hostUrl) {
+               hostUrlInput.clear();
+               hostUrlInput.sendKeys(hostUrl + "\n");
+               CertificatePopUp certificatePopUp = new CertificatePopUp(driver);
+               return certificatePopUp;
+       }
+       
+       public void clickOnUserName () {
+               userNameInput.click();
+       }
+       
+       public void typeUserName (String userName) {
+               userNameInput.clear();
+               userNameInput.sendKeys(userName);
+               driver.hideKeyboard();
+       }
+       
+       public void typePassword (String password) {
+               passwordInput.clear();
+               passwordInput.sendKeys(password);
+               driver.hideKeyboard();
+       }
+       
+       public MainView clickOnConnectButton () {
+               connectButton.click();
+               MainView mainView = new MainView(driver);
+               return mainView;
+       }
+       
+       public AndroidElement gethostUrlInput () {
+               return hostUrlInput;
+       }
+       
+       public AndroidElement getUserNameInput () {
+               return userNameInput;
+       }
+       
+       public AndroidElement getPasswordInput () {
+               return passwordInput;
+       }
+       
+       
+       public AndroidElement getServerStatusTextElement () {
+               return serverStatusText;
+       }
+       
+       public AndroidElement getAuthStatusText () {
+               return authStatusText;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/MainView.java b/automationTest/src/test/java/androidtest/models/MainView.java
new file mode 100644 (file)
index 0000000..6228f0e
--- /dev/null
@@ -0,0 +1,146 @@
+package androidtest.models;
+
+import java.util.List;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+
+import androidtest.actions.Actions;
+
+public class MainView {
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"More options\")")
+       private AndroidElement menuButton;
+       
+       @CacheLookup
+       @AndroidFindBy(id = "com.owncloud.android:id/list_root")
+       private AndroidElement filesLayout;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/action_bar_title\")")
+       private AndroidElement titleText;
+       
+       @AndroidFindBy(id = "android:id/progress_circular")
+       private AndroidElement progressCircular;
+
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"New folder\")")
+       private AndroidElement newFolderButton;
+       
+       @CacheLookup
+       @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Upload\")")
+       private AndroidElement uploadButton;
+       
+       private AndroidElement waitAMomentText;
+       
+       @AndroidFindBy(id = "com.owncloud.android:id/ListItemLayout")
+       private List<AndroidElement> listItemLayout;
+       
+       @AndroidFindBy(id = "com.owncloud.android:id/list_root")
+       private AndroidElement listRootLayout;
+       
+       @AndroidFindBy(name = "Files")
+       private AndroidElement filesElementUploadFile;
+       
+       private AndroidElement fileElement;
+       
+       private AndroidElement fileElementLayout;
+       
+       private static String localFileIndicator = "com.owncloud.android:id/localFileIndicator";
+       private static String favoriteFileIndicator = "com.owncloud.android:id/favoriteIcon";
+       
+       
+       public MainView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+
+       public MenuList clickOnMenuButton () {
+               menuButton.click();
+               MenuList menuList = new MenuList (driver);
+               return menuList;
+       }
+       
+       public SettingsView getSettingsView () {
+               SettingsView settingsView = new SettingsView(driver);
+               return settingsView;
+       }
+       
+       public NewFolderPopUp clickOnNewFolderButton () {
+               newFolderButton.click();
+               NewFolderPopUp newFolderPopUp = new NewFolderPopUp(driver);
+               return newFolderPopUp;
+       }
+       
+       public void clickOnUploadButton () {
+               uploadButton.click();
+       }
+       
+       public FilesView clickOnFilesElementUploadFile () {
+               filesElementUploadFile.click();
+               FilesView filesView = new FilesView(driver);
+               return filesView;
+       }
+       
+       public AndroidElement getTitleTextElement () {
+               return titleText;
+       }
+       
+       public AndroidElement getWaitAMomentTextElement () {
+               return waitAMomentText;
+       }
+       
+       public AndroidElement getListRootElement () {
+               return listRootLayout;
+       }
+       
+       public List<AndroidElement> getListItemLayout () {
+               return listItemLayout;
+       }
+       
+       public AndroidElement getFileElement () {
+               return fileElement;
+       }
+       
+       public ElementMenuOptions longPressOnElement (String elementName) {
+               scrollTillFindElement(elementName).tap(1, 1000);
+               //fileElement.tap(1, 1000);
+               ElementMenuOptions menuOptions = new ElementMenuOptions(driver);
+               return menuOptions;
+       }
+       
+       public AndroidElement scrollTillFindElement (String elementName) {
+        fileElement = Actions.scrollTillFindElement (elementName,filesLayout,driver);
+               try {
+               fileElementLayout = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"LinearLayout-"+ elementName +"\")");
+        } catch (NoSuchElementException e) {
+               fileElementLayout = null;
+        }
+               return fileElement;
+       }
+       
+       public AndroidElement getFileElementLayout () {
+               return fileElementLayout;
+       }
+       
+       public AndroidElement getProgressCircular () {
+               return progressCircular;
+       }
+       
+       public static String getLocalFileIndicator() {
+               return localFileIndicator;
+       }
+       
+       public static String getFavoriteFileIndicator() {
+               return favoriteFileIndicator;
+       }
+
+
+}
diff --git a/automationTest/src/test/java/androidtest/models/MenuList.java b/automationTest/src/test/java/androidtest/models/MenuList.java
new file mode 100644 (file)
index 0000000..466fa1c
--- /dev/null
@@ -0,0 +1,27 @@
+package androidtest.models;
+
+import org.openqa.selenium.support.PageFactory;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+public class MenuList {
+
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(name = "Settings")
+       private AndroidElement settingsButton;
+       
+       public MenuList (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public SettingsView clickOnSettingsButton () {
+               settingsButton.click();
+               SettingsView settingsView = new SettingsView(driver);
+               return settingsView;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/MoveView.java b/automationTest/src/test/java/androidtest/models/MoveView.java
new file mode 100644 (file)
index 0000000..f54ba28
--- /dev/null
@@ -0,0 +1,37 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+
+import androidtest.actions.Actions;
+
+public class MoveView {
+       final AndroidDriver driver;
+       
+       @CacheLookup
+       @AndroidFindBy(id = "com.owncloud.android:id/list_root")
+       private AndroidElement filesLayout;
+       
+       @AndroidFindBy(name = "Choose")
+       private AndroidElement chooseButton;
+       
+       public MoveView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public WaitAMomentPopUp clickOnChoose () {
+               chooseButton.click();
+               WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+               return waitAMomentPopUp;
+       }
+       
+       public  AndroidElement scrollTillFindElement (String elementName) {
+               return Actions.scrollTillFindElement (elementName,filesLayout,driver);
+       }
+}
\ No newline at end of file
diff --git a/automationTest/src/test/java/androidtest/models/NewFolderPopUp.java b/automationTest/src/test/java/androidtest/models/NewFolderPopUp.java
new file mode 100644 (file)
index 0000000..658130d
--- /dev/null
@@ -0,0 +1,36 @@
+package androidtest.models;
+
+import org.openqa.selenium.support.PageFactory;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+public class NewFolderPopUp {
+
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/button1\")")
+       private AndroidElement newFolderOkButton;
+       
+       @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"com.owncloud.android:id/user_input\")")
+       private AndroidElement newFolderNameField;
+       
+       public NewFolderPopUp (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+               
+       public void typeNewFolderName (String newFolderName) {
+               newFolderNameField.clear();
+               newFolderNameField.sendKeys(newFolderName);
+               driver.hideKeyboard();
+       }
+
+       public WaitAMomentPopUp clickOnNewFolderOkButton () {
+               newFolderOkButton.click();
+               WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+               return waitAMomentPopUp;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/RemoveConfirmationView.java b/automationTest/src/test/java/androidtest/models/RemoveConfirmationView.java
new file mode 100644 (file)
index 0000000..e9a1ba9
--- /dev/null
@@ -0,0 +1,26 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.PageFactory;
+
+public class RemoveConfirmationView {
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(name = "Remote and local")
+       private AndroidElement remoteAndLocalButton;
+       
+       public RemoveConfirmationView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public WaitAMomentPopUp clickOnRemoteAndLocalButton () {
+               remoteAndLocalButton.click();
+               WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+               return waitAMomentPopUp;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/models/SettingsView.java b/automationTest/src/test/java/androidtest/models/SettingsView.java
new file mode 100644 (file)
index 0000000..18c9c00
--- /dev/null
@@ -0,0 +1,59 @@
+package androidtest.models;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+import org.openqa.selenium.support.CacheLookup;
+import org.openqa.selenium.support.PageFactory;
+
+import androidtest.tests.Config;
+
+public class SettingsView {
+       final AndroidDriver driver;
+       
+       @CacheLookup
+       @AndroidFindBy(name = Config.userAccount)
+       private AndroidElement accountElement;
+       
+       @CacheLookup
+       @AndroidFindBy(name = Config.userAccount2)
+       private AndroidElement accountElement2;
+       
+       @AndroidFindBy(name = "Delete account")
+       private AndroidElement deleteAccountElement;
+       
+       @AndroidFindBy(name = "Change password")
+       private AndroidElement changePasswordElement;
+       
+       @AndroidFindBy(name = "Add account")
+       private AndroidElement addAccountElement;
+       
+       public SettingsView (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+
+       public void tapOnAccountElement (int fingers, int milliSeconds) {
+               accountElement.tap(fingers, milliSeconds);
+       }
+       
+       
+       public void tapOnAddAccount (int fingers, int milliSeconds) {
+               addAccountElement.tap(fingers, milliSeconds);
+       }
+       
+       public LoginForm clickOnDeleteAccountElement () {
+               deleteAccountElement.click();
+               LoginForm loginForm = new LoginForm(driver);
+               return loginForm;
+       }
+       
+       public LoginForm clickOnChangePasswordElement () {
+               changePasswordElement.click();
+               LoginForm loginForm = new LoginForm(driver);
+               return loginForm;
+       }
+       
+}
diff --git a/automationTest/src/test/java/androidtest/models/WaitAMomentPopUp.java b/automationTest/src/test/java/androidtest/models/WaitAMomentPopUp.java
new file mode 100644 (file)
index 0000000..f566e4a
--- /dev/null
@@ -0,0 +1,24 @@
+package androidtest.models;
+
+import org.openqa.selenium.support.PageFactory;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import io.appium.java_client.pagefactory.AndroidFindBy;
+import io.appium.java_client.pagefactory.AppiumFieldDecorator;
+
+public class WaitAMomentPopUp {
+       final AndroidDriver driver;
+       
+       @AndroidFindBy(name = "Wait a moment")
+       private AndroidElement waitAMomentText;
+       
+       public WaitAMomentPopUp (AndroidDriver driver) {
+               this.driver = driver;
+               PageFactory.initElements(new AppiumFieldDecorator(driver), this);
+       }
+       
+       public AndroidElement getWaitAMomentTextElement () {
+               return waitAMomentText;
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/tests/.gitignore b/automationTest/src/test/java/androidtest/tests/.gitignore
new file mode 100644 (file)
index 0000000..fa0f66d
--- /dev/null
@@ -0,0 +1 @@
+Config.java
\ No newline at end of file
diff --git a/automationTest/src/test/java/androidtest/tests/Common.java b/automationTest/src/test/java/androidtest/tests/Common.java
new file mode 100644 (file)
index 0000000..c457d20
--- /dev/null
@@ -0,0 +1,105 @@
+package androidtest.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.io.FileUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TimeoutException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.remote.Augmenter;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.AndroidElement;
+import junit.framework.TestCase;
+
+public class Common extends TestCase{
+       AndroidDriver driver;
+       static int waitingTime = 30;
+       
+       WebDriverWait wait;
+       
+       protected void setUpCommonDriver () throws Exception {
+               File rootPath = new File(System.getProperty("user.dir"));
+               File appDir = new File(rootPath,"src/test/resources");
+               File app = new File(appDir,"ownCloud.apk");
+               DesiredCapabilities capabilities = new DesiredCapabilities();
+               capabilities.setCapability("platformName", "Android");
+               capabilities.setCapability("deviceName", "Device");
+               capabilities.setCapability("app", app.getAbsolutePath());
+               capabilities.setCapability("app-package", "com.owncloud.android");
+               capabilities.setCapability("app-activity", ".ui.activity.FileDisplayActivity"); 
+               capabilities.setCapability("appWaitActivity", ".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);
+
+       }
+       
+       protected boolean waitForTextPresent(String text, AndroidElement element) throws InterruptedException{
+               for (int second = 0;;second++){ 
+                       if (second >= waitingTime)
+                               return false;
+                       try{
+                               if (text.equals(element.getText()))
+                                       break;
+                       } catch (Exception e){
+                               
+                       }
+                       Thread.sleep(1000);
+               }
+               return true;
+       }
+       
+       protected boolean isElementPresent(AndroidElement element, By by) {
+               try {
+                       element.findElement(by);
+                       return true;
+               } catch (NoSuchElementException e) {
+                       return false;
+               }
+       }
+       
+       protected boolean isElementPresent(AndroidElement element) {
+               try{
+                       element.isDisplayed();
+               } catch (NoSuchElementException e){
+                       return false;
+               }
+               return true;
+       }
+       
+       //pollingTime in milliseconds
+       public static void waitTillElementIsNotPresent (AndroidElement element, int pollingTime) throws Exception {
+               for (int time = 0;;time += pollingTime){        
+                       if (time >= waitingTime * 1000) //convert to milliseconds
+                               break;
+                       try{
+                               element.isDisplayed();
+                       } catch (NoSuchElementException e){
+                               return;
+                       }
+                       Thread.sleep(pollingTime);
+               }
+               throw new TimeoutException();
+       }
+       
+       protected void takeScreenShotOnFailed (String testName) throws IOException {
+               File file  = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE);
+               SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
+               Date today = Calendar.getInstance().getTime(); 
+               String screenShotName = "ScreenShots/" + dt1.format(today) + "/" + testName + ".png";
+               FileUtils.copyFile(file, new File(screenShotName));
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/Config.java b/automationTest/src/test/java/androidtest/tests/Config.java
new file mode 100644 (file)
index 0000000..5f5da2b
--- /dev/null
@@ -0,0 +1,29 @@
+package androidtest.tests;
+
+public final class Config {
+       
+       public static final String server = "owncloudServerVar";
+       public static final Boolean hasResource = false;
+       public static String URL = GetURl(server, hasResource, "resourceServerVar");
+       public static boolean isTrusted = true;
+       
+       public static final String server2 = "owncloudServer2Var";
+       public static final Boolean hasResource2 = false;
+       public static String URL2 = GetURl(server2, hasResource2, "resourceServerVar");
+       public static boolean isTrusted2 = true;
+       
+       public static final String user = "owncloudUserVar";
+       public static final String password = "owncloudPasswordVar";
+       public static final String user2 = "owncloudUser2Var";
+       public static final String password2 = "owncloudPassword2Var";
+       public static final String userAccount = user + "@"+ server;
+       public static final String userAccount2 = user2 + "@"+ server2;
+       
+       public static String GetURl(String server, Boolean hasSubdirectory, String serverResource){
+               if(hasSubdirectory){
+                       return server + serverResource;
+               }else{
+                       return server;
+               }
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/tests/CreateFolderTestSuite.java b/automationTest/src/test/java/androidtest/tests/CreateFolderTestSuite.java
new file mode 100644 (file)
index 0000000..ad72e36
--- /dev/null
@@ -0,0 +1,56 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+
+import androidtest.actions.Actions;
+import androidtest.models.MainView;
+import androidtest.models.WaitAMomentPopUp;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CreateFolderTestSuite extends Common{
+       
+       private Boolean folderHasBeenCreated = false;
+       private final String FOLDER_NAME = "testCreateFolder";
+       private String CurrentCreatedFolder = "";
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testCreateNewFolder () throws Exception {
+               String NEW_FOLDER_NAME = "testCreateFolder";
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+
+               //check if the folder already exists and if true, delete them
+               Actions.deleteElement(NEW_FOLDER_NAME, mainView, driver);
+
+               WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(NEW_FOLDER_NAME, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_NAME);
+               assertNotNull(mainView.getFileElement());
+               assertTrue(folderHasBeenCreated=mainView.getFileElement().isDisplayed());       
+               CurrentCreatedFolder = FOLDER_NAME;
+               assertEquals(FOLDER_NAME , mainView.getFileElement().getText());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               if (folderHasBeenCreated) {
+                       MainView mainView = new MainView(driver);
+                       Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
+               }
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/DeleteFileTestSuite.java b/automationTest/src/test/java/androidtest/tests/DeleteFileTestSuite.java
new file mode 100644 (file)
index 0000000..a07bb97
--- /dev/null
@@ -0,0 +1,48 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import androidtest.actions.Actions;
+import androidtest.models.MainView;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class DeleteFileTestSuite extends Common{
+       
+       private final String FILE_NAME = "test";
+       
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testDeleteFile () throws Exception {                
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               waitForTextPresent("ownCloud", mainView.getTitleTextElement());
+               
+               //TODO. if the file already exists, do not upload
+               MainView mainViewAfterUploadFile = Actions.uploadFile(FILE_NAME, mainView);
+               
+               mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               waitTillElementIsNotPresent(mainViewAfterUploadFile.getProgressCircular(), 1000);
+               wait.until(ExpectedConditions.visibilityOf(mainViewAfterUploadFile.getFileElementLayout().findElement(By.id(MainView.getLocalFileIndicator()))));
+               
+               Actions.deleteElement(FILE_NAME,mainViewAfterUploadFile, driver);
+               assertFalse(mainViewAfterUploadFile.getFileElement().isDisplayed());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
\ No newline at end of file
diff --git a/automationTest/src/test/java/androidtest/tests/DeleteFolderTestSuite.java b/automationTest/src/test/java/androidtest/tests/DeleteFolderTestSuite.java
new file mode 100644 (file)
index 0000000..f015c1e
--- /dev/null
@@ -0,0 +1,53 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+
+import androidtest.actions.Actions;
+import androidtest.models.MainView;
+import androidtest.models.WaitAMomentPopUp;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class DeleteFolderTestSuite extends Common{
+       private Boolean folderHasBeenCreated = false;
+       private final String FOLDER_NAME = "testCreateFolder";
+
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testDeleteFolder () throws Exception {
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               waitForTextPresent("ownCloud", mainView.getTitleTextElement());
+               
+               //TODO. if the folder already exists, do no created
+               //create the folder
+               WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(FOLDER_NAME, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_NAME);
+               assertTrue(folderHasBeenCreated = mainView.getFileElement().isDisplayed());
+
+               //delete the folder
+               Actions.deleteElement(FOLDER_NAME, mainView, driver);
+               assertFalse(folderHasBeenCreated =mainView.getFileElement().isDisplayed());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               if(folderHasBeenCreated){
+                       MainView mainView = new MainView(driver);
+                       Actions.deleteElement(FOLDER_NAME, mainView, driver);
+               }
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/LoginTestSuite.java b/automationTest/src/test/java/androidtest/tests/LoginTestSuite.java
new file mode 100644 (file)
index 0000000..0d2553a
--- /dev/null
@@ -0,0 +1,97 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.openqa.selenium.ScreenOrientation;
+import androidtest.actions.Actions;
+import androidtest.models.LoginForm;
+import androidtest.models.MainView;
+import androidtest.models.MenuList;
+import androidtest.models.SettingsView;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class LoginTestSuite extends Common{
+
+       @Before
+       public void setUp() throws Exception {
+                       setUpCommonDriver();
+       }
+       
+       @Test
+       public void test1LoginPortrait () throws Exception {
+               driver.rotate(ScreenOrientation.PORTRAIT);
+               
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+       }
+       
+       @Test
+       public void test2LoginLandscape () throws Exception {
+               driver.rotate(ScreenOrientation.LANDSCAPE);
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+               //TO DO. detect in which view is. it can be files view or settings view
+       }
+       
+       
+       @Test
+       public void test3MultiAccountRotate () throws Exception {
+               driver.rotate(ScreenOrientation.LANDSCAPE);
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+               
+               driver.rotate(ScreenOrientation.PORTRAIT);
+               MenuList menu = mainView.clickOnMenuButton();
+               SettingsView settingsView = menu.clickOnSettingsButton();
+               settingsView.tapOnAddAccount(1, 1000);
+               mainView = Actions.login(Config.URL2, Config.user2,Config.password2, Config.isTrusted2, driver);
+               
+               assertTrue(waitForTextPresent("Settings", mainView.getTitleTextElement()));
+               //TO DO. detect in which view is. it can be files view or settings view
+               //Actions.deleteAccount(mainView);
+               //TO DO. Delete the second user
+       }
+       
+       @Test
+       public void test4ExistingAccountRotate () throws Exception {
+               driver.rotate(ScreenOrientation.PORTRAIT);
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+               
+               driver.rotate(ScreenOrientation.LANDSCAPE);
+               MenuList menu = mainView.clickOnMenuButton();
+               SettingsView settingsView = menu.clickOnSettingsButton();
+               settingsView.tapOnAddAccount(1, 1000);
+               
+               LoginForm loginForm = new LoginForm(driver);
+               mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);    
+               assertTrue(waitForTextPresent("An account for the same user and server already exists in the device", loginForm.getAuthStatusText()));
+       }
+       
+
+       public void test5ChangePasswordWrong () throws Exception {
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+               MenuList menu = mainView.clickOnMenuButton();
+               SettingsView settingsView = menu.clickOnSettingsButton();
+               settingsView.tapOnAccountElement(1, 1000);
+               LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement();
+               changePasswordForm.typePassword("WrongPassword");
+               changePasswordForm.clickOnConnectButton();
+               assertTrue(waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText()));
+       }
+       
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+       
+       
+}
diff --git a/automationTest/src/test/java/androidtest/tests/LogoutTestSuite.java b/automationTest/src/test/java/androidtest/tests/LogoutTestSuite.java
new file mode 100644 (file)
index 0000000..f9f5402
--- /dev/null
@@ -0,0 +1,40 @@
+package androidtest.tests;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import androidtest.actions.Actions;
+import androidtest.models.LoginForm;
+import androidtest.models.MainView;
+import androidtest.models.MenuList;
+import androidtest.models.SettingsView;
+
+public class LogoutTestSuite extends Common{
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testLogout () throws Exception {
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               waitForTextPresent("ownCloud", mainView.getTitleTextElement());
+               MenuList menulist = mainView.clickOnMenuButton();
+               SettingsView settingsView = menulist.clickOnSettingsButton();
+               settingsView.tapOnAccountElement(1, 1000);
+               LoginForm loginForm = settingsView.clickOnDeleteAccountElement();
+               assertEquals("Server address https://…", loginForm.gethostUrlInput().getText());
+               assertEquals("Username", loginForm.getUserNameInput().getText());
+               assertEquals("", loginForm.getPasswordInput().getText());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+}
diff --git a/automationTest/src/test/java/androidtest/tests/MoveFileTestSuite.java b/automationTest/src/test/java/androidtest/tests/MoveFileTestSuite.java
new file mode 100644 (file)
index 0000000..502d45f
--- /dev/null
@@ -0,0 +1,79 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import androidtest.actions.Actions;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.MainView;
+import androidtest.models.MoveView;
+import androidtest.models.WaitAMomentPopUp;
+
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class MoveFileTestSuite extends Common{
+       private String FOLDER_WHERE_MOVE = "folderWhereMove";
+       private String FILE_NAME = "test";
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testMoveFile () throws Exception {
+               WaitAMomentPopUp waitAMomentPopUp;
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+
+               waitTillElementIsNotPresent(mainView.getProgressCircular(), 1000);
+
+               //check if the folder already exists and if true, delete them
+               Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
+               Actions.deleteElement(FILE_NAME, mainView, driver);
+
+               //Create the folder where the other is gone to be moved
+               waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_WHERE_MOVE);
+               assertTrue(mainView.getFileElement().isDisplayed());
+
+               MainView mainViewAfterUploadFile = Actions.uploadFile(FILE_NAME, mainView);
+               mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertTrue(mainViewAfterUploadFile.getFileElement().isDisplayed());
+
+               //select to move the file
+               ElementMenuOptions menuOptions = mainView.longPressOnElement(FILE_NAME);
+               MoveView moveView = menuOptions.clickOnMove();
+
+               //to move to a folder
+               moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
+               waitAMomentPopUp = moveView.clickOnChoose();
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+
+               //check that the folder moved is inside the other
+               mainView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
+               waitTillElementIsNotPresent(mainView.getProgressCircular(), 1000);
+               Thread.sleep(1000);
+               mainView.scrollTillFindElement(FILE_NAME);
+               assertEquals(FILE_NAME , mainView.getFileElement().getText());
+
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               MainView mainView = new MainView(driver);
+               driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
+               Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
+               Actions.deleteElement(FILE_NAME, mainView, driver);
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/MoveFolderTestSuite.java b/automationTest/src/test/java/androidtest/tests/MoveFolderTestSuite.java
new file mode 100644 (file)
index 0000000..5b835d3
--- /dev/null
@@ -0,0 +1,79 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import androidtest.actions.Actions;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.MainView;
+import androidtest.models.MoveView;
+import androidtest.models.WaitAMomentPopUp;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class MoveFolderTestSuite extends Common{
+       private String FOLDER_TO_MOVE = "folderToMove";
+       private String FOLDER_WHERE_MOVE = "folderWhereMove";
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testMoveFolder () throws Exception {
+               WaitAMomentPopUp waitAMomentPopUp;
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+
+               waitTillElementIsNotPresent(mainView.getProgressCircular(), 1000);
+
+               //check if the folder already exists and if true, delete them
+               Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
+               Actions.deleteElement(FOLDER_TO_MOVE, mainView, driver);
+
+               //Create the folder where the other is gone to be moved
+               waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_WHERE_MOVE);
+               assertTrue(mainView.getFileElement().isDisplayed());
+
+               //Create the folder which is going to be moved
+               waitAMomentPopUp = Actions.createFolder(FOLDER_TO_MOVE, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_TO_MOVE);
+               assertTrue(mainView.getFileElement().isDisplayed());
+
+               //select to move the folder
+               ElementMenuOptions menuOptions = mainView.longPressOnElement(FOLDER_TO_MOVE);
+               MoveView moveView = menuOptions.clickOnMove();
+
+               //to move to a folder
+               moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
+               waitAMomentPopUp = moveView.clickOnChoose();
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               
+               //check that the folder moved is inside the other
+               mainView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
+               waitTillElementIsNotPresent(mainView.getProgressCircular(), 1000);
+               Thread.sleep(1000);
+               mainView.scrollTillFindElement(FOLDER_TO_MOVE);
+               assertEquals(FOLDER_TO_MOVE , mainView.getFileElement().getText());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               MainView mainView = new MainView(driver);
+               driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
+               Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
+               Actions.deleteElement(FOLDER_TO_MOVE, mainView, driver);
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java b/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java
new file mode 100644 (file)
index 0000000..4909fbb
--- /dev/null
@@ -0,0 +1,71 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import androidtest.actions.Actions;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.MainView;
+import androidtest.models.NewFolderPopUp;
+import androidtest.models.WaitAMomentPopUp;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class RenameFileTestSuite extends Common{
+
+       private Boolean fileHasBeenCreated = false;
+       private final String OLD_FILE_NAME = "test";
+       private final String FILE_NAME = "newNameFile";
+       private String CurrentCreatedFile = "";
+
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testRenameFile () throws Exception {
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               waitForTextPresent("ownCloud", mainView.getTitleTextElement());
+
+               //TODO. if the file already exists, do not upload
+               MainView mainViewAfterUploadFile = Actions.uploadFile(OLD_FILE_NAME, mainView);
+
+               //check if the file with the new name already exists, if true delete it
+               Actions.deleteElement(FILE_NAME, mainView, driver);
+
+               mainViewAfterUploadFile.scrollTillFindElement(OLD_FILE_NAME);
+               assertTrue(fileHasBeenCreated = mainViewAfterUploadFile.getFileElement().isDisplayed());
+               CurrentCreatedFile = OLD_FILE_NAME;
+               waitTillElementIsNotPresent(mainViewAfterUploadFile.getProgressCircular(), 1000);
+               wait.until(ExpectedConditions.visibilityOf(mainViewAfterUploadFile.getFileElementLayout().findElement(By.id(MainView.getLocalFileIndicator()))));
+               ElementMenuOptions menuOptions = mainViewAfterUploadFile.longPressOnElement(OLD_FILE_NAME);
+               NewFolderPopUp newFolderPopUp = menuOptions.clickOnRename();
+               newFolderPopUp.typeNewFolderName(FILE_NAME);
+               WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton();
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertNotNull(mainViewAfterUploadFile.getFileElement());
+               assertTrue(mainViewAfterUploadFile.getFileElement().isDisplayed());     
+               assertEquals(FILE_NAME , mainViewAfterUploadFile.getFileElement().getText());
+               CurrentCreatedFile = FILE_NAME;
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               if (fileHasBeenCreated) {
+                       MainView mainView = new MainView(driver);
+                       Actions.deleteElement(CurrentCreatedFile,mainView, driver);
+               }
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/RenameFolderTestSuite.java b/automationTest/src/test/java/androidtest/tests/RenameFolderTestSuite.java
new file mode 100644 (file)
index 0000000..24c6484
--- /dev/null
@@ -0,0 +1,69 @@
+package androidtest.tests;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import androidtest.actions.Actions;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.MainView;
+import androidtest.models.NewFolderPopUp;
+import androidtest.models.WaitAMomentPopUp;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class RenameFolderTestSuite extends Common{
+
+       private Boolean folderHasBeenCreated = false;
+       private final String OLD_FOLDER_NAME = "beforeRemoving";
+       private final String FOLDER_NAME = "testCreateFolder";
+       private String CurrentCreatedFolder = "";
+
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void testRenameFolder () throws Exception {
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               waitForTextPresent("ownCloud", mainView.getTitleTextElement());
+
+               //TODO. if the folder already exists, do no created
+               //create the folder to rename
+               WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(OLD_FOLDER_NAME, mainView);
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(OLD_FOLDER_NAME);
+
+               assertTrue(folderHasBeenCreated = mainView.getFileElement().isDisplayed());
+
+               //check if the folder with the new name already exists and if true, delete them
+               Actions.deleteElement(FOLDER_NAME, mainView, driver);
+
+               CurrentCreatedFolder = OLD_FOLDER_NAME;
+               ElementMenuOptions menuOptions = mainView.longPressOnElement(OLD_FOLDER_NAME);
+               NewFolderPopUp FolderPopUp = menuOptions.clickOnRename();
+               FolderPopUp.typeNewFolderName(FOLDER_NAME);
+               FolderPopUp.clickOnNewFolderOkButton();
+               CurrentCreatedFolder = FOLDER_NAME;
+               waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+               mainView.scrollTillFindElement(FOLDER_NAME);
+               assertNotNull(mainView.getFileElement());
+               assertTrue(folderHasBeenCreated = mainView.getFileElement().isDisplayed());     
+               assertEquals(FOLDER_NAME , mainView.getFileElement().getText());
+       }
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               if(folderHasBeenCreated){
+                       MainView mainView = new MainView(driver);
+                       Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
+               }
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+}
diff --git a/automationTest/src/test/java/androidtest/tests/UploadTestSuite.java b/automationTest/src/test/java/androidtest/tests/UploadTestSuite.java
new file mode 100644 (file)
index 0000000..6038930
--- /dev/null
@@ -0,0 +1,82 @@
+package androidtest.tests;
+
+
+import io.appium.java_client.MobileBy;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.MethodSorters;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import androidtest.actions.Actions;
+import androidtest.models.AppDetailsView;
+import androidtest.models.ElementMenuOptions;
+import androidtest.models.MainView;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class UploadTestSuite extends Common{
+
+       String FILE_NAME = "test";
+
+       @Before
+       public void setUp() throws Exception {
+               setUpCommonDriver();
+       }
+
+       @Test
+       public void test1UploadFile () throws Exception {
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+
+               //check if the file already exists and if true, delete it
+               Actions.deleteElement(FILE_NAME, mainView, driver);
+
+               MainView mainViewAfterUploadFile = Actions.uploadFile(FILE_NAME, mainView);
+
+               mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertTrue(mainViewAfterUploadFile.getFileElement().isDisplayed());
+               waitTillElementIsNotPresent(mainViewAfterUploadFile.getProgressCircular(), 1000);
+               wait.until(ExpectedConditions.visibilityOf(mainViewAfterUploadFile.getFileElementLayout().findElement(By.id(MainView.getLocalFileIndicator()))));
+
+
+       }
+
+       @Test
+       public void test2KeepFileUpToDate () throws Exception {
+
+               MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
+               assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
+
+               waitTillElementIsNotPresent(mainView.getProgressCircular(), 1000);
+
+               MainView mainViewAfterUploadFile = Actions.uploadFile(FILE_NAME, mainView);
+               mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertTrue(mainViewAfterUploadFile.getFileElement().isDisplayed());
+
+               ElementMenuOptions menuOptions = mainViewAfterUploadFile.longPressOnElement(FILE_NAME);
+               AppDetailsView appDetailsView = menuOptions.clickOnDetails();
+               appDetailsView.checkKeepFileUpToDateCheckbox();
+               Thread.sleep(3000);
+               driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
+               assertTrue(isElementPresent(mainViewAfterUploadFile.getFileElementLayout(), MobileBy.id(MainView.getFavoriteFileIndicator())));
+
+       }
+
+
+       @After
+       public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
+               MainView mainView = new MainView(driver);
+               Actions.deleteElement(FILE_NAME,mainView, driver);
+               driver.removeApp("com.owncloud.android");
+               driver.quit();
+       }
+
+
+}
+
index 5d16b07..d242954 100644 (file)
@@ -21,7 +21,7 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"
     android:background="#F7F7F7"
-    android:orientation="vertical" >
+    android:orientation="vertical">
 
     <TextView 
         android:layout_width="fill_parent"
index 5d62c13..3f3617b 100644 (file)
@@ -23,6 +23,8 @@
     android:background="@color/background_color"\r
     android:orientation="horizontal"\r
     android:baselineAligned="false"\r
+    android:id="@+id/ListLayout"\r
+    android:contentDescription="@string/list_layout"\r
     >\r
 \r
        <FrameLayout \r
index a85beaf..c8c1ad7 100644 (file)
@@ -78,6 +78,7 @@
     <string name="filedetails_download">Download</string>
     <string name="filedetails_sync_file">Refresh file</string>
     <string name="filedetails_renamed_in_upload_msg">File was renamed to %1$s during upload</string>
+    <string name="list_layout">List Layout</string>
     <string name="action_share_file">Share link</string>
     <string name="action_unshare_file">Unshare link</string>
     <string name="common_yes">Yes</string>