mirror of
https://github.com/ProtonMail/protoncore_android.git
synced 2026-05-15 09:50:41 +00:00
test: Added Basic Paparazzi Snapshot Tests.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
**/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text
|
||||
+1
-1
@@ -164,7 +164,7 @@ unit-tests-and-coverage-report:
|
||||
- assemble
|
||||
stage: test
|
||||
script:
|
||||
- ./gradlew -Pci --console=plain koverVerify coberturaXmlReport globalLineCoverage :coverage:koverHtmlReport -x :coverage:jacocoToCobertura
|
||||
- ./gradlew -Pci --console=plain koverVerify coberturaXmlReport globalLineCoverage :coverage:koverHtmlReport -x :coverage:jacocoToCobertura verifyPaparazziDebug
|
||||
coverage: /TotalLineCoverage.*?(\d{1,3}\.\d{0,2})%/
|
||||
interruptible: true
|
||||
artifacts:
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Proton Technologies AG
|
||||
* This file is part of Proton Technologies AG and ProtonCore.
|
||||
*
|
||||
* ProtonCore 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.
|
||||
*
|
||||
* ProtonCore 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 ProtonCore. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.proton.core.auth.presentation
|
||||
|
||||
import android.widget.ScrollView
|
||||
import app.cash.paparazzi.DeviceConfig
|
||||
import app.cash.paparazzi.Paparazzi
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SnapshotAddAccountThemeTest {
|
||||
|
||||
@get:Rule
|
||||
val paparazzi = Paparazzi(
|
||||
deviceConfig = DeviceConfig.PIXEL_5,
|
||||
theme = "ProtonTheme.AddAccount"
|
||||
)
|
||||
|
||||
@Test
|
||||
fun addAccountLayout() {
|
||||
val view = paparazzi.inflate<ScrollView>(R.layout.activity_add_account)
|
||||
paparazzi.snapshot(view)
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Proton Technologies AG
|
||||
* This file is part of Proton Technologies AG and ProtonCore.
|
||||
*
|
||||
* ProtonCore 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.
|
||||
*
|
||||
* ProtonCore 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 ProtonCore. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.proton.core.auth.presentation
|
||||
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import app.cash.paparazzi.DeviceConfig
|
||||
import app.cash.paparazzi.Paparazzi
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SnapshotProtonThemeTest {
|
||||
|
||||
@get:Rule
|
||||
val paparazzi = Paparazzi(
|
||||
deviceConfig = DeviceConfig.PIXEL_5,
|
||||
theme = "ProtonTheme"
|
||||
)
|
||||
|
||||
@Test
|
||||
fun authHelpLayout() {
|
||||
val view = paparazzi.inflate<CoordinatorLayout>(R.layout.activity_auth_help)
|
||||
paparazzi.snapshot(view)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a22e54880d6aea9dd399999b425764bd277b6b9cdeb6b592d9a587c617429a41
|
||||
size 127172
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:da00e77afada9022ceb7692f962298ca87321ae8ac553d5bf845dc3b91dbfbfd
|
||||
size 33341
|
||||
@@ -16,6 +16,7 @@ kotlinBinaryCompatibilityValidator = "0.12.1"
|
||||
kotlinx-kover = "0.7.0"
|
||||
jacoco-to-cobertura = "1.1.0"
|
||||
vanniktechPublish = "0.18.0"
|
||||
paparazzi = "1.2.0"
|
||||
|
||||
[plugins]
|
||||
benManes-versions-gradle = { id = "com.github.ben-manes.versions", version.ref = "benManesVersions" }
|
||||
@@ -26,6 +27,7 @@ kotlin-gradle = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinx-kover" }
|
||||
jacoco-to-cobertura = { id = "net.razvan.jacoco-to-cobertura", version.ref = "jacoco-to-cobertura" }
|
||||
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }
|
||||
|
||||
[libraries]
|
||||
android-gradle = { module = "com.android.tools.build:gradle", version.ref = "androidGradle" }
|
||||
@@ -46,3 +48,4 @@ kotlin-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializat
|
||||
kotlinx-kover = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kotlinx-kover" }
|
||||
jacoco-to-cobertura = { module = "net.razvan:JacocoToCoberturaPlugin", version.ref = "jacoco-to-cobertura" }
|
||||
vanniktech-mavenPublish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "vanniktechPublish" }
|
||||
paparazzi-gradle-plugin = { module = "app.cash.paparazzi:paparazzi-gradle-plugin", version.ref = "paparazzi" }
|
||||
|
||||
@@ -85,4 +85,5 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
||||
compileOnly(libs.android.gradle)
|
||||
api(libs.easyGradle.androidDsl)
|
||||
api(libs.paparazzi.gradle.plugin)
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ internal object PluginIds {
|
||||
const val kapt = "org.jetbrains.kotlin.kapt"
|
||||
const val kotlinAndroid = "org.jetbrains.kotlin.android"
|
||||
const val kotlinJvm = "org.jetbrains.kotlin.jvm"
|
||||
const val paparazzi = "app.cash.paparazzi"
|
||||
}
|
||||
|
||||
+6
@@ -34,4 +34,10 @@ public class AndroidUiLibraryPlugin : BaseAndroidPlugin<AndroidUiLibraryExtensio
|
||||
}
|
||||
|
||||
override fun createPluginExtension(target: Project): AndroidUiLibraryExtension = target.createProtonExt()
|
||||
|
||||
override fun apply(target: Project) {
|
||||
super.apply(target)
|
||||
|
||||
target.pluginManager.apply(PluginIds.paparazzi)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Proton Technologies AG
|
||||
* This file is part of Proton Technologies AG and ProtonCore.
|
||||
*
|
||||
* ProtonCore 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.
|
||||
*
|
||||
* ProtonCore 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 ProtonCore. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.proton.core.presentation
|
||||
|
||||
import app.cash.paparazzi.DeviceConfig
|
||||
import app.cash.paparazzi.Paparazzi
|
||||
import me.proton.core.presentation.ui.view.ProtonProgressButton
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SnapshotProtonThemeTest {
|
||||
|
||||
@get:Rule
|
||||
val paparazzi = Paparazzi(
|
||||
deviceConfig = DeviceConfig.PIXEL_5,
|
||||
theme = "ProtonTheme"
|
||||
)
|
||||
|
||||
@Test
|
||||
fun protonProgressButtonIdle() {
|
||||
val view = ProtonProgressButton(paparazzi.context)
|
||||
view.text = "Button"
|
||||
view.setIdle()
|
||||
paparazzi.snapshot(view)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun protonProgressButtonLoading() {
|
||||
val view = ProtonProgressButton(paparazzi.context)
|
||||
view.text = "Button"
|
||||
view.setLoading()
|
||||
paparazzi.snapshot(view)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8a59df2b7412237dad2066c55c816b2e1732dfe23ec82ea25a9150232850851a
|
||||
size 9377
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc3eb5fd27cb81a25321270a1ce30570ae9e35fb9dace9529a9ab8f15d3471a6
|
||||
size 9851
|
||||
Reference in New Issue
Block a user