mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 06:28:45 +03:00
Merge pull request #7129 from vector-im/feature/adm/screenshot-testing-example-test
Example screenshot test
This commit is contained in:
commit
d308b72868
4 changed files with 51 additions and 1 deletions
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
||||||
|
|
||||||
- name: Archive Screenshot Results on Error
|
- name: Archive Screenshot Results on Error
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: screenshot-results
|
name: screenshot-results
|
||||||
path: |
|
path: |
|
||||||
|
|
|
@ -312,6 +312,7 @@ ext.initScreenshotTests = { project ->
|
||||||
if (hasScreenshots) {
|
if (hasScreenshots) {
|
||||||
project.apply plugin: 'app.cash.paparazzi'
|
project.apply plugin: 'app.cash.paparazzi'
|
||||||
}
|
}
|
||||||
|
project.dependencies { testCompileOnly "app.cash.paparazzi:paparazzi:1.0.0" }
|
||||||
project.android.testOptions.unitTests.all {
|
project.android.testOptions.unitTests.all {
|
||||||
def screenshotTestCapture = "**/*ScreenshotTest*"
|
def screenshotTestCapture = "**/*ScreenshotTest*"
|
||||||
if (hasScreenshots) {
|
if (hasScreenshots) {
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.screenshot
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import app.cash.paparazzi.DeviceConfig.Companion.PIXEL_3
|
||||||
|
import app.cash.paparazzi.Paparazzi
|
||||||
|
import im.vector.app.R
|
||||||
|
import org.junit.Rule
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class PaparazziExampleScreenshotTest {
|
||||||
|
|
||||||
|
@get:Rule
|
||||||
|
val paparazzi = Paparazzi(
|
||||||
|
deviceConfig = PIXEL_3,
|
||||||
|
theme = "Theme.Vector.Light",
|
||||||
|
maxPercentDifference = 0.0,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `example paparazzi test`() {
|
||||||
|
val view = paparazzi.inflate<ConstraintLayout>(R.layout.item_radio)
|
||||||
|
|
||||||
|
view.findViewById<TextView>(R.id.actionTitle).text = paparazzi.resources.getString(R.string.room_settings_all_messages)
|
||||||
|
view.findViewById<ImageView>(R.id.radioIcon).setImageResource(R.drawable.ic_radio_on)
|
||||||
|
|
||||||
|
paparazzi.snapshot(view)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:113cf006e9a881f19b79462297cf276aea2b82268182f9ecc297d4b31640b507
|
||||||
|
size 11174
|
Loading…
Reference in a new issue