Skip to content

Commit ddff250

Browse files
PhilLabalperozturk96
authored andcommitted
Fixed ReceiveExternalFilesActivityIT not separating the screenshots
When running the screenshot tests, the following error was raised: com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT > openMultiAccount[uiComparison(AVD) - 9] FAILED java.lang.AssertionError: Can't create multiple screenshots with the same name: com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT_open at com.facebook.testing.screenshot.internal.AlbumImpl.addRecord This happened because openMultiAccount() simply calls the open() test which "hardcodes" the screenshot name Signed-off-by: Philipp Hasper <vcs@hasper.info>
1 parent 34d3be0 commit ddff250

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/src/androidTest/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivityIT.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ import androidx.test.espresso.Espresso.onView
1313
import androidx.test.espresso.assertion.ViewAssertions.matches
1414
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
1515
import androidx.test.espresso.matcher.ViewMatchers.isRoot
16+
import com.facebook.testing.screenshot.internal.TestNameDetector
1617
import com.owncloud.android.AbstractIT
1718
import com.owncloud.android.utils.ScreenshotTest
1819
import org.junit.Test
1920

2021
class ReceiveExternalFilesActivityIT : AbstractIT() {
21-
private val testClassName = "com.owncloud.android.ui.activity.ReceiveExternalFilesActivityIT"
2222

2323
@Test
2424
@ScreenshotTest
2525
fun open() {
26+
// Screenshot name must be constructed outside of the scenario, otherwise it will not be reliably detected
27+
val screenShotName = TestNameDetector.getTestClass() + "_" + TestNameDetector.getTestName()
2628
launchActivity<ReceiveExternalFilesActivity>().use { scenario ->
27-
val screenShotName = createName(testClassName + "_" + "open", "")
2829
onView(isRoot()).check(matches(isDisplayed()))
2930

3031
scenario.onActivity { sut ->

0 commit comments

Comments
 (0)