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
;
34 import org
.openqa
.selenium
.By
;
35 import org
.openqa
.selenium
.support
.ui
.ExpectedConditions
;
37 import com
.owncloud
.android
.test
.ui
.actions
.Actions
;
38 import com
.owncloud
.android
.test
.ui
.groups
.NoIgnoreTestCategory
;
39 import com
.owncloud
.android
.test
.ui
.groups
.SmokeTestCategory
;
40 import com
.owncloud
.android
.test
.ui
.models
.FileListView
;
43 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
44 public class DeleteFileTestSuite
{
48 private final String FILE_NAME
= Config
.fileToTestName
;
50 @Rule public TestName name
= new TestName();
53 public void setUp() throws Exception
{
55 driver
=common
.setUpCommonDriver();
59 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
60 public void testDeleteFile () throws Exception
{
61 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,
62 Config
.password
, Config
.isTrusted
, driver
);
63 common
.assertIsInFileListView();
65 //TODO. if the file already exists, do not upload
66 FileListView fileListViewAfterUploadFile
= Actions
67 .uploadFile(FILE_NAME
, fileListView
);
69 fileListViewAfterUploadFile
.scrollTillFindElement(FILE_NAME
);
70 Common
.waitTillElementIsNotPresent(
71 fileListViewAfterUploadFile
.getProgressCircular(), 1000);
72 common
.wait
.until(ExpectedConditions
.visibilityOf(
73 fileListViewAfterUploadFile
.getFileElementLayout()
74 .findElement(By
.id(FileListView
.getLocalFileIndicator()))));
76 Actions
.deleteElement(FILE_NAME
,fileListViewAfterUploadFile
, driver
);
77 assertFalse(fileListViewAfterUploadFile
.getFileElement().isDisplayed());
81 public void tearDown() throws Exception
{
82 common
.takeScreenShotOnFailed(name
.getMethodName());
83 driver
.removeApp("com.owncloud.android");