Create failing regression test for issue #534

pull/542/head
Alinson S. Xavier 6 years ago
parent 315bddea96
commit dfd5c65595

@ -115,4 +115,10 @@ public class BaseUserInterfaceTest
h4.setColor(2);
habitList.update(h4);
}
protected void rotateDevice() throws Exception
{
device.setOrientationLeft();
device.setOrientationNatural();
}
}

@ -19,7 +19,6 @@
package org.isoron.uhabits.acceptance.steps;
import android.os.*;
import android.support.annotation.*;
import android.support.test.espresso.*;
import android.support.test.espresso.contrib.*;
@ -27,11 +26,9 @@ import android.support.test.uiautomator.*;
import android.support.v7.widget.*;
import org.isoron.uhabits.*;
import org.isoron.uhabits.R;
import org.isoron.uhabits.activities.habits.list.*;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
import static android.os.Build.VERSION.*;
import static android.support.test.espresso.Espresso.*;
import static android.support.test.espresso.action.ViewActions.*;
import static android.support.test.espresso.assertion.PositionAssertions.*;

@ -58,6 +58,28 @@ public class EditHabitSteps
typeTextWithId(R.id.tvDescription, name);
}
public static void setReminder()
{
onView(withId(R.id.tvReminderTime)).perform(click());
onView(withId(R.id.done_button)).perform(click());
}
public static void clickReminderDays()
{
onView(withId(R.id.tvReminderDays)).perform(click());
}
public static void unselectAllDays()
{
onView(withText("Saturday")).perform(click());
onView(withText("Sunday")).perform(click());
onView(withText("Monday")).perform(click());
onView(withText("Tuesday")).perform(click());
onView(withText("Wednesday")).perform(click());
onView(withText("Thursday")).perform(click());
onView(withText("Friday")).perform(click());
}
private static void typeTextWithId(int id, String name)
{
onView(withId(id)).perform(clearText(), typeText(name), closeSoftKeyboard());

@ -0,0 +1,48 @@
/*
* Copyright (C) 2020 Álinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.isoron.uhabits.regression
import android.support.test.filters.*
import org.isoron.uhabits.*
import org.junit.*
import org.isoron.uhabits.acceptance.steps.CommonSteps.*
import org.isoron.uhabits.acceptance.steps.EditHabitSteps.*
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*
import org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*
import org.isoron.uhabits.acceptance.steps.WidgetSteps.clickText
@LargeTest
class SavedStateRegressionTest : BaseUserInterfaceTest() {
@Test
@Throws(Exception::class)
fun shouldNotCrashWhenRotatingWeekdayPickedDialog() {
// https://github.com/iSoron/uhabits/issues/534
launchApp()
clickMenu(ADD)
setReminder()
clickReminderDays()
unselectAllDays()
rotateDevice()
clickText("Monday")
}
}
Loading…
Cancel
Save