Adds a new test to design system

Change-Id: I2a40de18400c053d9dff772bceda474a376a8c48
ja/coverage_agp_gha_demo_remove
Jose Alcérreca 9 months ago
parent 0c1a8c4c8a
commit 1829d54b85

@ -194,7 +194,8 @@ jobs:
- name: Run local tests (including Roborazzi) for the combined coverage report (only API 30) - name: Run local tests (including Roborazzi) for the combined coverage report (only API 30)
if: matrix.api-level == 30 if: matrix.api-level == 30
run: ./gradlew testDemoDebugUnitTest # Add Prod if we ever add JVM tests for prod # There is no need to verify Roborazzi tests to generate coverage.
run: ./gradlew testDemoDebugUnitTest -Proborazzi.test.verify=false # Add Prod if we ever add JVM tests for prod
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod # Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants (only API 30) - name: Generate coverage reports for Debug variants (only API 30)

@ -23,6 +23,7 @@ import androidx.compose.material3.Text
import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaOutlinedButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaOutlinedButton
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaTextButton
import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons
import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme
import dagger.hilt.android.testing.HiltTestApplication import dagger.hilt.android.testing.HiltTestApplication
@ -77,4 +78,21 @@ class ButtonScreenshotTests {
} }
} }
} }
@Test
fun niaTextButton_coverageTest() {
composeTestRule.captureMultiTheme(
name = "TextButton",
overrideFileName = "TextButton",
shouldCompareAndroidTheme = false,
) { description ->
Surface {
NiaTextButton(
onClick = {},
text = { Text("Coverage test") },
leadingIcon = { Icon(imageVector = NiaIcons.Add, contentDescription = null) },
)
}
}
}
} }

Loading…
Cancel
Save