mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
test: Add Compose screenshot testing support
Integrate the experimental Android screenshot testing plugin into the `core:ui` module. This includes initial visual regression tests for Alert components and updates to the CI workflow for automated validation. - core/ui: Add `AlertScreenshotTest` and screenshot test dependencies - gradle.properties: Enable `android.experimental.enableScreenshotTest` - libs.versions.toml: Add `com.android.compose.screenshot` plugin and validation API - reusable-check.yml: Add screenshot validation tasks to GitHub Actions workflow
This commit is contained in:
parent
8c6bd8ab7a
commit
eacabf4bd4
10 changed files with 90 additions and 1 deletions
|
|
@ -21,9 +21,13 @@ plugins {
|
|||
alias(libs.plugins.meshtastic.android.library.compose)
|
||||
alias(libs.plugins.meshtastic.android.library.flavors)
|
||||
alias(libs.plugins.meshtastic.hilt)
|
||||
alias(libs.plugins.screenshot)
|
||||
}
|
||||
|
||||
configure<LibraryExtension> { namespace = "org.meshtastic.core.ui" }
|
||||
configure<LibraryExtension> {
|
||||
namespace = "org.meshtastic.core.ui"
|
||||
experimentalProperties["android.experimental.enableScreenshotTest"] = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.common)
|
||||
|
|
@ -55,4 +59,7 @@ dependencies {
|
|||
androidTestImplementation(libs.androidx.test.runner)
|
||||
|
||||
testImplementation(libs.junit)
|
||||
|
||||
screenshotTestImplementation(libs.screenshot.validation.api)
|
||||
screenshotTestImplementation(libs.androidx.compose.ui.tooling)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2025-2026 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.meshtastic.core.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.android.tools.screenshot.PreviewTest
|
||||
import org.meshtastic.core.ui.util.PreviewTextAlert
|
||||
import org.meshtastic.core.ui.util.PreviewIconAlert
|
||||
import org.meshtastic.core.ui.util.PreviewHtmlAlert
|
||||
import org.meshtastic.core.ui.util.PreviewMultipleChoiceAlert
|
||||
import org.meshtastic.core.ui.util.PreviewComposableAlert
|
||||
|
||||
class AlertScreenshotTest {
|
||||
|
||||
@PreviewTest
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun TextAlert() {
|
||||
PreviewTextAlert()
|
||||
}
|
||||
|
||||
@PreviewTest
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun IconAlert() {
|
||||
PreviewIconAlert()
|
||||
}
|
||||
|
||||
@PreviewTest
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun HtmlAlert() {
|
||||
PreviewHtmlAlert()
|
||||
}
|
||||
|
||||
@PreviewTest
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun MultipleChoiceAlert() {
|
||||
PreviewMultipleChoiceAlert()
|
||||
}
|
||||
|
||||
@PreviewTest
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ComposableAlert() {
|
||||
PreviewComposableAlert()
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Loading…
Add table
Add a link
Reference in a new issue