@@ -1233,6 +1233,50 @@ class SettingsTest : BaseUiTest() {
12331233 checkViewIsDisplayed(allOf(withId(R .id.tvCsvExportSettingsTimeEnded), withText(timeEnded)))
12341234 }
12351235
1236+ @Test
1237+ fun showRecordsCalendar () {
1238+ val name = " Test"
1239+
1240+ // Add activity
1241+ testUtils.addActivity(name = name)
1242+ testUtils.addRecord(name)
1243+
1244+ // Record is shown
1245+ NavUtils .openRecordsScreen()
1246+ checkViewDoesNotExist(allOf(withId(R .id.viewRecordsCalendar), isCompletelyDisplayed()))
1247+ checkViewDoesNotExist(allOf(withId(R .id.tvRecordsCalendarHint), isCompletelyDisplayed()))
1248+ checkViewIsDisplayed(allOf(withId(R .id.rvRecordsList), isCompletelyDisplayed()))
1249+ checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed()))
1250+
1251+ // Change setting
1252+ NavUtils .openSettingsScreen()
1253+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo())
1254+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked()))
1255+ unconstrainedClickOnView(withId(R .id.checkboxSettingsShowRecordsCalendar))
1256+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked()))
1257+
1258+ // Record is not shown
1259+ NavUtils .openRecordsScreen()
1260+ checkViewIsDisplayed(allOf(withId(R .id.viewRecordsCalendar), isCompletelyDisplayed()))
1261+ checkViewIsDisplayed(allOf(withId(R .id.tvRecordsCalendarHint), isCompletelyDisplayed()))
1262+ checkViewDoesNotExist(allOf(withId(R .id.rvRecordsList), isCompletelyDisplayed()))
1263+ checkViewDoesNotExist(allOf(withText(name), isCompletelyDisplayed()))
1264+
1265+ // Change setting
1266+ NavUtils .openSettingsScreen()
1267+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo())
1268+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked()))
1269+ unconstrainedClickOnView(withId(R .id.checkboxSettingsShowRecordsCalendar))
1270+ onView(withId(R .id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked()))
1271+
1272+ // Record is shown
1273+ NavUtils .openRecordsScreen()
1274+ checkViewDoesNotExist(allOf(withId(R .id.viewRecordsCalendar), isCompletelyDisplayed()))
1275+ checkViewDoesNotExist(allOf(withId(R .id.tvRecordsCalendarHint), isCompletelyDisplayed()))
1276+ checkViewIsDisplayed(allOf(withId(R .id.rvRecordsList), isCompletelyDisplayed()))
1277+ checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed()))
1278+ }
1279+
12361280 private fun clearDuration () {
12371281 repeat(6 ) { clickOnViewWithId(R .id.ivDurationPickerDelete) }
12381282 }
0 commit comments