28e6b251312ac8082438e1377381595b16c615d7
[pub/Android/ownCloud.git] / automationTest / src / test / java / com / owncloud / android / test / ui / testSuites / DeleteFileTestSuite.java
1 package com.owncloud.android.test.ui.testSuites;
2
3 import static org.junit.Assert.*;
4 import io.appium.java_client.android.AndroidDriver;
5
6 import org.junit.After;
7 import org.junit.Before;
8 import org.junit.Rule;
9 import org.junit.experimental.categories.Category;
10 import org.junit.rules.TestName;
11 import org.junit.runners.MethodSorters;
12 import org.junit.FixMethodOrder;
13 import org.junit.Test;
14 import org.openqa.selenium.By;
15 import org.openqa.selenium.support.ui.ExpectedConditions;
16
17 import com.owncloud.android.test.ui.actions.Actions;
18 import com.owncloud.android.test.ui.groups.NoIgnoreTestCategory;
19 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
20 import com.owncloud.android.test.ui.models.FileListView;
21
22
23 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
24 public class DeleteFileTestSuite{
25
26 AndroidDriver driver;
27 Common common;
28 private final String FILE_NAME = Config.fileToTestName;
29
30 @Rule public TestName name = new TestName();
31
32 @Before
33 public void setUp() throws Exception {
34 common=new Common();
35 driver=common.setUpCommonDriver();
36 }
37
38 @Test
39 @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
40 public void testDeleteFile () throws Exception {
41 FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
42 common.assertIsInFileListView();
43
44 //TODO. if the file already exists, do not upload
45 FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView);
46
47 fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME);
48 Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000);
49 common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator()))));
50
51 Actions.deleteElement(FILE_NAME,fileListViewAfterUploadFile, driver);
52 assertFalse(fileListViewAfterUploadFile.getFileElement().isDisplayed());
53 }
54
55 @After
56 public void tearDown() throws Exception {
57 common.takeScreenShotOnFailed(name.getMethodName());
58 driver.removeApp("com.owncloud.android");
59 driver.quit();
60 }
61
62 }