Hi I am testing for adding a new item to a class (Recipe). Everything is okay until it tries to perform the The main parts of the error message I can determine are:
androidx.test.espresso.PerformException: Error performing 'single click - At Coordinates: 539, 1647 and precision: 16, 16' on view 'with id: uk.edu.le.co2103.myrecipebook:id/button_save'.
and then
Caused by: androidx.test.espresso.PerformException: Error performing 'Send down motion event' on view 'unknown'.
and finally
Caused by: androidx.test.espresso.InjectEventSecurityException: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
My testing code is as follows
@RunWith(AndroidJUnit4.class)
public class MyRecipeBookEspressoTest {
private String Name;
private String Ing;
private String Method;
@Rule
public ActivityTestRule<MainActivity> mainActivityActivityTestRule =
new ActivityTestRule<>(MainActivity.class);
@Test
public void testAddNewRecipe() {
onView(withId(R.id.fab)).perform(click());
onView(withId(R.id.edit_recipe1))
.perform(new TypeTextAction("test Name"));
onView(withId(R.id.edit_recipe2))
.perform(new TypeTextAction("test iNG"));
onView(withId(R.id.edit_recipe3))
.perform(new TypeTextAction("test Method"));
onView(withId(R.id.button_save)).perform(click());
fail("Implement this test");
}
Aucun commentaire:
Enregistrer un commentaire