1 package com
.owncloud
.android
.test
.ui
.testSuites
;
3 import static org
.junit
.Assert
.assertTrue
;
4 import io
.appium
.java_client
.android
.AndroidDriver
;
6 import org
.junit
.After
;
7 import org
.junit
.Before
;
10 import org
.junit
.experimental
.categories
.Category
;
11 import org
.junit
.rules
.TestName
;
12 import org
.openqa
.selenium
.By
;
13 import org
.openqa
.selenium
.support
.ui
.ExpectedConditions
;
15 import com
.owncloud
.android
.test
.ui
.actions
.Actions
;
16 import com
.owncloud
.android
.test
.ui
.groups
.NoIgnoreTestCategory
;
17 import com
.owncloud
.android
.test
.ui
.groups
.SmokeTestCategory
;
18 import com
.owncloud
.android
.test
.ui
.models
.ElementMenuOptions
;
19 import com
.owncloud
.android
.test
.ui
.models
.GmailSendMailView
;
20 import com
.owncloud
.android
.test
.ui
.models
.FileListView
;
21 import com
.owncloud
.android
.test
.ui
.models
.ShareView
;
23 public class ShareLinkFileTestSuite
{
27 private final String FILE_NAME
= Config
.fileToTestName
;
28 private Boolean fileHasBeenCreated
= false
;
30 @Rule public TestName name
= new TestName();
33 public void setUp() throws Exception
{
35 driver
=common
.setUpCommonDriver();
39 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
40 public void testShareLinkFile () throws Exception
{
41 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
42 common
.assertIsInFileListView();
44 //TODO. if the file already exists, do not upload
45 FileListView fileListViewAfterUploadFile
= Actions
.uploadFile(FILE_NAME
, fileListView
);
47 fileListViewAfterUploadFile
.scrollTillFindElement(FILE_NAME
);
48 assertTrue(fileHasBeenCreated
= fileListViewAfterUploadFile
.getFileElement().isDisplayed());
50 ElementMenuOptions elementMenuOption
= fileListViewAfterUploadFile
.longPressOnElement(FILE_NAME
);
51 ShareView shareView
= elementMenuOption
.clickOnShareLinkElement();
52 Actions
.scrollTillFindElement("Gmail", shareView
.getListViewLayout(), driver
).click();
53 GmailSendMailView gmailSendMailView
= new GmailSendMailView(driver
);
54 gmailSendMailView
.typeToEmailAdress(Config
.gmailAccount
);
55 gmailSendMailView
.clickOnSendButton();
56 Common
.waitTillElementIsNotPresent(fileListViewAfterUploadFile
.getProgressCircular(), 1000);
57 common
.wait
.until(ExpectedConditions
.visibilityOf(fileListViewAfterUploadFile
.getFileElementLayout().findElement(By
.id(FileListView
.getSharedElementIndicator()))));
58 assertTrue(fileListViewAfterUploadFile
.getFileElementLayout().findElement(By
.id(FileListView
.getSharedElementIndicator())).isDisplayed());
63 public void tearDown() throws Exception
{
64 common
.takeScreenShotOnFailed(name
.getMethodName());
65 if (fileHasBeenCreated
) {
66 FileListView fileListView
= new FileListView(driver
);
67 Actions
.deleteElement(FILE_NAME
,fileListView
, driver
);
69 driver
.removeApp("com.owncloud.android");