Skip to content

Instantly share code, notes, and snippets.

@xuhaibahmad
Created March 30, 2020 06:52
Show Gist options
  • Save xuhaibahmad/4982775578934eb3986d94f4cbab8169 to your computer and use it in GitHub Desktop.
Save xuhaibahmad/4982775578934eb3986d94f4cbab8169 to your computer and use it in GitHub Desktop.
import androidx.test.rule.ActivityTestRule
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import com.zuhaibahmad.kaspressotestingdemo.screens.GradeCalculatorScreen
import org.junit.Rule
import org.junit.Test
class GradeCalculatorUiTest : TestCase() {
@Rule
@JvmField
var rule = ActivityTestRule(GradeCalculatorActivity::class.java, false, false)
val screen = GradeCalculatorScreen()
@Test
fun onCorrectScoreSubmit_shouldDisplayCorrectGrade() = before {
// No-op
}.after {
// No-op
}.run {
screen {
step("Open grade calculator screen") {
rule.launchActivity(null)
}
step("Submit obtained marks") {
inputMarks.replaceText("90")
buttonSubmit.click()
}
step("Verify the displayed grade is correct") {
labelGrade.hasText("Your Grade is: A")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment