KasperskyLab / Kaspresso

Android UI test framework

Home Page:https://kasperskylab.github.io/Kaspresso/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unresolved reference for flakySafely

crazyvan opened this issue · comments

Hi,

I've just started using Kaspresso and the first test I've written works fine until I attempt to use 'flakySafely'.
Android Studio reports that 'flakySafely' is not available for the following Kotlin object:

import com.kaspersky.kaspresso.screens.KScreen
import io.github.kakaocup.kakao.text.KButton

object WelcomeScreen : KScreen<WelcomeScreen>() {
    override val layoutId: Int? = null
    override val viewClass: Class<*>? = null

    private val logInButton: KButton =  KButton { withContentDescription("login button") }
    private val registerButton: KButton = KButton { withContentDescription("register button") }

    fun tapLogInButton() {
        WelcomeScreen {
            logInButton {
                isVisible()
                isEnabled()
                click()
            }
        }
    }

    fun tapRegisterButton() {
        WelcomeScreen {
            flakySafely(15000) {
                registerButton {
                    isVisible()
                    isEnabled()
                    click()
                }
            }
        }
    }
}
Screenshot 2024-05-18 at 18 06 25

Not sure why. Is there particular version of Kotlin that I should be using?
The project is on 1.8.20.

And in app/build.gradle I have:
androidTestImplementation 'com.kaspersky.android-components:kaspresso:1.5.3'
androidTestUtil 'androidx.test:orchestrator:1.4.2'

Figured it out. This works:

 run {
                WelcomeScreen {
                    flakySafely(3000) {
                        logInButton {
                            isVisible()
                        }
                    }
                }
        }