use test class name for fix unknown class name

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-08-02 14:22:12 +02:00 committed by Alper Öztürk
parent a2a6d331f1
commit f4c92e7758
2 changed files with 20 additions and 9 deletions

View file

@ -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);
}

View file

@ -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)
}
}
}