From 538d6613a261745ce5458acd107260979ec74b87 Mon Sep 17 00:00:00 2001 From: ApolloF <98666317+ApolloF@users.noreply.github.com> Date: Sun, 4 Oct 2026 19:34:17 +0200 Subject: [PATCH 1/2] Tests: let the day switch settle before checking for Missed --- .../com/apollof/protocoltracker/ui/today/TodayWeekPagerTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/test/kotlin/com/apollof/protocoltracker/ui/today/TodayWeekPagerTest.kt b/app/src/test/kotlin/com/apollof/protocoltracker/ui/today/TodayWeekPagerTest.kt index 3cf893f..0a9375e 100644 --- a/app/src/test/kotlin/com/apollof/protocoltracker/ui/today/TodayWeekPagerTest.kt +++ b/app/src/test/kotlin/com/apollof/protocoltracker/ui/today/TodayWeekPagerTest.kt @@ -112,6 +112,7 @@ class TodayWeekPagerTest { compose.waitUntil(15_000) { compose.onAllNodes(dayCell(lastWeek)).fetchSemanticsNodes().isNotEmpty() } compose.onNode(dayCell(lastWeek)).performSemanticsAction(SemanticsActions.OnClick) compose.waitUntil(15_000) { hasText("Back to today") && hasText("1 NOT LOGGED") } + compose.waitForIdle() // the day switch cross-fades: the old day stays in the tree until it ends assertTrue(compose.onAllNodesWithText("Missed", substring = true).fetchSemanticsNodes().isEmpty()) // It can still be checked off, at its planned time. compose.onNodeWithContentDescription("Mark Test C taken").performScrollTo().performClick() From fc39e56b9f421f2372512873533a23764ed43b84 Mon Sep 17 00:00:00 2001 From: ApolloF Date: Sun, 25 Oct 2026 02:31:00 +0200 Subject: [PATCH 2/2] Tests: run local Robolectric suites in up to four JVMs A full local unit run went from about 16 minutes to under 6. CI keeps one JVM, -Ptest.forks=N still overrides. --- app/build.gradle.kts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 422e68d..06020ba 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -92,8 +92,12 @@ android { it.jvmArgs("--add-exports=java.base/jdk.internal.access=ALL-UNNAMED", "--add-opens=java.base/java.io=ALL-UNNAMED") // One JVM per test class: Robolectric apps in one JVM share background work and settings files. it.forkEvery = 1 - // Local runs may use several test JVMs (-Ptest.forks=N); CI leaves the default of one. - providers.gradleProperty("test.forks").orNull?.toIntOrNull()?.let { n -> it.maxParallelForks = n } + // Local runs use a test JVM per four cores, at most four (each Robolectric JVM holds about 1 GB; six ran a + // 32 GB PC out of memory). CI keeps one: parallel suites on a runner missed their 30 s waits. + // -Ptest.forks=N overrides both. + it.maxParallelForks = providers.gradleProperty("test.forks").orNull?.toIntOrNull() + ?: if (providers.environmentVariable("CI").isPresent) 1 + else (Runtime.getRuntime().availableProcessors() / 4).coerceIn(1, 4) // Design-review screenshots: ./gradlew :app:testDebugUnitTest --tests '*ScreenshotTest' -Pscreenshots.dir= providers.gradleProperty("screenshots.dir").orNull?.let { dir -> it.systemProperty("screenshots.dir", dir) } }