package it.unisannio.ding.ids.wedroid.app.view import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.RootMatchers.withDecorView import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest import androidx.test.rule.ActivityTestRule import it.unisannio.ding.ids.wedroid.app.R import org.hamcrest.core.IsNot.not import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) @LargeTest class NewBoardActivityTest { @get:Rule val activityRule = ActivityTestRule(NewBoardActivity::class.java) @Test fun showToastOnEmptyName() { onView(withId(R.id.newBoardDone)) .perform(click()) onView(withText(R.string.on_add_new_board_empty_name)) .inRoot(withDecorView(not(activityRule.activity.window.decorView))) .check(matches(isDisplayed())) } }