1 package com
.owncloud
.android
.test
.ui
.testSuites
;
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 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
.FileListView
;
20 import com
.owncloud
.android
.test
.ui
.models
.MoveView
;
21 import com
.owncloud
.android
.test
.ui
.models
.WaitAMomentPopUp
;
24 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
25 public class MoveFolderTestSuite
{
28 private String FOLDER_TO_MOVE
= "folderToMove";
29 private String FOLDER_WHERE_MOVE
= "folderWhereMove";
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 testMoveFolder () throws Exception
{
42 WaitAMomentPopUp waitAMomentPopUp
;
44 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
45 common
.assertIsInFileListView();
47 //Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000);
49 //check if the folder already exists and if true, delete them
50 Actions
.deleteElement(FOLDER_WHERE_MOVE
, fileListView
, driver
);
51 Actions
.deleteElement(FOLDER_TO_MOVE
, fileListView
, driver
);
53 //Create the folder where the other is gone to be moved
54 waitAMomentPopUp
= Actions
.createFolder(FOLDER_WHERE_MOVE
, fileListView
);
55 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
56 fileListView
.scrollTillFindElement(FOLDER_WHERE_MOVE
);
57 assertTrue(fileListView
.getFileElement().isDisplayed());
59 //Create the folder which is going to be moved
60 waitAMomentPopUp
= Actions
.createFolder(FOLDER_TO_MOVE
, fileListView
);
61 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
62 fileListView
.scrollTillFindElement(FOLDER_TO_MOVE
);
63 assertTrue(fileListView
.getFileElement().isDisplayed());
65 //select to move the folder
66 ElementMenuOptions menuOptions
= fileListView
.longPressOnElement(FOLDER_TO_MOVE
);
67 MoveView moveView
= menuOptions
.clickOnMove();
70 moveView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
71 waitAMomentPopUp
= moveView
.clickOnChoose();
72 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
74 //check that the folder moved is inside the other
75 fileListView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
76 Common
.waitTillElementIsNotPresent(fileListView
.getProgressCircular(), 1000);
78 fileListView
.scrollTillFindElement(FOLDER_TO_MOVE
);
79 assertEquals(FOLDER_TO_MOVE
, fileListView
.getFileElement().getText());
83 public void tearDown() throws Exception
{
84 common
.takeScreenShotOnFailed(name
.getMethodName());
85 FileListView fileListView
= new FileListView(driver
);
86 driver
.sendKeyEvent(android
.view
.KeyEvent
.KEYCODE_BACK
);
87 Actions
.deleteElement(FOLDER_WHERE_MOVE
, fileListView
, driver
);
88 Actions
.deleteElement(FOLDER_TO_MOVE
, fileListView
, driver
);
89 driver
.removeApp("com.owncloud.android");