105a42dc57acc0104810a840b40534e6b6a9d05e
[pub/Android/ownCloud.git] / automationTest / src / test / java / com / owncloud / android / test / ui / testSuites / DeleteFolderTestSuite.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
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.FileListView;
19 import com.owncloud.android.test.ui.models.WaitAMomentPopUp;
20
21
22 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
23 public class DeleteFolderTestSuite{
24 AndroidDriver driver;
25 Common common;
26 private Boolean folderHasBeenCreated = false;
27 private final String FOLDER_NAME = "testCreateFolder";
28
29 @Rule public TestName name = new TestName();
30
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 testDeleteFolder () throws Exception {
41 FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
42 common.assertIsInFileListView();
43
44 //TODO. if the folder already exists, do no created
45 //create the folder
46 WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(FOLDER_NAME, fileListView);
47 Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100);
48 fileListView.scrollTillFindElement(FOLDER_NAME);
49 assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed());
50
51 //delete the folder
52 Actions.deleteElement(FOLDER_NAME, fileListView, driver);
53 assertFalse(folderHasBeenCreated =fileListView.getFileElement().isDisplayed());
54 }
55
56 @After
57 public void tearDown() throws Exception {
58 common.takeScreenShotOnFailed(name.getMethodName());
59 if(folderHasBeenCreated){
60 FileListView fileListView = new FileListView(driver);
61 Actions.deleteElement(FOLDER_NAME, fileListView, driver);
62 }
63 driver.removeApp("com.owncloud.android");
64 driver.quit();
65 }
66
67 }