diff --git a/app/src/androidTest/java/com/owncloud/android/AbstractIT.java b/app/src/androidTest/java/com/owncloud/android/AbstractIT.java index 8e263f6093..f857dcfb61 100644 --- a/app/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/app/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -483,9 +483,7 @@ public abstract class AbstractIT { return createName(""); } - private String createName(String prefix) { - String name = TestNameDetector.getTestClass() + "_" + TestNameDetector.getTestName(); - + public String createName(String name, String prefix) { if (!TextUtils.isEmpty(prefix)) { name = name + "_" + prefix; } @@ -501,6 +499,11 @@ public abstract class AbstractIT { return name; } + private String createName(String prefix) { + String name = TestNameDetector.getTestClass() + "_" + TestNameDetector.getTestName(); + return createName(name, prefix); + } + public static String getUserId(User user) { return AccountManager.get(targetContext).getUserData(user.toPlatformAccount(), KEY_USER_ID); } diff --git a/app/src/androidTest/java/com/owncloud/android/ui/trashbin/TrashbinActivityIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/trashbin/TrashbinActivityIT.kt index 7d418dc1cc..afb5779cac 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/trashbin/TrashbinActivityIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/trashbin/TrashbinActivityIT.kt @@ -22,6 +22,8 @@ import org.junit.Before import org.junit.Test class TrashbinActivityIT : AbstractIT() { + private val testClassName = "com.owncloud.android.ui.trashbin.TrashbinActivityIT" + enum class TestCase { ERROR, EMPTY, @@ -47,7 +49,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.loadFolder() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_error") + val screenShotName = createName(testClassName + "_" + "error", "") + screenshotViaName(sut, screenShotName) } } } @@ -62,7 +65,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.loadFolder() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_files") + val screenShotName = createName(testClassName + "_" + "files", "") + screenshotViaName(sut, screenShotName) } } } @@ -77,7 +81,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.loadFolder() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_empty") + val screenShotName = createName(testClassName + "_" + "empty", "") + screenshotViaName(sut, screenShotName) } } } @@ -92,7 +97,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.showInitialLoading() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_loading") + val screenShotName = createName(testClassName + "_" + "loading", "") + screenshotViaName(sut, screenShotName) } } } @@ -107,7 +113,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.showUser() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_normalUser") + val screenShotName = createName(testClassName + "_" + "normalUser", "") + screenshotViaName(sut, screenShotName) } } } @@ -134,7 +141,8 @@ class TrashbinActivityIT : AbstractIT() { sut.trashbinPresenter = TrashbinPresenter(trashbinRepository, sut) onIdleSync { sut.runOnUiThread { sut.showUser() } - screenshotViaName(sut, "com.owncloud.android.ui.trashbin.TrashbinActivityIT_differentUser") + val screenShotName = createName(testClassName + "_" + "differentUser", "") + screenshotViaName(sut, screenShotName) } } }