Closed RedJocker closed 1 year ago
dafc1f313e50506ae89dac4b7cd7318b559181f5 - Stage4UnitTest has a test03_checkAddDialog. I would like to check that after clicking on the addButton the dialog shows up, some phrase could be typed in the EditText and then after clicking ok/positive button it's saved and shown Could you do that, please?
@RedJocker
ok
please provide stage4 task.html
I think you just need this to do what you want. Include this on AbstractUnitTests
/**
* Use this method to find views.
*
* The view existence will be assert before being returned
*/
inline fun <reified T> Dialog.findViewByString(idString: String): T {
val id = this.context.resources.getIdentifier(idString, "id", context.packageName)
val view: View? = this.findViewById(id)
val idNotFoundMessage = "View with id \"$idString\" was not found"
val wrongClassMessage = "View with id \"$idString\" is not from expected class. " +
"Expected ${T::class.java.simpleName} found ${view?.javaClass?.simpleName}"
assertNotNull(idNotFoundMessage, view)
assertTrue(wrongClassMessage, view is T)
return view as T
}
then you can use this to find views on your dialogs custom layout on tests
I'm closing this, but you can re-open if you need
Make descriptive name for the @test you would like to have on StageUnitTest. I can help implementing either implementing them myself or just giving direction on how to implement it.