unshare link test case
authorpurigarcia <pgarcia@solidgear.es>
Thu, 28 May 2015 15:31:47 +0000 (17:31 +0200)
committerpurigarcia <pgarcia@solidgear.es>
Thu, 28 May 2015 15:31:47 +0000 (17:31 +0200)
14 files changed:
automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java
automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java

index 6d59217..c2349c4 100644 (file)
@@ -22,18 +22,18 @@ package com.owncloud.android.test.ui.actions;
 
 import java.util.HashMap;
 
+import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.ScreenOrientation;
 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 com.owncloud.android.test.ui.models.CertificatePopUp;
 import com.owncloud.android.test.ui.models.ElementMenuOptions;
+import com.owncloud.android.test.ui.models.GmailSendMailView;
+import com.owncloud.android.test.ui.models.ShareView;
 import com.owncloud.android.test.ui.models.UploadFilesView;
 import com.owncloud.android.test.ui.models.LoginForm;
 import com.owncloud.android.test.ui.models.FileListView;
@@ -43,6 +43,7 @@ import com.owncloud.android.test.ui.models.RemoveConfirmationView;
 import com.owncloud.android.test.ui.models.SettingsView;
 import com.owncloud.android.test.ui.models.WaitAMomentPopUp;
 import com.owncloud.android.test.ui.testSuites.Common;
