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
;
8 import org
.junit
.FixMethodOrder
;
10 import org
.junit
.Test
;
11 import org
.junit
.experimental
.categories
.Category
;
12 import org
.junit
.rules
.TestName
;
13 import org
.junit
.runners
.MethodSorters
;
15 import androidtest
.actions
.Actions
;
16 import androidtest
.groups
.NoIgnoreTestCategory
;
17 import androidtest
.groups
.SmokeTestCategory
;
18 import androidtest
.models
.ElementMenuOptions
;
19 import androidtest
.models
.MainView
;
20 import androidtest
.models
.MoveView
;
21 import androidtest
.models
.WaitAMomentPopUp
;
25 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
26 public class MoveFileTestSuite
{
29 private String FOLDER_WHERE_MOVE
= "folderWhereMove";
30 private String FILE_NAME
= "test";
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 testMoveFile () throws Exception
{
42 WaitAMomentPopUp waitAMomentPopUp
;
44 MainView mainView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
45 common
.assertIsInMainView();
47 Common
.waitTillElementIsNotPresent(mainView
.getProgressCircular(), 1000);
49 //check if the folder already exists and if true, delete them
50 Actions
.deleteElement(FOLDER_WHERE_MOVE
, mainView
, driver
);
51 Actions
.deleteElement(FILE_NAME
, mainView
, driver
);
53 //Create the folder where the other is gone to be moved
54 waitAMomentPopUp
= Actions
.createFolder(FOLDER_WHERE_MOVE
, mainView
);
55 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
56 mainView
.scrollTillFindElement(FOLDER_WHERE_MOVE
);
57 assertTrue(mainView
.getFileElement().isDisplayed());
59 MainView mainViewAfterUploadFile
= Actions
.uploadFile(FILE_NAME
, mainView
);
60 mainViewAfterUploadFile
.scrollTillFindElement(FILE_NAME
);
61 assertTrue(mainViewAfterUploadFile
.getFileElement().isDisplayed());
63 //select to move the file
64 ElementMenuOptions menuOptions
= mainView
.longPressOnElement(FILE_NAME
);
65 MoveView moveView
= menuOptions
.clickOnMove();
68 moveView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
69 waitAMomentPopUp
= moveView
.clickOnChoose();
70 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
72 //check that the folder moved is inside the other
73 mainView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
74 Common
.waitTillElementIsNotPresent(mainView
.getProgressCircular(), 1000);
76 mainView
.scrollTillFindElement(FILE_NAME
);
77 assertEquals(FILE_NAME
, mainView
.getFileElement().getText());
82 public void tearDown() throws Exception
{
83 common
.takeScreenShotOnFailed(name
.getMethodName());
84 MainView mainView
= new MainView(driver
);
85 driver
.sendKeyEvent(android
.view
.KeyEvent
.KEYCODE_BACK
);
86 Actions
.deleteElement(FOLDER_WHERE_MOVE
, mainView
, driver
);
87 Actions
.deleteElement(FILE_NAME
, mainView
, driver
);
88 driver
.removeApp("com.owncloud.android");