Browse Source

unshare link test case

purigarcia 10 years ago
parent
commit
9c639003bc

+ 90 - 8
automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java

@@ -22,18 +22,18 @@ package com.owncloud.android.test.ui.actions;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 
 
+import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.ScreenOrientation;
 import org.openqa.selenium.ScreenOrientation;
 import org.openqa.selenium.remote.RemoteWebElement;
 import org.openqa.selenium.remote.RemoteWebElement;
-
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidElement;
 import io.appium.java_client.android.AndroidElement;
-
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.WebDriverWait;
 import org.openqa.selenium.support.ui.WebDriverWait;
-
 import com.owncloud.android.test.ui.models.CertificatePopUp;
 import com.owncloud.android.test.ui.models.CertificatePopUp;
 import com.owncloud.android.test.ui.models.ElementMenuOptions;
 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.UploadFilesView;
 import com.owncloud.android.test.ui.models.LoginForm;
 import com.owncloud.android.test.ui.models.LoginForm;
 import com.owncloud.android.test.ui.models.FileListView;
 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.SettingsView;
 import com.owncloud.android.test.ui.models.WaitAMomentPopUp;
 import com.owncloud.android.test.ui.models.WaitAMomentPopUp;
 import com.owncloud.android.test.ui.testSuites.Common;
 import com.owncloud.android.test.ui.testSuites.Common;