+import com.owncloud.android.test.ui.testSuites.Config;
 
 public class Actions {
 
@@ -120,7 +121,7 @@ public class Actions {
                driver.tap(1, 0, 0, 1);
        }
 
-       //TODO. convert deleteFodler and deleteFile in deleteElement
+
        public static AndroidElement deleteElement(String elementName,  
                        FileListView fileListView, AndroidDriver driver) throws Exception{
                AndroidElement fileElement;
@@ -136,16 +137,97 @@ public class Actions {
                                        .longPressOnElement(elementName);
                        RemoveConfirmationView removeConfirmationView = menuOptions
                                        .clickOnRemove();;
-                       waitAMomentPopUp = removeConfirmationView
-                                       .clickOnRemoteAndLocalButton();
-                       Common.waitTillElementIsNotPresent(
-                                       waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+                                       waitAMomentPopUp = removeConfirmationView
+                                                       .clickOnRemoteAndLocalButton();
+                                       Common.waitTillElementIsNotPresent(
+                                                       waitAMomentPopUp.getWaitAMomentTextElement(), 100);
                }catch(NoSuchElementException e){
                        fileElement=null;
                }
                return fileElement;
        }
 
+       public static AndroidElement shareLinkElementByGmail(String elementName,  
+                       FileListView fileListView, AndroidDriver driver, Common common) 
+                                       throws Exception{
+               try{
+                       //To open directly the "file list view" and
+                       //we don't need to know in which view we are
+                       driver.startActivity("com.owncloud.android",
+                                       ".ui.activity.FileDisplayActivity");
+                       ElementMenuOptions menuOptions = fileListView
+                                       .longPressOnElement(elementName);
+                       ShareView shareView = menuOptions.clickOnShareLinkElement();
+                       Actions.scrollTillFindElement("Gmail", shareView
+                                       .getListViewLayout(), driver).click();
+                       GmailSendMailView gmailSendMailView = new GmailSendMailView(driver);
+                       gmailSendMailView.typeToEmailAdress(Config.gmailAccount);
+                       gmailSendMailView.clickOnSendButton();
+                       Common.waitTillElementIsNotPresentWithoutTimeout(fileListView
+                                       .getProgressCircular(), 1000);
+                       common.wait.until(ExpectedConditions.visibilityOf(
+                                       fileListView.getFileElementLayout()
+                                       .findElement(By.id(FileListView
+                                                       .getSharedElementIndicator()))));
+
+               }catch(NoSuchElementException e){
+                       return null;
+               }
+               return (AndroidElement) fileListView.getFileElementLayout()
+                               .findElement(By.id(FileListView.getSharedElementIndicator()));
+       }
+
+       public static AndroidElement shareLinkElementByCopyLink(String elementName,  
+                       FileListView fileListView, AndroidDriver driver, Common common) 
+                                       throws Exception{
+               try{
+                       //To open directly the "file list view" and
+                       //we don't need to know in which view we are
+                       driver.startActivity("com.owncloud.android",
+                                       ".ui.activity.FileDisplayActivity");
+                       ElementMenuOptions menuOptions = fileListView
+                                       .longPressOnElement(elementName);
+                       ShareView shareView = menuOptions.clickOnShareLinkElement();
+                       Actions.scrollTillFindElement("Copy link", shareView.getListViewLayout(), 
+                                       driver).click();
+                       WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+                       Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
+                                       .getWaitAMomentTextElement(), 100);
+                       common.wait.until(ExpectedConditions.visibilityOf(
+                                       fileListView.getFileElementLayout()
+                                       .findElement(By.id(FileListView.getSharedElementIndicator()))));
+               }catch(NoSuchElementException e){
+                       return null;
+               }
+               return (AndroidElement) fileListView.getFileElementLayout()
+                               .findElement(By.id(FileListView.getSharedElementIndicator()));
+       }
+       
+       
+       public static void unshareLinkElement(String elementName,  
+                       FileListView fileListView, AndroidDriver driver, Common common) 
+                                       throws Exception{
+               try{
+                       //To open directly the "file list view" and
+                       //we don't need to know in which view we are
+                       driver.startActivity("com.owncloud.android",
+                                       ".ui.activity.FileDisplayActivity");
+                       ElementMenuOptions menuOptions = fileListView
+                                       .longPressOnElement(elementName);
+                       WaitAMomentPopUp waitAMomentPopUp = menuOptions
+                                       .clickOnUnshareLinkElement();
+                       Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
+                                       .getWaitAMomentTextElement(), 100);
+                       Common.waitTillElementIsNotPresent((AndroidElement) fileListView
+                                       .getFileElementLayout()
+                                       .findElement(By.id(FileListView.getSharedElementIndicator())
+                                       ),100);
+               }catch(NoSuchElementException e){
+
+               }
+       }
+
+
        public static FileListView uploadFile(String elementName,
                        FileListView fileListView) throws InterruptedException{
                fileListView.clickOnUploadButton();
index ccf9bd4..7480360 100644 (file)
@@ -34,6 +34,9 @@ public class ElementMenuOptions {
        @AndroidFindBy(name = "Share link")
        private AndroidElement shareLinkElement;
        
+       @AndroidFindBy(name = "Unshare link")
+       private AndroidElement unshareLinkElement;
+       
        @AndroidFindBy(name = "Details")
        private AndroidElement detailsFileElement;
        
@@ -82,4 +85,10 @@ public class ElementMenuOptions {
                ShareView shareView = new ShareView(driver);
                return shareView;
        }
+       
+       public WaitAMomentPopUp clickOnUnshareLinkElement () {
+               unshareLinkElement.click();
+               WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+               return waitAMomentPopUp;
+       }
 }
index 6a40be2..1baa30b 100644 (file)
@@ -21,6 +21,7 @@
 package com.owncloud.android.test.ui.testSuites;
 
 import static org.junit.Assert.*;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
@@ -28,6 +29,7 @@ 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;
@@ -36,6 +38,7 @@ import org.openqa.selenium.TimeoutException;
 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;
 
@@ -43,7 +46,7 @@ public class Common{
        AndroidDriver driver;
        static int waitingTime = 30;
 
-       WebDriverWait wait;
+       public WebDriverWait wait;
 
        protected AndroidDriver setUpCommonDriver () throws Exception {
                File rootPath = new File(System.getProperty("user.dir"));
@@ -104,9 +107,7 @@ public class Common{
        //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;
+               for (int time = 0;time <= waitingTime * 1000;time += pollingTime){      
                        try{
                                element.isDisplayed();
                        } catch (NoSuchElementException e){
@@ -117,6 +118,19 @@ public class Common{
                throw new TimeoutException();
        }
 
+       public static void waitTillElementIsNotPresentWithoutTimeout (
+                       AndroidElement element,int pollingTime) 
+                                       throws InterruptedException {
+               for (int time = 0;time <= waitingTime * 1000;time += pollingTime){      
+                       try{
+                               element.isDisplayed();
+                       } catch (NoSuchElementException e){
+                               return;
+                       }
+                       Thread.sleep(pollingTime);
+               }
+       }
+
        protected void takeScreenShotOnFailed (String testName) 
                        throws IOException {
                File file  = ((RemoteWebDriver) driver)
@@ -124,7 +138,7 @@ public class Common{
                SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
                Date today = Calendar.getInstance().getTime(); 
                String screenShotName = "ScreenShots/" + dt1.format(today) + "/"
-                   + testName + ".png";
+                               + testName + ".png";
                FileUtils.copyFile(file, new File(screenShotName));
        }
 
@@ -151,7 +165,7 @@ public class Common{
                }
                assertNull(fileElement);
        }
-       
+
        protected void assertIsPasscodeRequestView() throws InterruptedException {
                assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
                                .findElementByAndroidUIAutomator("new UiSelector()"
index d9d5b27..1394875 100644 (file)
@@ -70,7 +70,7 @@ public class CreateFolderTestSuite{
 
                WaitAMomentPopUp waitAMomentPopUp = Actions
                                .createFolder(NEW_FOLDER_NAME, fileListView);
-               Common.waitTillElementIsNotPresent(waitAMomentPopUp
+               Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
                                .getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(FOLDER_NAME);
                assertNotNull(fileListView.getFileElement());
index af6e37d..5970ec9 100644 (file)
@@ -67,7 +67,7 @@ public class DeleteFileTestSuite{
                                .uploadFile(FILE_NAME, fileListView);
                
                fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                fileListViewAfterUploadFile.getProgressCircular(), 1000);
                common.wait.until(ExpectedConditions.visibilityOf(
                                fileListViewAfterUploadFile.getFileElementLayout()
index 5e0e2cd..375de02 100644 (file)
@@ -66,7 +66,7 @@ public class DeleteFolderTestSuite{
                //create the folder
                WaitAMomentPopUp waitAMomentPopUp = Actions
                                .createFolder(FOLDER_NAME, fileListView);
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                waitAMomentPopUp.getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(FOLDER_NAME);
                assertTrue(
index 4c6c4cc..c017bcf 100644 (file)
@@ -58,7 +58,7 @@ public class LoginTestSuite{
        public void test1LoginPortrait () throws Exception {
                driver.rotate(ScreenOrientation.PORTRAIT);
                
-               FileListView fileListView = Actions.login(Config.URL, Config.user,
+               Actions.login(Config.URL, Config.user,
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
        }
@@ -67,7 +67,7 @@ public class LoginTestSuite{
        @Category({NoIgnoreTestCategory.class})
        public void test2LoginLandscape () throws Exception {
                driver.rotate(ScreenOrientation.LANDSCAPE);
-               FileListView fileListView = Actions.login(Config.URL, Config.user,
+               Actions.login(Config.URL, Config.user,
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
        }
index d950d41..38c004b 100644 (file)
@@ -65,7 +65,7 @@ public class MoveFileTestSuite{
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
 
-               //Common.waitTillElementIsNotPresent(
+               //Common.waitTillElementIsNotPresentWithoutTimeout(
                     //fileListView.getProgressCircular(), 1000);
 
                //check if the folder already exists and if true, delete them
@@ -75,7 +75,7 @@ public class MoveFileTestSuite{
                //Create the folder where the other is gone to be moved
                waitAMomentPopUp = Actions
                                .createFolder(FOLDER_WHERE_MOVE, fileListView);
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                waitAMomentPopUp.getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
                assertTrue(fileListView.getFileElement().isDisplayed());
@@ -93,12 +93,12 @@ public class MoveFileTestSuite{
                //to move to a folder
                moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
                waitAMomentPopUp = moveView.clickOnChoose();
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 
                //check that the folder moved is inside the other
                fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
-               Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(),
                                1000);
                Thread.sleep(1000);
                fileListView.scrollTillFindElement(FILE_NAME);
index 790336c..a6f8769 100644 (file)
@@ -65,7 +65,7 @@ public class MoveFolderTestSuite{
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
 
-               //Common.waitTillElementIsNotPresent(
+               //Common.waitTillElementIsNotPresentWithoutTimeout(
                     //fileListView.getProgressCircular(), 1000);
 
                //check if the folder already exists and if true, delete them
@@ -75,7 +75,7 @@ public class MoveFolderTestSuite{
                //Create the folder where the other is gone to be moved
                waitAMomentPopUp = Actions
                                .createFolder(FOLDER_WHERE_MOVE, fileListView);
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                waitAMomentPopUp.getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
                assertTrue(fileListView.getFileElement().isDisplayed());
@@ -95,12 +95,12 @@ public class MoveFolderTestSuite{
                //to move to a folder
                moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
                waitAMomentPopUp = moveView.clickOnChoose();
-               Common.waitTillElementIsNotPresent(waitAMomentPopUp
+               Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
                                .getWaitAMomentTextElement(), 100);
                
                //check that the folder moved is inside the other
                fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
-               Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(),
                                1000);
                Thread.sleep(1000);
                fileListView.scrollTillFindElement(FOLDER_TO_MOVE);
index 1d4c76c..850a757 100644 (file)
@@ -60,7 +60,7 @@ public class RefreshFolderTestSuite{
                //TODO. Remove the sleep and check why is not working the assert 
                //when using waitTillElementIsNotPresent
                Thread.sleep(5000);
-               //waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000);
+               //waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 1000);
                fileListView.pulldownToRefresh();
                assertTrue(fileListView.getProgressCircular().isDisplayed());
                //TODO insert a file in the web, and check that it's shown here
index 6e04a20..d82cd11 100644 (file)
@@ -79,7 +79,7 @@ public class RenameFileTestSuite{
                assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
                                .getFileElement().isDisplayed());
                CurrentCreatedFile = OLD_FILE_NAME;
-               Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListViewAfterUploadFile
                                .getProgressCircular(), 1000);
                common.wait.until(ExpectedConditions.visibilityOf(
                                fileListViewAfterUploadFile.getFileElementLayout()
@@ -90,7 +90,7 @@ public class RenameFileTestSuite{
                newFolderPopUp.typeNewFolderName(FILE_NAME);
                WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp
                                .clickOnNewFolderOkButton();
-               Common.waitTillElementIsNotPresent(waitAMomentPopUp
+               Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
                                .getWaitAMomentTextElement(), 100);
                fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
                assertNotNull(fileListViewAfterUploadFile.getFileElement());
index 0298bd4..271295f 100644 (file)
@@ -71,7 +71,7 @@ public class RenameFolderTestSuite{
                //create the folder to rename
                WaitAMomentPopUp waitAMomentPopUp = Actions
                                .createFolder(OLD_FOLDER_NAME, fileListView);
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                waitAMomentPopUp.getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(OLD_FOLDER_NAME);
 
@@ -89,7 +89,7 @@ public class RenameFolderTestSuite{
                FolderPopUp.typeNewFolderName(FOLDER_NAME);
                FolderPopUp.clickOnNewFolderOkButton();
                CurrentCreatedFolder = FOLDER_NAME;
-               Common.waitTillElementIsNotPresent(waitAMomentPopUp
+               Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
                                .getWaitAMomentTextElement(), 100);
                fileListView.scrollTillFindElement(FOLDER_NAME);
                assertNotNull(fileListView.getFileElement());
index 42195a7..c22525e 100644 (file)
 
 package com.owncloud.android.test.ui.testSuites;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 import io.appium.java_client.android.AndroidDriver;
-
+import io.appium.java_client.android.AndroidElement;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
-import org.openqa.selenium.By;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-
 import com.owncloud.android.test.ui.actions.Actions;
+import com.owncloud.android.test.ui.groups.IgnoreTestCategory;
 import com.owncloud.android.test.ui.groups.NoIgnoreTestCategory;
 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
-import com.owncloud.android.test.ui.models.ElementMenuOptions;
-import com.owncloud.android.test.ui.models.GmailSendMailView;
-import com.owncloud.android.test.ui.models.FileListView;
-import com.owncloud.android.test.ui.models.ShareView;
+import com.owncloud.android.test.ui.models.FileListView;;
 
 public class ShareLinkFileTestSuite{
        
@@ -56,8 +51,51 @@ public class ShareLinkFileTestSuite{
        }
 
        @Test
+       @Category({NoIgnoreTestCategory.class})
+       public void testShareLinkFileByGmail () throws Exception {      
+               AndroidElement sharedElementIndicator;
+               FileListView fileListView = Actions.login(Config.URL, Config.user,
+                               Config.password, Config.isTrusted, driver);
+               common.assertIsInFileListView();
+               
+               //TODO. if the file already exists, do not upload
+               FileListView fileListViewAfterUploadFile = Actions
+                               .uploadFile(FILE_NAME, fileListView);
+                               
+               fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
+                               .getFileElement().isDisplayed());
+               
+               sharedElementIndicator = Actions.shareLinkElementByGmail(FILE_NAME,
+                               fileListViewAfterUploadFile,driver,common);
+               assertTrue(sharedElementIndicator.isDisplayed());
+       }
+       
+       @Test
        @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
-       public void testShareLinkFile () throws Exception {     
+       public void testShareLinkFileByCopyLink () throws Exception {   
+               AndroidElement sharedElementIndicator;
+               FileListView fileListView = Actions.login(Config.URL, Config.user,
+                               Config.password, Config.isTrusted, driver);
+               common.assertIsInFileListView();
+               
+               //TODO. if the file already exists, do not upload
+               FileListView fileListViewAfterUploadFile = Actions
+                               .uploadFile(FILE_NAME, fileListView);
+                               
+               fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
+               assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
+                               .getFileElement().isDisplayed());
+               
+               sharedElementIndicator = Actions.shareLinkElementByCopyLink(FILE_NAME,
+                               fileListViewAfterUploadFile,driver,common);
+               assertTrue(sharedElementIndicator.isDisplayed());
+       }
+       
+       @Test
+       @Category({IgnoreTestCategory.class, SmokeTestCategory.class})
+       public void testUnshareLinkFile () throws Exception {   
+               AndroidElement sharedElementIndicator;
                FileListView fileListView = Actions.login(Config.URL, Config.user,
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
@@ -70,22 +108,12 @@ public class ShareLinkFileTestSuite{
                assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
                                .getFileElement().isDisplayed());
                
-               ElementMenuOptions elementMenuOption = fileListViewAfterUploadFile
-                               .longPressOnElement(FILE_NAME);
-               ShareView shareView = elementMenuOption.clickOnShareLinkElement();
-               Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(), 
-                               driver).click();
-               GmailSendMailView gmailSendMailView = new GmailSendMailView(driver);
-               gmailSendMailView.typeToEmailAdress(Config.gmailAccount);
-               gmailSendMailView.clickOnSendButton();
-               Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile
-                               .getProgressCircular(), 1000);
-               common.wait.until(ExpectedConditions.visibilityOf(
-                               fileListViewAfterUploadFile.getFileElementLayout()
-                               .findElement(By.id(FileListView.getSharedElementIndicator()))));
-               assertTrue(fileListViewAfterUploadFile.getFileElementLayout()
-                               .findElement(By.id(FileListView.getSharedElementIndicator()))
-                               .isDisplayed());
+               sharedElementIndicator = Actions.shareLinkElementByCopyLink(FILE_NAME,
+                               fileListViewAfterUploadFile,driver,common);
+               assertTrue(sharedElementIndicator.isDisplayed());
+               Actions.unshareLinkElement(FILE_NAME,
+                               fileListViewAfterUploadFile,driver,common);
+               assertFalse(sharedElementIndicator.isDisplayed());
 
        }
 
index 2495d60..cf8f84d 100644 (file)
@@ -36,11 +36,8 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.support.ui.ExpectedConditions;
-
 import com.owncloud.android.test.ui.actions.Actions;
 import com.owncloud.android.test.ui.groups.FailingTestCategory;
-import com.owncloud.android.test.ui.groups.IgnoreTestCategory;
-import com.owncloud.android.test.ui.groups.InProgressCategory;
 import com.owncloud.android.test.ui.groups.NoIgnoreTestCategory;
 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
 import com.owncloud.android.test.ui.groups.UnfinishedTestCategory;
@@ -89,7 +86,7 @@ public class UploadTestSuite{
 
                fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
                assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
-               Common.waitTillElementIsNotPresent(
+               Common.waitTillElementIsNotPresentWithoutTimeout(
                                fileListViewAfterUploadFile.getProgressCircular(), 1000);
                common.wait.until(ExpectedConditions.visibilityOf(
                                fileListViewAfterUploadFile.getFileElementLayout()
@@ -147,7 +144,7 @@ public class UploadTestSuite{
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
 
-               Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
                                1000);
 
                FileListView fileListViewAfterUploadFile = Actions
@@ -178,7 +175,7 @@ public class UploadTestSuite{
                                Config.password, Config.isTrusted, driver);
                common.assertIsInFileListView();
 
-               Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
                                1000);
 
                FileListView fileListViewAfterUploadFile = Actions
@@ -196,7 +193,7 @@ public class UploadTestSuite{
                
                fileListViewAfterUploadFile.pulldownToRefresh();
                //assertTrue(fileListView.getProgressCircular().isDisplayed());
-               Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+               Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
                                100);
                
                assertTrue(common.isElementPresent(