Skip to content

faruktoptas/espresso-robot-pattern-sample

Repository files navigation

Espresso Robot Pattern Sample with Spoon Integration

A showcase project for Espresso Robot pattern written in Kotlin. See the medium posts for more details:

!gif

@Test
fun loginMissingEmailPassword() {
    login {
        clickLogin()
        matchErrorText(string(R.string.missing_fields))
    }
}

@Test
fun loginMissingPassword() {
    login {
        setEmail("mail@example.com")
        clickLogin()
        matchErrorText(string(R.string.missing_fields))
    }
}

@Test
fun loginWrongPassword() {
    login {
        setEmail("mail@example.com")
        setPassword("wrong")
        clickLogin()
        matchErrorText(string(R.string.login_fail))
    }

}

@Test
fun loginSuccess() {
    login {
        setEmail("mail@example.com")
        setPassword("pass")
        clickLogin()
        matchText(R.id.tvName, string(R.string.name_surname))
    }
}

@Test
fun loginProfileAndSettings() {
    login {
        setEmail("mail@example.com")
        setPassword("pass")
        clickLogin()
    }
    profile {
        clickSettings()
        toggleNotifications()
        toggleNightMode()
    }
}