+import com.owncloud.android.test.ui.testSuites.Config;
 
 
 public class Actions {
 public class Actions {
 
 
@@ -120,7 +121,7 @@ public class Actions {
 		driver.tap(1, 0, 0, 1);
 		driver.tap(1, 0, 0, 1);
 	}
 	}
 
 
-	//TODO. convert deleteFodler and deleteFile in deleteElement
+
 	public static AndroidElement deleteElement(String elementName,  
 	public static AndroidElement deleteElement(String elementName,  
 			FileListView fileListView, AndroidDriver driver) throws Exception{
 			FileListView fileListView, AndroidDriver driver) throws Exception{
 		AndroidElement fileElement;
 		AndroidElement fileElement;
@@ -136,16 +137,97 @@ public class Actions {
 					.longPressOnElement(elementName);
 					.longPressOnElement(elementName);
 			RemoveConfirmationView removeConfirmationView = menuOptions
 			RemoveConfirmationView removeConfirmationView = menuOptions
 					.clickOnRemove();;
 					.clickOnRemove();;
-			waitAMomentPopUp = removeConfirmationView
-					.clickOnRemoteAndLocalButton();
-			Common.waitTillElementIsNotPresent(
-					waitAMomentPopUp.getWaitAMomentTextElement(), 100);
+					waitAMomentPopUp = removeConfirmationView
+							.clickOnRemoteAndLocalButton();
+					Common.waitTillElementIsNotPresent(
+							waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 		}catch(NoSuchElementException e){
 		}catch(NoSuchElementException e){
 			fileElement=null;
 			fileElement=null;
 		}
 		}
 		return fileElement;
 		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,
 	public static FileListView uploadFile(String elementName,
 			FileListView fileListView) throws InterruptedException{
 			FileListView fileListView) throws InterruptedException{
 		fileListView.clickOnUploadButton();
 		fileListView.clickOnUploadButton();

+ 9 - 0
automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java

@@ -34,6 +34,9 @@ public class ElementMenuOptions {
 	@AndroidFindBy(name = "Share link")
 	@AndroidFindBy(name = "Share link")
 	private AndroidElement shareLinkElement;
 	private AndroidElement shareLinkElement;
 	
 	
+	@AndroidFindBy(name = "Unshare link")
+	private AndroidElement unshareLinkElement;
+	
 	@AndroidFindBy(name = "Details")
 	@AndroidFindBy(name = "Details")
 	private AndroidElement detailsFileElement;
 	private AndroidElement detailsFileElement;
 	
 	
@@ -82,4 +85,10 @@ public class ElementMenuOptions {
 		ShareView shareView = new ShareView(driver);
 		ShareView shareView = new ShareView(driver);
 		return shareView;
 		return shareView;
 	}
 	}
+	
+	public WaitAMomentPopUp clickOnUnshareLinkElement () {
+		unshareLinkElement.click();
+		WaitAMomentPopUp waitAMomentPopUp = new WaitAMomentPopUp(driver);
+		return waitAMomentPopUp;
+	}
 }
 }

+ 20 - 6
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java

@@ -21,6 +21,7 @@
 package com.owncloud.android.test.ui.testSuites;
 package com.owncloud.android.test.ui.testSuites;
 
 
 import static org.junit.Assert.*;
 import static org.junit.Assert.*;
+
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URL;
@@ -28,6 +29,7 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FileUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 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.DesiredCapabilities;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.openqa.selenium.support.ui.WebDriverWait;
 import org.openqa.selenium.support.ui.WebDriverWait;
+
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidElement;
 import io.appium.java_client.android.AndroidElement;
 
 
@@ -43,7 +46,7 @@ public class Common{
 	AndroidDriver driver;
 	AndroidDriver driver;
 	static int waitingTime = 30;
 	static int waitingTime = 30;
 
 
-	WebDriverWait wait;
+	public WebDriverWait wait;
 
 
 	protected AndroidDriver setUpCommonDriver () throws Exception {
 	protected AndroidDriver setUpCommonDriver () throws Exception {
 		File rootPath = new File(System.getProperty("user.dir"));
 		File rootPath = new File(System.getProperty("user.dir"));
@@ -104,9 +107,7 @@ public class Common{
 	//pollingTime in milliseconds
 	//pollingTime in milliseconds
 	public static void waitTillElementIsNotPresent (AndroidElement element,
 	public static void waitTillElementIsNotPresent (AndroidElement element,
 			int pollingTime) throws Exception {
 			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{
 			try{
 				element.isDisplayed();
 				element.isDisplayed();
 			} catch (NoSuchElementException e){
 			} catch (NoSuchElementException e){
@@ -117,6 +118,19 @@ public class Common{
 		throw new TimeoutException();
 		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) 
 	protected void takeScreenShotOnFailed (String testName) 
 			throws IOException {
 			throws IOException {
 		File file  = ((RemoteWebDriver) driver)
 		File file  = ((RemoteWebDriver) driver)
@@ -124,7 +138,7 @@ public class Common{
 		SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
 		SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
 		Date today = Calendar.getInstance().getTime(); 
 		Date today = Calendar.getInstance().getTime(); 
 		String screenShotName = "ScreenShots/" + dt1.format(today) + "/"
 		String screenShotName = "ScreenShots/" + dt1.format(today) + "/"
-		    + testName + ".png";
+				+ testName + ".png";
 		FileUtils.copyFile(file, new File(screenShotName));
 		FileUtils.copyFile(file, new File(screenShotName));
 	}
 	}
 
 
@@ -151,7 +165,7 @@ public class Common{
 		}
 		}
 		assertNull(fileElement);
 		assertNull(fileElement);
 	}
 	}
-	
+
 	protected void assertIsPasscodeRequestView() throws InterruptedException {
 	protected void assertIsPasscodeRequestView() throws InterruptedException {
 		assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
 		assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
 				.findElementByAndroidUIAutomator("new UiSelector()"
 				.findElementByAndroidUIAutomator("new UiSelector()"

+ 1 - 1
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java

@@ -70,7 +70,7 @@ public class CreateFolderTestSuite{
 
 
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 				.createFolder(NEW_FOLDER_NAME, fileListView);
 				.createFolder(NEW_FOLDER_NAME, fileListView);
-		Common.waitTillElementIsNotPresent(waitAMomentPopUp
+		Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
 				.getWaitAMomentTextElement(), 100);
 				.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		assertNotNull(fileListView.getFileElement());
 		assertNotNull(fileListView.getFileElement());

+ 1 - 1
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java

@@ -67,7 +67,7 @@ public class DeleteFileTestSuite{
 				.uploadFile(FILE_NAME, fileListView);
 				.uploadFile(FILE_NAME, fileListView);
 		
 		
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				fileListViewAfterUploadFile.getProgressCircular(), 1000);
 				fileListViewAfterUploadFile.getProgressCircular(), 1000);
 		common.wait.until(ExpectedConditions.visibilityOf(
 		common.wait.until(ExpectedConditions.visibilityOf(
 				fileListViewAfterUploadFile.getFileElementLayout()
 				fileListViewAfterUploadFile.getFileElementLayout()

+ 1 - 1
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java

@@ -66,7 +66,7 @@ public class DeleteFolderTestSuite{
 		//create the folder
 		//create the folder
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 				.createFolder(FOLDER_NAME, fileListView);
 				.createFolder(FOLDER_NAME, fileListView);
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		assertTrue(
 		assertTrue(

+ 2 - 2
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java

@@ -58,7 +58,7 @@ public class LoginTestSuite{
 	public void test1LoginPortrait () throws Exception {
 	public void test1LoginPortrait () throws Exception {
 		driver.rotate(ScreenOrientation.PORTRAIT);
 		driver.rotate(ScreenOrientation.PORTRAIT);
 		
 		
-		FileListView fileListView = Actions.login(Config.URL, Config.user,
+		Actions.login(Config.URL, Config.user,
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 	}
 	}
@@ -67,7 +67,7 @@ public class LoginTestSuite{
 	@Category({NoIgnoreTestCategory.class})
 	@Category({NoIgnoreTestCategory.class})
 	public void test2LoginLandscape () throws Exception {
 	public void test2LoginLandscape () throws Exception {
 		driver.rotate(ScreenOrientation.LANDSCAPE);
 		driver.rotate(ScreenOrientation.LANDSCAPE);
-		FileListView fileListView = Actions.login(Config.URL, Config.user,
+		Actions.login(Config.URL, Config.user,
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 	}
 	}

+ 4 - 4
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java

@@ -65,7 +65,7 @@ public class MoveFileTestSuite{
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 
 
-		//Common.waitTillElementIsNotPresent(
+		//Common.waitTillElementIsNotPresentWithoutTimeout(
 		     //fileListView.getProgressCircular(), 1000);
 		     //fileListView.getProgressCircular(), 1000);
 
 
 		//check if the folder already exists and if true, delete them
 		//check if the folder already exists and if true, delete them
@@ -75,7 +75,7 @@ public class MoveFileTestSuite{
 		//Create the folder where the other is gone to be moved
 		//Create the folder where the other is gone to be moved
 		waitAMomentPopUp = Actions
 		waitAMomentPopUp = Actions
 				.createFolder(FOLDER_WHERE_MOVE, fileListView);
 				.createFolder(FOLDER_WHERE_MOVE, fileListView);
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
 		assertTrue(fileListView.getFileElement().isDisplayed());
 		assertTrue(fileListView.getFileElement().isDisplayed());
@@ -93,12 +93,12 @@ public class MoveFileTestSuite{
 		//to move to a folder
 		//to move to a folder
 		moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		waitAMomentPopUp = moveView.clickOnChoose();
 		waitAMomentPopUp = moveView.clickOnChoose();
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 
 
 		//check that the folder moved is inside the other
 		//check that the folder moved is inside the other
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
-		Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(),
 				1000);
 				1000);
 		Thread.sleep(1000);
 		Thread.sleep(1000);
 		fileListView.scrollTillFindElement(FILE_NAME);
 		fileListView.scrollTillFindElement(FILE_NAME);

+ 4 - 4
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java

@@ -65,7 +65,7 @@ public class MoveFolderTestSuite{
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 
 
-		//Common.waitTillElementIsNotPresent(
+		//Common.waitTillElementIsNotPresentWithoutTimeout(
 		     //fileListView.getProgressCircular(), 1000);
 		     //fileListView.getProgressCircular(), 1000);
 
 
 		//check if the folder already exists and if true, delete them
 		//check if the folder already exists and if true, delete them
@@ -75,7 +75,7 @@ public class MoveFolderTestSuite{
 		//Create the folder where the other is gone to be moved
 		//Create the folder where the other is gone to be moved
 		waitAMomentPopUp = Actions
 		waitAMomentPopUp = Actions
 				.createFolder(FOLDER_WHERE_MOVE, fileListView);
 				.createFolder(FOLDER_WHERE_MOVE, fileListView);
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE);
 		assertTrue(fileListView.getFileElement().isDisplayed());
 		assertTrue(fileListView.getFileElement().isDisplayed());
@@ -95,12 +95,12 @@ public class MoveFolderTestSuite{
 		//to move to a folder
 		//to move to a folder
 		moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		waitAMomentPopUp = moveView.clickOnChoose();
 		waitAMomentPopUp = moveView.clickOnChoose();
-		Common.waitTillElementIsNotPresent(waitAMomentPopUp
+		Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
 				.getWaitAMomentTextElement(), 100);
 				.getWaitAMomentTextElement(), 100);
 		
 		
 		//check that the folder moved is inside the other
 		//check that the folder moved is inside the other
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
 		fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1);
-		Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(),
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(),
 				1000);
 				1000);
 		Thread.sleep(1000);
 		Thread.sleep(1000);
 		fileListView.scrollTillFindElement(FOLDER_TO_MOVE);
 		fileListView.scrollTillFindElement(FOLDER_TO_MOVE);

+ 1 - 1
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java

@@ -60,7 +60,7 @@ public class RefreshFolderTestSuite{
 		//TODO. Remove the sleep and check why is not working the assert 
 		//TODO. Remove the sleep and check why is not working the assert 
 		//when using waitTillElementIsNotPresent
 		//when using waitTillElementIsNotPresent
 		Thread.sleep(5000);
 		Thread.sleep(5000);
-		//waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000);
+		//waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 1000);
 		fileListView.pulldownToRefresh();
 		fileListView.pulldownToRefresh();
 		assertTrue(fileListView.getProgressCircular().isDisplayed());
 		assertTrue(fileListView.getProgressCircular().isDisplayed());
 		//TODO insert a file in the web, and check that it's shown here
 		//TODO insert a file in the web, and check that it's shown here

+ 2 - 2
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java

@@ -79,7 +79,7 @@ public class RenameFileTestSuite{
 		assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
 		assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
 				.getFileElement().isDisplayed());
 				.getFileElement().isDisplayed());
 		CurrentCreatedFile = OLD_FILE_NAME;
 		CurrentCreatedFile = OLD_FILE_NAME;
-		Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListViewAfterUploadFile
 				.getProgressCircular(), 1000);
 				.getProgressCircular(), 1000);
 		common.wait.until(ExpectedConditions.visibilityOf(
 		common.wait.until(ExpectedConditions.visibilityOf(
 				fileListViewAfterUploadFile.getFileElementLayout()
 				fileListViewAfterUploadFile.getFileElementLayout()
@@ -90,7 +90,7 @@ public class RenameFileTestSuite{
 		newFolderPopUp.typeNewFolderName(FILE_NAME);
 		newFolderPopUp.typeNewFolderName(FILE_NAME);
 		WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp
 		WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp
 				.clickOnNewFolderOkButton();
 				.clickOnNewFolderOkButton();
-		Common.waitTillElementIsNotPresent(waitAMomentPopUp
+		Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
 				.getWaitAMomentTextElement(), 100);
 				.getWaitAMomentTextElement(), 100);
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
 		assertNotNull(fileListViewAfterUploadFile.getFileElement());
 		assertNotNull(fileListViewAfterUploadFile.getFileElement());

+ 2 - 2
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java

@@ -71,7 +71,7 @@ public class RenameFolderTestSuite{
 		//create the folder to rename
 		//create the folder to rename
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 		WaitAMomentPopUp waitAMomentPopUp = Actions
 				.createFolder(OLD_FOLDER_NAME, fileListView);
 				.createFolder(OLD_FOLDER_NAME, fileListView);
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 				waitAMomentPopUp.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(OLD_FOLDER_NAME);
 		fileListView.scrollTillFindElement(OLD_FOLDER_NAME);
 
 
@@ -89,7 +89,7 @@ public class RenameFolderTestSuite{
 		FolderPopUp.typeNewFolderName(FOLDER_NAME);
 		FolderPopUp.typeNewFolderName(FOLDER_NAME);
 		FolderPopUp.clickOnNewFolderOkButton();
 		FolderPopUp.clickOnNewFolderOkButton();
 		CurrentCreatedFolder = FOLDER_NAME;
 		CurrentCreatedFolder = FOLDER_NAME;
-		Common.waitTillElementIsNotPresent(waitAMomentPopUp
+		Common.waitTillElementIsNotPresentWithoutTimeout(waitAMomentPopUp
 				.getWaitAMomentTextElement(), 100);
 				.getWaitAMomentTextElement(), 100);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		fileListView.scrollTillFindElement(FOLDER_NAME);
 		assertNotNull(fileListView.getFileElement());
 		assertNotNull(fileListView.getFileElement());

+ 54 - 26
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java

@@ -20,25 +20,20 @@
 
 
 package com.owncloud.android.test.ui.testSuites;
 package com.owncloud.android.test.ui.testSuites;
 
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidDriver;
-
+import io.appium.java_client.android.AndroidElement;
 import org.junit.After;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 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.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.NoIgnoreTestCategory;
 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
 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{
 public class ShareLinkFileTestSuite{
 	
 	
@@ -55,9 +50,52 @@ public class ShareLinkFileTestSuite{
 		driver=common.setUpCommonDriver();
 		driver=common.setUpCommonDriver();
 	}
 	}
 
 
+	@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
 	@Test
 	@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
 	@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,
 		FileListView fileListView = Actions.login(Config.URL, Config.user,
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
@@ -70,22 +108,12 @@ public class ShareLinkFileTestSuite{
 		assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
 		assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile
 				.getFileElement().isDisplayed());
 				.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());
 
 
 	}
 	}
 
 

+ 4 - 7
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java

@@ -36,11 +36,8 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.ExpectedConditions;
-
 import com.owncloud.android.test.ui.actions.Actions;
 import com.owncloud.android.test.ui.actions.Actions;
 import com.owncloud.android.test.ui.groups.FailingTestCategory;
 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.NoIgnoreTestCategory;
 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
 import com.owncloud.android.test.ui.groups.UnfinishedTestCategory;
 import com.owncloud.android.test.ui.groups.UnfinishedTestCategory;
@@ -89,7 +86,7 @@ public class UploadTestSuite{
 
 
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
 		fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
 		assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
 		assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed());
-		Common.waitTillElementIsNotPresent(
+		Common.waitTillElementIsNotPresentWithoutTimeout(
 				fileListViewAfterUploadFile.getProgressCircular(), 1000);
 				fileListViewAfterUploadFile.getProgressCircular(), 1000);
 		common.wait.until(ExpectedConditions.visibilityOf(
 		common.wait.until(ExpectedConditions.visibilityOf(
 				fileListViewAfterUploadFile.getFileElementLayout()
 				fileListViewAfterUploadFile.getFileElementLayout()
@@ -147,7 +144,7 @@ public class UploadTestSuite{
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 
 
-		Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
 				1000);
 				1000);
 
 
 		FileListView fileListViewAfterUploadFile = Actions
 		FileListView fileListViewAfterUploadFile = Actions
@@ -178,7 +175,7 @@ public class UploadTestSuite{
 				Config.password, Config.isTrusted, driver);
 				Config.password, Config.isTrusted, driver);
 		common.assertIsInFileListView();
 		common.assertIsInFileListView();
 
 
-		Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
 				1000);
 				1000);
 
 
 		FileListView fileListViewAfterUploadFile = Actions
 		FileListView fileListViewAfterUploadFile = Actions
@@ -196,7 +193,7 @@ public class UploadTestSuite{
 		
 		
 		fileListViewAfterUploadFile.pulldownToRefresh();
 		fileListViewAfterUploadFile.pulldownToRefresh();
 		//assertTrue(fileListView.getProgressCircular().isDisplayed());
 		//assertTrue(fileListView.getProgressCircular().isDisplayed());
-		Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 
+		Common.waitTillElementIsNotPresentWithoutTimeout(fileListView.getProgressCircular(), 
 				100);
 				100);
 		
 		
 		assertTrue(common.isElementPresent(
 		assertTrue(common.isElementPresent(