1 package androidtest
.tests
;
3 import static org
.junit
.Assert
.*;
4 import io
.appium
.java_client
.android
.AndroidDriver
;
6 import org
.junit
.After
;
7 import org
.junit
.Before
;
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
;
15 import androidtest
.actions
.Actions
;
16 import androidtest
.groups
.NoIgnoreTestCategory
;
17 import androidtest
.groups
.SmokeTestCategory
;
18 import androidtest
.models
.MainView
;
19 import androidtest
.models
.WaitAMomentPopUp
;
22 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
23 public class DeleteFolderTestSuite
{
26 private Boolean folderHasBeenCreated
= false
;
27 private final String FOLDER_NAME
= "testCreateFolder";
29 @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 testDeleteFolder () throws Exception
{
41 MainView mainView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
42 common
.assertIsInMainView();
44 //TODO. if the folder already exists, do no created
46 WaitAMomentPopUp waitAMomentPopUp
= Actions
.createFolder(FOLDER_NAME
, mainView
);
47 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
48 mainView
.scrollTillFindElement(FOLDER_NAME
);
49 assertTrue(folderHasBeenCreated
= mainView
.getFileElement().isDisplayed());
52 Actions
.deleteElement(FOLDER_NAME
, mainView
, driver
);
53 assertFalse(folderHasBeenCreated
=mainView
.getFileElement().isDisplayed());
57 public void tearDown() throws Exception
{
58 common
.takeScreenShotOnFailed(name
.getMethodName());
59 if(folderHasBeenCreated
){
60 MainView mainView
= new MainView(driver
);
61 Actions
.deleteElement(FOLDER_NAME
, mainView
, driver
);
63 driver
.removeApp("com.owncloud.android");