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
.Rule
;
29 import org
.junit
.experimental
.categories
.Category
;
30 import org
.junit
.rules
.TestName
;
31 import org
.junit
.runners
.MethodSorters
;
32 import org
.junit
.FixMethodOrder
;
33 import org
.junit
.Test
;
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
;
44 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
45 public class MoveFolderTestSuite
{
48 private String FOLDER_TO_MOVE
= "folderToMove";
49 private String FOLDER_WHERE_MOVE
= "folderWhereMove";
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 testMoveFolder () 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(FOLDER_TO_MOVE
, 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 //Create the folder which is going to be moved
84 waitAMomentPopUp
= Actions
.createFolder(FOLDER_TO_MOVE
, fileListView
);
85 Common
.waitTillElementIsNotPresent(
86 waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
87 fileListView
.scrollTillFindElement(FOLDER_TO_MOVE
);
88 assertTrue(fileListView
.getFileElement().isDisplayed());
90 //select to move the folder
91 ElementMenuOptions menuOptions
= fileListView
92 .longPressOnElement(FOLDER_TO_MOVE
);
93 MoveView moveView
= menuOptions
.clickOnMove();
96 moveView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
97 waitAMomentPopUp
= moveView
.clickOnChoose();
98 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
99 .getWaitAMomentTextElement(), 100);
101 //check that the folder moved is inside the other
102 fileListView
.scrollTillFindElement(FOLDER_WHERE_MOVE
).tap(1,1);
103 Common
.waitTillElementIsNotPresent(fileListView
.getProgressCircular(),
106 fileListView
.scrollTillFindElement(FOLDER_TO_MOVE
);
107 assertEquals(FOLDER_TO_MOVE
, fileListView
.getFileElement().getText());
111 public void tearDown() throws Exception
{
112 common
.takeScreenShotOnFailed(name
.getMethodName());
113 FileListView fileListView
= new FileListView(driver
);
114 driver
.sendKeyEvent(android
.view
.KeyEvent
.KEYCODE_BACK
);
115 Actions
.deleteElement(FOLDER_WHERE_MOVE
, fileListView
, driver
);
116 Actions
.deleteElement(FOLDER_TO_MOVE
, fileListView
, driver
);
117 driver
.removeApp("com.owncloud.android");