From a58d3e4cf08e8e26f39689e79189bccb663e8a66 Mon Sep 17 00:00:00 2001 From: eshna sengupta Date: Mon, 13 Nov 2017 15:52:44 -0700 Subject: [PATCH] fixed bug in UserLoginActivityTest --- .../cupofjava/UserLoginActivityTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/com/cmput301f17t11/cupofjava/UserLoginActivityTest.java b/app/src/androidTest/java/com/cmput301f17t11/cupofjava/UserLoginActivityTest.java index 6af5496..7ae81b5 100644 --- a/app/src/androidTest/java/com/cmput301f17t11/cupofjava/UserLoginActivityTest.java +++ b/app/src/androidTest/java/com/cmput301f17t11/cupofjava/UserLoginActivityTest.java @@ -73,11 +73,12 @@ public void testLogin(){ final ListView habitList = activity.getListView(); - Habit habit = (Habit) habitList.getItemAtPosition(0); + + Habit habit = (Habit) habitList.getItemAtPosition(habitList.getCount()-1); assertEquals("Disciplining Kids", habit.getHabitTitle()); assertEquals("Good Nanny",habit.getHabitReason()); - solo.clickInList(0); + solo.clickInList(habitList.getCount()-1); solo.assertCurrentActivity("wrong activity", HabitDetailViewActivity.class); assertTrue(solo.waitForText("Disciplining Kids", 1, 1000)); assertTrue(solo.waitForText("Good Nanny", 1, 1000)); @@ -96,11 +97,12 @@ public void testLogin(){ final ListView habitList2 = activity2.getListView(); - Habit myhabit = (Habit) habitList.getItemAtPosition(0); + + Habit myhabit = (Habit) habitList.getItemAtPosition(habitList.getCount()-1); assertEquals("Disciplining Kids", myhabit.getHabitTitle()); assertEquals("Good Nanny",myhabit.getHabitReason()); - solo.clickInList(0); + solo.clickInList(habitList.getCount()-1); solo.assertCurrentActivity("wrong activity", HabitDetailViewActivity.class); assertTrue(solo.waitForText("Disciplining Kids", 1, 1000)); assertTrue(solo.waitForText("Good Nanny", 1, 1000));