Skip to content

Instantly share code, notes, and snippets.

@Garyfimo
Created July 5, 2020 23:22
Show Gist options
  • Save Garyfimo/53cfbd573ce278602154d941220c92fd to your computer and use it in GitHub Desktop.
Save Garyfimo/53cfbd573ce278602154d941220c92fd to your computer and use it in GitHub Desktop.
internal class MainActivityTest{
@get:Rule
var activityTestRule = ActivityTestRule(MainActivity::class.java)
// Numeros
private val btnCero = onView(ViewMatchers.withId((R.id.btnCero)))
private val btnUno = onView(ViewMatchers.withId((R.id.btnUno)))
private val btnDos = onView(ViewMatchers.withId((R.id.btnDos)))
private val btnTres = onView(ViewMatchers.withId((R.id.btnTres)))
private val btnCuatro = onView(ViewMatchers.withId((R.id.btnCuatro)))
private val btnCinco = onView(ViewMatchers.withId((R.id.btnCinco)))
private val btnSeis = onView(ViewMatchers.withId((R.id.btnSeis)))
private val btnSiete = onView(ViewMatchers.withId((R.id.btnSiete)))
private val btnOcho = onView(ViewMatchers.withId((R.id.btnOcho)))
private val btnNueve = onView(ViewMatchers.withId((R.id.btnNueve)))
// Operadores
private val btnPunto = onView(ViewMatchers.withId((R.id.btnPunto)))
private val btnIgual = onView(ViewMatchers.withId((R.id.btnIgual)))
private val btnResta = onView(ViewMatchers.withId((R.id.btnResta)))
private val btnSuma = onView(ViewMatchers.withId((R.id.btnSuma)))
private val btnMultiplicacion = onView(ViewMatchers.withId((R.id.btnMultiplicacion)))
private val btnDivision = onView(ViewMatchers.withId((R.id.btnDivision)))
// Utilitarios
private val btnBorrar = onView(ViewMatchers.withId((R.id.btnBorrar)))
private val btnLimpiar = onView(ViewMatchers.withId((R.id.btnLimpiar)))
// Visualizador
private val tvVisualizadorOperacion = onView(ViewMatchers.withId((R.id.tvVisualizadorOperacion)))
private val tvVisualizadorResultado = onView(ViewMatchers.withId((R.id.tvVisualizadorResultado)))
@Test
fun verficiarQueLosNumerosSeVean() {
btnCero.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnUno.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnDos.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnTres.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnCuatro.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnCinco.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnSeis.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnSiete.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnOcho.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnNueve.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
@Test
fun verficiarQueLosOperadoresSeVean() {
btnResta.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnSuma.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnMultiplicacion.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnDivision.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
@Test
fun verficiarQueLosUtilitariosSeVean() {
btnPunto.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnIgual.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnBorrar.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
btnLimpiar.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
@Test
fun verficiarQueLosVisualizadoresSeVean() {
tvVisualizadorOperacion.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
tvVisualizadorResultado.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment