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
.NewFolderPopUp
;
21 import com
.owncloud
.android
.test
.ui
.models
.WaitAMomentPopUp
;
24 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
25 public class RenameFolderTestSuite
{
29 private Boolean folderHasBeenCreated
= false
;
30 private final String OLD_FOLDER_NAME
= "beforeRemoving";
31 private final String FOLDER_NAME
= "testCreateFolder";
32 private String CurrentCreatedFolder
= "";
34 @Rule public TestName name
= new TestName();
38 public void setUp() throws Exception
{
40 driver
=common
.setUpCommonDriver();
44 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
45 public void testRenameFolder () throws Exception
{
46 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
47 common
.assertIsInFileListView();
49 //TODO. if the folder already exists, do no created
50 //create the folder to rename
51 WaitAMomentPopUp waitAMomentPopUp
= Actions
.createFolder(OLD_FOLDER_NAME
, fileListView
);
52 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
53 fileListView
.scrollTillFindElement(OLD_FOLDER_NAME
);
55 assertTrue(folderHasBeenCreated
= fileListView
.getFileElement().isDisplayed());
57 //check if the folder with the new name already exists and if true, delete them
58 Actions
.deleteElement(FOLDER_NAME
, fileListView
, driver
);
60 CurrentCreatedFolder
= OLD_FOLDER_NAME
;
61 ElementMenuOptions menuOptions
= fileListView
.longPressOnElement(OLD_FOLDER_NAME
);
62 NewFolderPopUp FolderPopUp
= menuOptions
.clickOnRename();
63 FolderPopUp
.typeNewFolderName(FOLDER_NAME
);
64 FolderPopUp
.clickOnNewFolderOkButton();
65 CurrentCreatedFolder
= FOLDER_NAME
;
66 Common
.waitTillElementIsNotPresent(waitAMomentPopUp
.getWaitAMomentTextElement(), 100);
67 fileListView
.scrollTillFindElement(FOLDER_NAME
);
68 assertNotNull(fileListView
.getFileElement());
69 assertTrue(folderHasBeenCreated
= fileListView
.getFileElement().isDisplayed());
70 assertEquals(FOLDER_NAME
, fileListView
.getFileElement().getText());
74 public void tearDown() throws Exception
{
75 common
.takeScreenShotOnFailed(name
.getMethodName());
76 if(folderHasBeenCreated
){
77 FileListView fileListView
= new FileListView(driver
);
78 Actions
.deleteElement(CurrentCreatedFolder
, fileListView
, driver
);
80 driver
.removeApp("com.owncloud.android");