mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Merge pull request #7129 from vector-im/feature/adm/screenshot-testing-example-test
Example screenshot test
This commit is contained in:
commit
d308b72868
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
- name: Archive Screenshot Results on Error
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v1
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: screenshot-results
|
||||
path: |
|
||||
|
@ -312,6 +312,7 @@ ext.initScreenshotTests = { project ->
|
||||
if (hasScreenshots) {
|
||||
project.apply plugin: 'app.cash.paparazzi'
|
||||
}
|
||||
project.dependencies { testCompileOnly "app.cash.paparazzi:paparazzi:1.0.0" }
|
||||
project.android.testOptions.unitTests.all {
|
||||
def screenshotTestCapture = "**/*ScreenshotTest*"
|
||||
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)
|
||||
}
|
||||
}
|
BIN
vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png
(Stored with Git LFS)
Normal file
BIN
vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user