From f4c92e7758578b674cbcd8713bf4b97f460a08cf Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 2 Aug 2024 14:22:12 +0200 Subject: [PATCH] use test class name for fix unknown class name Signed-off-by: alperozturk --- .../java/com/owncloud/android/AbstractIT.java | 9 ++++++--- .../android/ui/trashbin/TrashbinActivityIT.kt | 20 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) 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) } } }