diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/InProgressCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/InProgressCategory.java new file mode 100644 index 0000000000..850ff45139 --- /dev/null +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/InProgressCategory.java @@ -0,0 +1,5 @@ +package com.owncloud.android.test.ui.groups; + +public interface InProgressCategory extends IgnoreTestCategory{ + +} diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunInProgressTest.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunInProgressTest.java new file mode 100644 index 0000000000..9fb14a053f --- /dev/null +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunInProgressTest.java @@ -0,0 +1,19 @@ +package com.owncloud.android.test.ui.testSuites; + +import org.junit.experimental.categories.Categories.IncludeCategory; +import org.junit.runner.RunWith; +import com.owncloud.android.test.ui.groups.FlexibleCategories; +import com.owncloud.android.test.ui.groups.InProgressCategory; +import com.owncloud.android.test.ui.groups.FlexibleCategories.TestClassPrefix; +import com.owncloud.android.test.ui.groups.FlexibleCategories.TestClassSuffix; +import com.owncloud.android.test.ui.groups.FlexibleCategories.TestScanPackage; + + +@RunWith(FlexibleCategories.class) +@IncludeCategory(InProgressCategory.class) +@TestScanPackage("com.owncloud.android.test.ui.testSuites") +@TestClassPrefix("") +@TestClassSuffix("TestSuite") +public class RunInProgressTest { + +} diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java index 50ddb39042..2495d600aa 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java @@ -40,7 +40,9 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import com.owncloud.android.test.ui.actions.Actions; import com.owncloud.android.test.ui.groups.FailingTestCategory; import com.owncloud.android.test.ui.groups.IgnoreTestCategory; +import com.owncloud.android.test.ui.groups.InProgressCategory; import com.owncloud.android.test.ui.groups.NoIgnoreTestCategory; +import com.owncloud.android.test.ui.groups.SmokeTestCategory; import com.owncloud.android.test.ui.groups.UnfinishedTestCategory; import com.owncloud.android.test.ui.models.FileDetailsView; import com.owncloud.android.test.ui.models.ElementMenuOptions; @@ -72,7 +74,7 @@ public class UploadTestSuite{ } @Test - @Category(NoIgnoreTestCategory.class) + @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testUploadFile () throws Exception { FileListView fileListView = Actions.login(Config.URL, Config.user, @@ -151,7 +153,8 @@ public class UploadTestSuite{ FileListView fileListViewAfterUploadFile = Actions .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); - assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); + assertTrue(fileHasBeenUploaded = fileListViewAfterUploadFile + .getFileElement().isDisplayed()); ElementMenuOptions menuOptions = fileListViewAfterUploadFile .longPressOnElement(FILE_NAME); @@ -166,6 +169,43 @@ public class UploadTestSuite{ .findElement(By.id(FileListView.getFavoriteFileIndicator())) .isDisplayed()); } + + @Test + @Category({NoIgnoreTestCategory.class}) + public void testKeepFileUpToDateAndRefresh () throws Exception { + + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); + common.assertIsInFileListView(); + + Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), + 1000); + + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); + fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); + assertTrue(fileHasBeenUploaded = fileListViewAfterUploadFile + .getFileElement().isDisplayed()); + + ElementMenuOptions menuOptions = fileListViewAfterUploadFile + .longPressOnElement(FILE_NAME); + FileDetailsView fileDetailsView = menuOptions.clickOnDetails(); + fileDetailsView.checkKeepFileUpToDateCheckbox(); + Thread.sleep(3000); + driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK); + + fileListViewAfterUploadFile.pulldownToRefresh(); + //assertTrue(fileListView.getProgressCircular().isDisplayed()); + Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), + 100); + + assertTrue(common.isElementPresent( + fileListViewAfterUploadFile.getFileElementLayout(), + MobileBy.id(FileListView.getFavoriteFileIndicator()))); + assertTrue(fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getFavoriteFileIndicator())) + .isDisplayed()); + } @After