From 60e486023c877ff87d90def5ddf2828818fd1cdb Mon Sep 17 00:00:00 2001 From: Faltenreich Date: Sat, 27 Jan 2024 14:03:41 +0100 Subject: [PATCH] Fix flaky test by localizing date input --- .../faltenreich/diaguard/test/espresso/DateTimeUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/com/faltenreich/diaguard/test/espresso/DateTimeUtils.java b/app/src/androidTest/java/com/faltenreich/diaguard/test/espresso/DateTimeUtils.java index 14528f136..ef7570d92 100644 --- a/app/src/androidTest/java/com/faltenreich/diaguard/test/espresso/DateTimeUtils.java +++ b/app/src/androidTest/java/com/faltenreich/diaguard/test/espresso/DateTimeUtils.java @@ -19,7 +19,7 @@ public static void setDate(LocalDate date){ Espresso.onView(ViewMatchers.withTagValue((Matchers.is("TOGGLE_BUTTON_TAG")))) .perform(ViewActions.click()); Espresso.onView(ViewMatchers.withId(com.google.android.material.R.id.mtrl_picker_text_input_date)) - .perform(TextInputLayoutActions.replaceText(DateTimeFormat.forPattern("M/d/yy").print(date))); + .perform(TextInputLayoutActions.replaceText(DateTimeFormat.shortDate().print(date))); Espresso.onView(ViewMatchers.withId(com.google.android.material.R.id.confirm_button)) .perform(ViewActions.click()); } @@ -28,9 +28,9 @@ public static void setDateRange(LocalDate start, LocalDate end){ Espresso.onView(ViewMatchers.withTagValue((Matchers.is("TOGGLE_BUTTON_TAG")))) .perform(ViewActions.click()); Espresso.onView(ViewMatchers.withId(com.google.android.material.R.id.mtrl_picker_text_input_range_start)) - .perform(TextInputLayoutActions.replaceText(DateTimeFormat.forPattern("M/d/yy").print(start))); + .perform(TextInputLayoutActions.replaceText(DateTimeFormat.shortDate().print(start))); Espresso.onView(ViewMatchers.withId(com.google.android.material.R.id.mtrl_picker_text_input_range_end)) - .perform(TextInputLayoutActions.replaceText(DateTimeFormat.forPattern("M/d/yy").print(end))); + .perform(TextInputLayoutActions.replaceText(DateTimeFormat.shortDate().print(end))); Espresso.onView(ViewMatchers.withId(com.google.android.material.R.id.confirm_button)) .perform(ViewActions.click()); }