From c2f13c5cd5fa395307c81bf5d379b4aeacd2d759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Tue, 4 Jun 2024 16:32:50 +0000 Subject: [PATCH] Start with a single screenshot Change-Id: I74fe8d37c7618fb07cb6aacc6ab8ef884b8cdb44 --- .../apps/nowinandroid/ui/EdgeToEdgeTest.kt | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/EdgeToEdgeTest.kt b/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/EdgeToEdgeTest.kt index 5f89ea3e2..90ce8d376 100644 --- a/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/EdgeToEdgeTest.kt +++ b/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/EdgeToEdgeTest.kt @@ -80,8 +80,8 @@ class EdgeToEdgeTest { @get:Rule(order = 3) val activityScenarioRule = ActivityScenarioRule(MainActivity::class.java) -// @get:Rule(order = 4) -// val dropshots = Dropshots() + @get:Rule(order = 4) + val dropshots = Dropshots() @Before fun setup() = hiltRule.inject() @@ -135,6 +135,7 @@ class EdgeToEdgeTest { @Test fun edgeToEdge_Foldable_api33() { assert(true) + screenshotSystemBar("edgeToEdge_Foldable_closed_system") //runFoldableTests(apiName = "api33") } // @@ -242,18 +243,18 @@ class EdgeToEdgeTest { name: String, filePath: String? = null, ) { -// // Try to assert 3 times -// var count = 2 -// while (true) { -// try { -// dropshots.assertSnapshot(bitmap, name, filePath) -// } catch (e: AssertionError) { -// if (count == 0) throw e -// count -= 1 -// Log.i("EdgeToEdgeTest", "Test failed, retrying (count=$count)") -// waitForWindowUpdate() -// } -// } + // Try to assert 3 times + var count = 2 + while (true) { + try { + dropshots.assertSnapshot(bitmap, name, filePath) + } catch (e: AssertionError) { + if (count == 0) throw e + count -= 1 + Log.i("EdgeToEdgeTest", "Test failed, retrying (count=$count)") + waitForWindowUpdate() + } + } } }