I’m trying to debug a compose test that I can’t get to work by saving a screenshot, but the file is ...
m
I’m trying to debug a compose test that I can’t get to work by saving a screenshot, but the file is just a transparent PNG. It’s not actually capturing anything. Does anyone know what I’m doing wrong here? https://github.com/mfearby/Magnificat/blob/main/src/test/kotlin/com/marcfearby/view/tab/FileTabKtTest.kt Thanks.
a
You need another waitForIdle after the mouse input.
Also, I think you’re mixing two instances of the test environment. You need either rule or runDesktopComposeUiTest, not both.
Copy code
@OptIn(ExperimentalTestApi::class)
    @Test
    fun moveSplitter() = runDesktopComposeUiTest(400, 400) {
        setContent {
            Box(
                Modifier.fillMaxSize().background(Color.Green)
            )
        }

        waitForIdle()
        saveScreenShot(this)
    }
m
Thank you very much. I have fixed it now with your advice. I got the test to work now, but I still needed a
Thread.sleep(200)
after the
waitForIdle()
before my assertions would pass.
a
I’m working on fixing that, we’ll probably release a more stable version of the test API in 1.5