1 package androidtest
.tests
;
3 import org
.junit
.After
;
4 import org
.junit
.Before
;
5 import org
.junit
.FixMethodOrder
;
7 import org
.junit
.runners
.MethodSorters
;
9 import androidtest
.actions
.Actions
;
10 import androidtest
.models
.ElementMenuOptions
;
11 import androidtest
.models
.MainView
;
12 import androidtest
.models
.MoveView
;
13 import androidtest
.models
.WaitAMomentPopUp
;
17 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
18 public class MoveFileTestSuite
extends Common
{
19 private String FOLDER_WHERE_MOVE
= "folderWhereMove";
20 private String FILE_NAME
= "test";
23 public void setUp() throws Exception
{
28 public void testMoveFile () throws Exception
{
29 WaitAMomentPopUp waitAMomentPopUp
;
31 MainView mainView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
32 assertTrue(waitForTextPresent("ownCloud", mainView
.getTitleTextElement()));
34 waitTillElementIsNotPresent(mainView
.getProgressCircular(), 1000);
36 //check if the folder already exists and if true, delete them
37 Actions
.deleteElement(FOLDER_WHERE_MOVE
, mainView
, driver
);
38 Actions
.deleteElement(FILE_NAME
, mainView
, driver
);
40 //Create the folder where the other is gone to be moved
41 waitAMomentPopUp
= Actions
.createFolder(FOLDER_WHERE_MOVE
, mainView
);
42 waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
43 mainView
.scrollTillFindElement(FOLDER_WHERE_MOVE
);
44 assertTrue(mainView
.getFileElement().isDisplayed());
46 MainView mainViewAfterUploadFile
= Actions
.uploadFile(FILE_NAME
, mainView
);
47 mainViewAfterUploadFile
.scrollTillFindElement(FILE_NAME
);
48 assertTrue(mainViewAfterUploadFile
.getFileElement().isDisplayed());
50 //select to move the file
51 ElementMenuOptions menuOptions
= mainView
.longPressOnElement(FILE_NAME
);
52 MoveView moveView
= menuOptions
.clickOnMove();
55 moveView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
56 waitAMomentPopUp
= moveView
.clickOnChoose();
57 waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
59 //check that the folder moved is inside the other
60 mainView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
61 waitTillElementIsNotPresent(mainView
.getProgressCircular(), 1000);
63 mainView
.scrollTillFindElement(FILE_NAME
);
64 assertEquals(FILE_NAME
, mainView
.getFileElement().getText());
69 public void tearDown() throws Exception
{
70 MainView mainView
= new MainView(driver
);
71 driver
.sendKeyEvent(android
.view
.KeyEvent
.KEYCODE_BACK
);
72 Actions
.deleteElement(FOLDER_WHERE_MOVE
, mainView
, driver
);
73 Actions
.deleteElement(FILE_NAME
, mainView
, driver
);
74 driver
.removeApp("com.owncloud.android");