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 CreateFolderTestSuite
{
27 private Boolean folderHasBeenCreated
= false
;
28 private final String FOLDER_NAME
= "testCreateFolder";
29 private String CurrentCreatedFolder
= "";
31 @Rule public TestName name
= new TestName();
34 public void setUp() throws Exception
{
36 driver
=common
.setUpCommonDriver();
40 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
41 public void testCreateNewFolder () throws Exception
{
42 String NEW_FOLDER_NAME
= "testCreateFolder";
44 MainView mainView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
45 common
.assertIsInMainView();
47 //check if the folder already exists and if true, delete them
48 Actions
.deleteElement(NEW_FOLDER_NAME
, mainView
, driver
);
50 WaitAMomentPopUp waitAMomentPopUp
= Actions
.createFolder(NEW_FOLDER_NAME
, mainView
);
51 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
52 mainView
.scrollTillFindElement(FOLDER_NAME
);
53 assertNotNull(mainView
.getFileElement());
54 assertTrue(folderHasBeenCreated
=mainView
.getFileElement().isDisplayed());
55 CurrentCreatedFolder
= FOLDER_NAME
;
56 assertEquals(FOLDER_NAME
, mainView
.getFileElement().getText());
60 public void tearDown() throws Exception
{
61 common
.takeScreenShotOnFailed(name
.getMethodName());
62 if (folderHasBeenCreated
) {
63 MainView mainView
= new MainView(driver
);
64 Actions
.deleteElement(CurrentCreatedFolder
, mainView
, driver
);
66 driver
.removeApp("com.owncloud.android");