On Any click event I have to test a Snackbar
is shown I created a custom shadow Snackbar
using: https://github.com/cafesilencio/snackbarshadow
and in testing i called it as:
registerBtn.performClick();
Snackbar snack = ShadowSnackbar.getLatestSnackbar(); // i always get null here
assertNotNull(snack); //fails
ShadowSnackbar shadowSnackbar = ShadowSnackbar.shadowOf(ShadowSnackbar.getLatestSnackbar());
assertEquals("asdasd",shadowSnackbar.getTextOfLatestSnackbar());
any help guyss!!!
Snackbar snackbar=Snackbar.make(view, "message", Snackbar.LENGTH_SHORT);
if(snackbar.isShown())
{
//do something
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.