Skip to content

Commit

Permalink
Fix flaky test by localizing date input
Browse files Browse the repository at this point in the history
  • Loading branch information
Faltenreich committed Jan 27, 2024
1 parent b9f5206 commit 60e4860
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand Down

0 comments on commit 60e4860

Please sign in to comment.