Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paparazzi screenshot tests display key instead of value #770

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Urbanczyk-Marek
Copy link

Hi guys,
according to the issue I created a sample project named paparazzi to reproduce the problem.

I have a project where I am using a Paparazzi. Paparazzi is a UI testing library to generate screenshots of the UI. You can read the Paparazzi documentation to understand what it actually does.

I have created a new kotlin multiplatform project using this wizard. In the example I added a paparazzi gradle plugin app.cash.paparazzi and other moko-resources related dependencies. I created moko-resources under the commonMain directory and added the hello_key string resource:

<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
  -->

<resources>
    <string name="hello_key">hello value</string>
</resources>

I use hello_key in @Composable Foo(). I created FooTest to test Foo():

class FooTest {
    @get:Rule
    val paparazzi = Paparazzi()

    @Test
    fun testFoo() {
        paparazzi.snapshot {
            Foo()
        }
    }
}

paparazzi.snapshot block is used to define what I want screenshot. I only want screenshot Foo(). To take screenshot you have to run ./gradlew recordPaparazziDebug. This will generate new screenshot under the composeApp/src/test/snapshots/images. But if you open the screenshot you will see hello_key instead of hello value:
image

I have opened an issue in Paparazzi but according to the comment this is probably a moko-resources bug, which registers generated string resources in the wrong way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant