2 * ownCloud Android client application
5 * Copyright (C) 2015 ownCloud Inc.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 package com
.owncloud
.android
.test
.ui
.testSuites
;
23 import static org
.junit
.Assert
.*;
24 import io
.appium
.java_client
.android
.AndroidDriver
;
26 import org
.junit
.After
;
27 import org
.junit
.Before
;
28 import org
.junit
.FixMethodOrder
;
29 import org
.junit
.Rule
;
30 import org
.junit
.Test
;
31 import org
.junit
.experimental
.categories
.Category
;
32 import org
.junit
.rules
.TestName
;
33 import org
.junit
.runners
.MethodSorters
;
35 import com
.owncloud
.android
.test
.ui
.actions
.Actions
;
36 import com
.owncloud
.android
.test
.ui
.groups
.NoIgnoreTestCategory
;
37 import com
.owncloud
.android
.test
.ui
.groups
.SmokeTestCategory
;
38 import com
.owncloud
.android
.test
.ui
.models
.ElementMenuOptions
;
39 import com
.owncloud
.android
.test
.ui
.models
.FileListView
;
40 import com
.owncloud
.android
.test
.ui
.models
.MoveView
;
41 import com
.owncloud
.android
.test
.ui
.models
.WaitAMomentPopUp
;
45 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
46 public class MoveFileTestSuite
{
49 private String FOLDER_WHERE_MOVE
= "folderWhereMove";
50 private String FILE_NAME
= Config
.fileToTestName
;
51 @Rule public TestName name
= new TestName();
54 public void setUp() throws Exception
{
56 driver
=common
.setUpCommonDriver();
60 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
61 public void testMoveFile () throws Exception
{
62 WaitAMomentPopUp waitAMomentPopUp
;
64 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,
65 Config
.password
, Config
.isTrusted
, driver
);
66 common
.assertIsInFileListView();
68 //Common.waitTillElementIsNotPresent(
69 //fileListView.getProgressCircular(), 1000);
71 //check if the folder already exists and if true, delete them
72 Actions
.deleteElement(FOLDER_WHERE_MOVE
, fileListView
, driver
);
73 Actions
.deleteElement(FILE_NAME
, fileListView
, driver
);
75 //Create the folder where the other is gone to be moved
76 waitAMomentPopUp
= Actions
77 .createFolder(FOLDER_WHERE_MOVE
, fileListView
);
78 Common
.waitTillElementIsNotPresent(
79 waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
80 fileListView
.scrollTillFindElement(FOLDER_WHERE_MOVE
);
81 assertTrue(fileListView
.getFileElement().isDisplayed());
83 FileListView fileListViewAfterUploadFile
= Actions
84 .uploadFile(FILE_NAME
, fileListView
);
85 fileListViewAfterUploadFile
.scrollTillFindElement(FILE_NAME
);
86 assertTrue(fileListViewAfterUploadFile
.getFileElement().isDisplayed());
88 //select to move the file
89 ElementMenuOptions menuOptions
= fileListView
90 .longPressOnElement(FILE_NAME
);
91 MoveView moveView
= menuOptions
.clickOnMove();
94 moveView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
95 waitAMomentPopUp
= moveView
.clickOnChoose();
96 Common
.waitTillElementIsNotPresent(
97 waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
99 //check that the folder moved is inside the other
100 fileListView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
101 Common
.waitTillElementIsNotPresent(fileListView
.getProgressCircular(),
104 fileListView
.scrollTillFindElement(FILE_NAME
);
105 assertEquals(FILE_NAME
, fileListView
.getFileElement().getText());
110 public void tearDown() throws Exception
{
111 common
.takeScreenShotOnFailed(name
.getMethodName());
112 FileListView fileListView
= new FileListView(driver
);
113 driver
.sendKeyEvent(android
.view
.KeyEvent
.KEYCODE_BACK
);
114 Actions
.deleteElement(FOLDER_WHERE_MOVE
, fileListView
, driver
);
115 Actions
.deleteElement(FILE_NAME
, fileListView
, driver
);
116 driver
.removeApp("com.owncloud.android");