A fork of Simple Time Tracker with WearOS support. (Now integrated upstream)
0

Configure Feed

Select the types of activity you want to include in your feed.

fix test

razeeman (Apr 29, 2023, 6:07 PM +0300) f972539e 54d346f6

+3151 -2581
+135 -111
app/src/androidTest/java/com/example/util/simpletimetracker/ActivityFilterTest.kt
··· 35 35 import org.hamcrest.Matcher 36 36 import org.junit.Test 37 37 import org.junit.runner.RunWith 38 + import com.example.util.simpletimetracker.core.R as coreR 39 + import com.example.util.simpletimetracker.feature_change_activity_filter.R as changeActivityFilterR 40 + import com.example.util.simpletimetracker.feature_settings.R as settingsR 41 + import com.example.util.simpletimetracker.feature_views.R as viewsR 38 42 39 43 @HiltAndroidTest 40 44 @RunWith(AndroidJUnit4::class) ··· 57 61 testUtils.addCategory(categoryName1) 58 62 testUtils.addCategory(categoryName2) 59 63 60 - tryAction { clickOnViewWithText(R.string.running_records_add_filter) } 64 + tryAction { clickOnViewWithText(coreR.string.running_records_add_filter) } 61 65 closeSoftKeyboard() 62 66 63 67 // View is set up 64 - checkViewIsNotDisplayed(withId(R.id.btnChangeActivityFilterDelete)) 65 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterColor)) 66 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterType)) 68 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.btnChangeActivityFilterDelete)) 69 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterColor)) 70 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterType)) 67 71 68 72 // Name is not selected 69 - clickOnViewWithText(R.string.change_category_save) 73 + clickOnViewWithText(coreR.string.change_category_save) 70 74 71 75 // Typing name 72 - typeTextIntoView(R.id.etChangeActivityFilterName, name) 76 + typeTextIntoView(changeActivityFilterR.id.etChangeActivityFilterName, name) 73 77 checkPreviewUpdated(hasDescendant(withText(name))) 74 78 75 79 // Open color chooser 76 - clickOnViewWithText(R.string.change_category_color_hint) 77 - checkViewIsDisplayed(withId(R.id.rvChangeActivityFilterColor)) 78 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterType)) 80 + clickOnViewWithText(coreR.string.change_category_color_hint) 81 + checkViewIsDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterColor)) 82 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterType)) 79 83 80 84 // Selecting color 81 - clickOnRecyclerItem(R.id.rvChangeActivityFilterColor, withCardColor(firstColor)) 85 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(firstColor)) 82 86 checkPreviewUpdated(withCardColor(firstColor)) 83 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 87 + checkViewIsDisplayed( 88 + allOf(withId(changeActivityFilterR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 89 + ) 84 90 85 91 // Selecting color 86 - scrollRecyclerToPosition(R.id.rvChangeActivityFilterColor, lastColorPosition) 87 - clickOnRecyclerItem(R.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 92 + scrollRecyclerToPosition(changeActivityFilterR.id.rvChangeActivityFilterColor, lastColorPosition) 93 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 88 94 checkPreviewUpdated(withCardColor(lastColor)) 89 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 95 + checkViewIsDisplayed( 96 + allOf(withId(changeActivityFilterR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 97 + ) 90 98 91 99 // Open activity chooser 92 - clickOnViewWithText(R.string.activity_hint) 93 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterColor)) 94 - checkViewIsDisplayed(withId(R.id.rvChangeActivityFilterType)) 100 + clickOnViewWithText(coreR.string.activity_hint) 101 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterColor)) 102 + checkViewIsDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterType)) 95 103 checkViewIsDisplayed(withText(typeName1)) 96 104 checkViewIsDisplayed(withText(typeName2)) 97 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 98 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 99 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 100 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 105 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 106 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 107 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 108 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 101 109 102 110 // Selecting activity 103 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(typeName1)) 104 - checkViewIsDisplayed(withText(R.string.something_selected)) 105 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 106 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 107 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 111 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(typeName1)) 112 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 113 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 114 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 115 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 108 116 109 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(typeName2)) 110 - checkViewIsDisplayed(withText(R.string.something_selected)) 111 - checkViewDoesNotExist(withId(R.id.viewDividerItem)) 117 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(typeName2)) 118 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 119 + checkViewDoesNotExist(withId(changeActivityFilterR.id.viewDividerItem)) 112 120 checkViewIsDisplayed(withText(typeName1)) 113 121 checkViewIsDisplayed(withText(typeName2)) 114 122 115 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(typeName1)) 116 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(typeName2)) 117 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 118 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 119 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 120 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 121 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(typeName1)) 123 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(typeName1)) 124 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(typeName2)) 125 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 126 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 127 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 128 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 129 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(typeName1)) 122 130 123 131 // Open category chooser 124 - clickOnViewWithText(R.string.category_hint) 125 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterColor)) 126 - checkViewIsDisplayed(withId(R.id.rvChangeActivityFilterType)) 132 + clickOnViewWithText(coreR.string.category_hint) 133 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterColor)) 134 + checkViewIsDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterType)) 127 135 checkViewIsDisplayed(withText(categoryName1)) 128 136 checkViewIsDisplayed(withText(categoryName2)) 129 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 130 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 131 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 132 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 137 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 138 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 139 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 140 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 133 141 134 142 // Selecting category 135 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName1)) 136 - checkViewIsDisplayed(withText(R.string.something_selected)) 137 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 138 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 139 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 143 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName1)) 144 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 145 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 146 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 147 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 140 148 141 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName2)) 142 - checkViewIsDisplayed(withText(R.string.something_selected)) 143 - checkViewDoesNotExist(withId(R.id.viewDividerItem)) 149 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName2)) 150 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 151 + checkViewDoesNotExist(withId(changeActivityFilterR.id.viewDividerItem)) 144 152 checkViewIsDisplayed(withText(categoryName1)) 145 153 checkViewIsDisplayed(withText(categoryName2)) 146 154 147 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName1)) 148 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName2)) 149 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 150 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 151 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 152 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 153 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName1)) 155 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName1)) 156 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName2)) 157 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 158 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 159 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 160 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 161 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName1)) 154 162 155 163 // Types are preserved when switching filter type 156 164 clickOnView( 157 - allOf(isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), withText(R.string.activity_hint)) 165 + allOf( 166 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 167 + withText(coreR.string.activity_hint) 168 + ) 158 169 ) 159 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 160 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 170 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 171 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 161 172 clickOnView( 162 - allOf(isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), withText(R.string.category_hint)) 173 + allOf( 174 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 175 + withText(coreR.string.category_hint) 176 + ) 163 177 ) 164 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 165 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 178 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 179 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 166 180 167 181 // Save 168 182 clickOnView( 169 - allOf(isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), withText(R.string.activity_hint)) 183 + allOf( 184 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 185 + withText(coreR.string.activity_hint) 186 + ) 170 187 ) 171 - clickOnViewWithText(R.string.change_activity_filter_save) 188 + clickOnViewWithText(coreR.string.change_activity_filter_save) 172 189 173 190 // Filter added 174 191 checkViewIsDisplayed(withText(name)) ··· 176 193 177 194 // Check types saved 178 195 longClickOnView(withText(name)) 179 - clickOnViewWithText(R.string.activity_hint) 180 - checkViewIsDisplayed(withText(R.string.something_selected)) 181 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 182 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 183 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 196 + clickOnViewWithText(coreR.string.activity_hint) 197 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 198 + checkViewIsDisplayed(withId(changeActivityFilterR.id.viewDividerItem)) 199 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 200 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 184 201 } 185 202 186 203 @Test ··· 206 223 tryAction { longClickOnView(withText(name)) } 207 224 208 225 // View is set up 209 - checkViewIsDisplayed(withId(R.id.btnChangeActivityFilterDelete)) 210 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterColor)) 211 - checkViewIsNotDisplayed(withId(R.id.rvChangeActivityFilterType)) 212 - checkViewIsDisplayed(allOf(withId(R.id.etChangeActivityFilterName), withText(name))) 226 + checkViewIsDisplayed(withId(changeActivityFilterR.id.btnChangeActivityFilterDelete)) 227 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterColor)) 228 + checkViewIsNotDisplayed(withId(changeActivityFilterR.id.rvChangeActivityFilterType)) 229 + checkViewIsDisplayed(allOf(withId(changeActivityFilterR.id.etChangeActivityFilterName), withText(name))) 213 230 214 231 // Preview is updated 215 232 checkPreviewUpdated(hasDescendant(withText(name))) 216 233 checkPreviewUpdated(withCardColor(firstColor)) 217 234 218 235 // Change name 219 - typeTextIntoView(R.id.etChangeActivityFilterName, newName) 236 + typeTextIntoView(changeActivityFilterR.id.etChangeActivityFilterName, newName) 220 237 checkPreviewUpdated(hasDescendant(withText(newName))) 221 238 222 239 // Change color 223 - clickOnViewWithText(R.string.change_category_color_hint) 224 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 225 - scrollRecyclerToView(R.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 226 - clickOnRecyclerItem(R.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 240 + clickOnViewWithText(coreR.string.change_category_color_hint) 241 + checkViewIsDisplayed( 242 + allOf(withId(changeActivityFilterR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 243 + ) 244 + scrollRecyclerToView(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 245 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(lastColor)) 227 246 checkPreviewUpdated(withCardColor(lastColor)) 228 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 247 + checkViewIsDisplayed( 248 + allOf(withId(changeActivityFilterR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 249 + ) 229 250 230 251 // Change types 231 - clickOnViewWithText(R.string.activity_hint) 232 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 233 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 252 + clickOnViewWithText(coreR.string.activity_hint) 253 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 254 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 234 255 clickOnView( 235 - allOf(isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), withText(R.string.category_hint)) 256 + allOf( 257 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 258 + withText(coreR.string.category_hint) 259 + ) 236 260 ) 237 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(categoryName2)) 238 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 239 - onView(withText(categoryName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 261 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(categoryName2)) 262 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 263 + onView(withText(categoryName2)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 240 264 241 265 // Save 242 - clickOnViewWithText(R.string.change_activity_filter_save) 266 + clickOnViewWithText(coreR.string.change_activity_filter_save) 243 267 244 268 // Filter updated 245 269 checkViewIsDisplayed(withText(newName)) 246 270 checkViewIsDisplayed(withCardColor(lastColor)) 247 271 longClickOnView(withText(newName)) 248 - clickOnViewWithText(R.string.activity_hint) 249 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 250 - onView(withText(categoryName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 272 + clickOnViewWithText(coreR.string.activity_hint) 273 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeActivityFilterR.id.viewDividerItem))) 274 + onView(withText(categoryName2)).check(isCompletelyAbove(withId(changeActivityFilterR.id.viewDividerItem))) 251 275 } 252 276 253 277 @Test 254 278 fun addActivityFilterEmpty() { 255 279 showActivityFilters() 256 280 257 - tryAction { clickOnViewWithText(R.string.running_records_add_filter) } 258 - clickOnView(withText(R.string.activity_hint)) 281 + tryAction { clickOnViewWithText(coreR.string.running_records_add_filter) } 282 + clickOnView(withText(coreR.string.activity_hint)) 259 283 260 284 // Activities empty 261 285 clickOnView( 262 286 allOf( 263 - isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), 264 - withText(R.string.activity_hint) 287 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 288 + withText(coreR.string.activity_hint) 265 289 ) 266 290 ) 267 - checkViewIsDisplayed(withText(R.string.record_types_empty)) 291 + checkViewIsDisplayed(withText(coreR.string.record_types_empty)) 268 292 269 293 // Categories empty 270 294 clickOnView( 271 295 allOf( 272 - isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), 273 - withText(R.string.category_hint) 296 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 297 + withText(coreR.string.category_hint) 274 298 ) 275 299 ) 276 - checkViewIsDisplayed(withText(R.string.change_record_type_categories_empty)) 300 + checkViewIsDisplayed(withText(coreR.string.change_record_type_categories_empty)) 277 301 } 278 302 279 303 @Test ··· 347 371 ) 348 372 349 373 // Check filtering 350 - tryAction { checkFilter(filterByActivity1, R.color.colorFiltered) } 351 - checkFilter(filterByActivity2, R.color.colorFiltered) 352 - checkFilter(filterByCategory1, R.color.colorFiltered) 353 - checkFilter(filterByCategory2, R.color.colorFiltered) 354 - checkFilter(filterByCategoryAll, R.color.colorFiltered) 355 - checkFilter(filterEmpty, R.color.colorFiltered) 374 + tryAction { checkFilter(filterByActivity1, viewsR.color.colorFiltered) } 375 + checkFilter(filterByActivity2, viewsR.color.colorFiltered) 376 + checkFilter(filterByCategory1, viewsR.color.colorFiltered) 377 + checkFilter(filterByCategory2, viewsR.color.colorFiltered) 378 + checkFilter(filterByCategoryAll, viewsR.color.colorFiltered) 379 + checkFilter(filterEmpty, viewsR.color.colorFiltered) 356 380 checkTypes(displayed = availableTypes, available = availableTypes) 357 381 358 382 clickOnViewWithText(filterByActivity1) ··· 476 500 // Change setting 477 501 NavUtils.openSettingsScreen() 478 502 NavUtils.openSettingsDisplay() 479 - onView(withId(R.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 480 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowActivityFilters)) 503 + onView(withId(settingsR.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 504 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowActivityFilters)) 481 505 482 506 // Filtering appears 483 507 NavUtils.openRunningRecordsScreen() ··· 486 510 487 511 // Change setting 488 512 NavUtils.openSettingsScreen() 489 - onView(withId(R.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 490 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowActivityFilters)) 513 + onView(withId(settingsR.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 514 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowActivityFilters)) 491 515 492 516 // No filtering 493 517 NavUtils.openRunningRecordsScreen() ··· 516 540 } 517 541 518 542 private fun checkPreviewUpdated(matcher: Matcher<View>) = 519 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeActivityFilter), matcher)) 543 + checkViewIsDisplayed(allOf(withId(changeActivityFilterR.id.previewChangeActivityFilter), matcher)) 520 544 }
+65 -58
app/src/androidTest/java/com/example/util/simpletimetracker/AddCategoryTest.kt
··· 28 28 import org.hamcrest.Matcher 29 29 import org.junit.Test 30 30 import org.junit.runner.RunWith 31 + import com.example.util.simpletimetracker.core.R as coreR 32 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 33 + import com.example.util.simpletimetracker.feature_change_category.R as changeCategoryR 31 34 32 35 @HiltAndroidTest 33 36 @RunWith(AndroidJUnit4::class) ··· 46 49 47 50 NavUtils.openSettingsScreen() 48 51 NavUtils.openCategoriesScreen() 49 - checkViewIsDisplayed(withText(R.string.categories_record_type_hint)) 50 - clickOnViewWithText(R.string.categories_add_category) 52 + checkViewIsDisplayed(withText(coreR.string.categories_record_type_hint)) 53 + clickOnViewWithText(coreR.string.categories_add_category) 51 54 closeSoftKeyboard() 52 55 53 56 // View is set up 54 - checkViewIsNotDisplayed(withId(R.id.btnChangeCategoryDelete)) 55 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryColor)) 56 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryType)) 57 + checkViewIsNotDisplayed(withId(changeCategoryR.id.btnChangeCategoryDelete)) 58 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryColor)) 59 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryType)) 57 60 58 61 // Name is not selected 59 - clickOnViewWithText(R.string.change_category_save) 62 + clickOnViewWithText(coreR.string.change_category_save) 60 63 61 64 // Typing name 62 - typeTextIntoView(R.id.etChangeCategoryName, name) 65 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, name) 63 66 checkPreviewUpdated(hasDescendant(withText(name))) 64 67 65 68 // Open color chooser 66 - clickOnViewWithText(R.string.change_category_color_hint) 67 - checkViewIsDisplayed(withId(R.id.rvChangeCategoryColor)) 68 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryType)) 69 + clickOnViewWithText(coreR.string.change_category_color_hint) 70 + checkViewIsDisplayed(withId(changeCategoryR.id.rvChangeCategoryColor)) 71 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryType)) 69 72 70 73 // Selecting color 71 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withCardColor(firstColor)) 74 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withCardColor(firstColor)) 72 75 checkPreviewUpdated(withCardColor(firstColor)) 73 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 76 + checkViewIsDisplayed( 77 + allOf(withId(changeCategoryR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 78 + ) 74 79 75 80 // Selecting color 76 - scrollRecyclerToPosition(R.id.rvChangeCategoryColor, lastColorPosition) 77 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withCardColor(lastColor)) 81 + scrollRecyclerToPosition(changeCategoryR.id.rvChangeCategoryColor, lastColorPosition) 82 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withCardColor(lastColor)) 78 83 checkPreviewUpdated(withCardColor(lastColor)) 79 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 84 + checkViewIsDisplayed( 85 + allOf(withId(changeCategoryR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 86 + ) 80 87 81 88 // Open activity chooser 82 - clickOnViewWithText(R.string.change_category_types_hint) 83 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryColor)) 84 - checkViewIsDisplayed(withId(R.id.rvChangeCategoryType)) 89 + clickOnViewWithText(coreR.string.change_category_types_hint) 90 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryColor)) 91 + checkViewIsDisplayed(withId(changeCategoryR.id.rvChangeCategoryType)) 85 92 checkViewIsDisplayed(withText(typeName1)) 86 93 checkViewIsDisplayed(withText(typeName2)) 87 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 88 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 89 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 90 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 94 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 95 + checkViewIsDisplayed(withId(changeCategoryR.id.viewDividerItem)) 96 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 97 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 91 98 92 99 // Selecting activity 93 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 94 - checkViewIsDisplayed(withText(R.string.something_selected)) 95 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 96 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 97 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 100 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 101 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 102 + checkViewIsDisplayed(withId(changeCategoryR.id.viewDividerItem)) 103 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeCategoryR.id.viewDividerItem))) 104 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 98 105 99 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName2)) 100 - checkViewIsDisplayed(withText(R.string.something_selected)) 101 - checkViewDoesNotExist(withId(R.id.viewDividerItem)) 106 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName2)) 107 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 108 + checkViewDoesNotExist(withId(changeCategoryR.id.viewDividerItem)) 102 109 checkViewIsDisplayed(withText(typeName1)) 103 110 checkViewIsDisplayed(withText(typeName2)) 104 111 105 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 106 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName2)) 107 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 108 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 109 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 110 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 112 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 113 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName2)) 114 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 115 + checkViewIsDisplayed(withId(changeCategoryR.id.viewDividerItem)) 116 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 117 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 111 118 112 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 113 - clickOnViewWithText(R.string.change_record_type_save) 119 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 120 + clickOnViewWithText(coreR.string.change_record_type_save) 114 121 115 122 // Category type added 116 123 checkViewIsDisplayed(withText(name)) ··· 118 125 119 126 // Check types saved 120 127 longClickOnView(withText(name)) 121 - clickOnViewWithText(R.string.change_category_types_hint) 122 - checkViewIsDisplayed(withText(R.string.something_selected)) 123 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 124 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 125 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 128 + clickOnViewWithText(coreR.string.change_category_types_hint) 129 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 130 + checkViewIsDisplayed(withId(baseR.id.viewDividerItem)) 131 + onView(withText(typeName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 132 + onView(withText(typeName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 126 133 } 127 134 128 135 @Test 129 136 fun addCategoryTypesEmpty() { 130 137 NavUtils.openSettingsScreen() 131 138 NavUtils.openCategoriesScreen() 132 - clickOnViewWithText(R.string.categories_add_category) 139 + clickOnViewWithText(coreR.string.categories_add_category) 133 140 134 141 // Open activity chooser 135 - clickOnViewWithText(R.string.change_category_types_hint) 136 - checkViewIsDisplayed(withText(R.string.record_types_empty)) 142 + clickOnViewWithText(coreR.string.change_category_types_hint) 143 + checkViewIsDisplayed(withText(coreR.string.record_types_empty)) 137 144 } 138 145 139 146 @Test ··· 150 157 tryAction { longClickOnView(withText(typeName1)) } 151 158 152 159 // Add category 153 - clickOnViewWithText(R.string.category_hint) 154 - clickOnViewWithText(R.string.categories_add_category) 155 - typeTextIntoView(R.id.etChangeCategoryName, categoryName1) 160 + clickOnViewWithText(coreR.string.category_hint) 161 + clickOnViewWithText(coreR.string.categories_add_category) 162 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, categoryName1) 156 163 closeSoftKeyboard() 157 164 158 165 // Activity already selected 159 - clickOnViewWithText(R.string.change_category_types_hint) 160 - checkViewIsDisplayed(withText(R.string.something_selected)) 161 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 162 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 163 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 166 + clickOnViewWithText(coreR.string.change_category_types_hint) 167 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 168 + checkViewIsDisplayed(withId(baseR.id.viewDividerItem)) 169 + onView(withText(typeName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 170 + onView(withText(typeName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 164 171 165 172 // Category added 166 - clickOnViewWithText(R.string.change_category_save) 173 + clickOnViewWithText(coreR.string.change_category_save) 167 174 checkViewIsDisplayed(withText(categoryName1)) 168 175 169 176 // Change category 170 177 longClickOnView(withText(categoryName1)) 171 - typeTextIntoView(R.id.etChangeCategoryName, categoryName2) 178 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, categoryName2) 172 179 closeSoftKeyboard() 173 - clickOnViewWithText(R.string.change_category_save) 180 + clickOnViewWithText(coreR.string.change_category_save) 174 181 175 182 // Category changed 176 183 checkViewDoesNotExist(withText(categoryName1)) ··· 178 185 } 179 186 180 187 private fun checkPreviewUpdated(matcher: Matcher<View>) = 181 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeCategory), matcher)) 188 + checkViewIsDisplayed(allOf(withId(changeCategoryR.id.previewChangeCategory), matcher)) 182 189 }
+22 -19
app/src/androidTest/java/com/example/util/simpletimetracker/AddDefaultRecordTypeTest.kt
··· 16 16 import org.hamcrest.CoreMatchers.allOf 17 17 import org.junit.Test 18 18 import org.junit.runner.RunWith 19 + import com.example.util.simpletimetracker.core.R as coreR 20 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 21 + import com.example.util.simpletimetracker.feature_views.R as viewsR 19 22 20 23 @HiltAndroidTest 21 24 @RunWith(AndroidJUnit4::class) ··· 28 31 val name2 = "Work" 29 32 val color2 = ColorMapper.getAvailableColors()[10] 30 33 31 - tryAction { checkViewIsDisplayed(withText(R.string.running_records_types_empty)) } 32 - checkViewIsDisplayed(withText(R.string.running_records_add_type)) 33 - checkViewIsDisplayed(withText(R.string.running_records_add_default)) 34 + tryAction { checkViewIsDisplayed(withText(coreR.string.running_records_types_empty)) } 35 + checkViewIsDisplayed(withText(coreR.string.running_records_add_type)) 36 + checkViewIsDisplayed(withText(coreR.string.running_records_add_default)) 34 37 35 38 // Open dialog 36 - clickOnViewWithText(R.string.running_records_add_default) 39 + clickOnViewWithText(coreR.string.running_records_add_default) 37 40 Thread.sleep(1000) 38 41 checkActivity(name1, color1) 39 42 checkActivity(name2, color2) 40 43 41 44 // Close without saving 42 45 pressBack() 43 - checkViewIsDisplayed(withText(R.string.running_records_add_type)) 44 - checkViewIsDisplayed(withText(R.string.running_records_add_default)) 46 + checkViewIsDisplayed(withText(coreR.string.running_records_add_type)) 47 + checkViewIsDisplayed(withText(coreR.string.running_records_add_default)) 45 48 checkViewDoesNotExist(withText(name1)) 46 49 checkViewDoesNotExist(withText(name2)) 47 50 48 51 // Check selection 49 - clickOnViewWithText(R.string.running_records_add_default) 52 + clickOnViewWithText(coreR.string.running_records_add_default) 50 53 clickOnViewWithText(name1) 51 - checkActivity(name1, R.color.colorFiltered) 54 + checkActivity(name1, viewsR.color.colorFiltered) 52 55 checkActivity(name2, color2) 53 56 54 57 clickOnViewWithText(name1) 55 58 clickOnViewWithText(name2) 56 59 checkActivity(name1, color1) 57 - checkActivity(name2, R.color.colorFiltered) 60 + checkActivity(name2, viewsR.color.colorFiltered) 58 61 59 - clickOnViewWithText(R.string.types_filter_show_all) 62 + clickOnViewWithText(coreR.string.types_filter_show_all) 60 63 checkActivity(name1, color1) 61 64 checkActivity(name2, color2) 62 65 63 - clickOnViewWithText(R.string.types_filter_hide_all) 64 - checkActivity(name1, R.color.colorFiltered) 65 - checkActivity(name2, R.color.colorFiltered) 66 + clickOnViewWithText(coreR.string.types_filter_hide_all) 67 + checkActivity(name1, viewsR.color.colorFiltered) 68 + checkActivity(name2, viewsR.color.colorFiltered) 66 69 67 70 // Try to save when nothing selected 68 - clickOnViewWithText(R.string.duration_dialog_save) 69 - checkViewIsDisplayed(withText(R.string.duration_dialog_save)) 71 + clickOnViewWithText(coreR.string.duration_dialog_save) 72 + checkViewIsDisplayed(withText(coreR.string.duration_dialog_save)) 70 73 71 74 // Save 72 75 clickOnViewWithText(name1) 73 76 clickOnViewWithText(name2) 74 - clickOnViewWithText(R.string.duration_dialog_save) 77 + clickOnViewWithText(coreR.string.duration_dialog_save) 75 78 Thread.sleep(1000) 76 79 77 80 // Types added 78 - checkViewIsDisplayed(withText(R.string.running_records_add_type)) 79 - checkViewDoesNotExist(withText(R.string.running_records_add_default)) 81 + checkViewIsDisplayed(withText(coreR.string.running_records_add_type)) 82 + checkViewDoesNotExist(withText(coreR.string.running_records_add_default)) 80 83 checkActivity(name1, color1) 81 84 checkActivity(name2, color2) 82 85 } ··· 87 90 ) { 88 91 checkViewIsDisplayed( 89 92 allOf( 90 - withId(R.id.viewRecordTypeItem), 93 + withId(baseR.id.viewRecordTypeItem), 91 94 withCardColor(color), 92 95 hasDescendant(withText(name)) 93 96 )
+88 -73
app/src/androidTest/java/com/example/util/simpletimetracker/AddRecordTagTest.kt
··· 30 30 import org.hamcrest.Matcher 31 31 import org.junit.Test 32 32 import org.junit.runner.RunWith 33 + import com.example.util.simpletimetracker.core.R as coreR 34 + import com.example.util.simpletimetracker.feature_categories.R as categoriesR 35 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 36 + import com.example.util.simpletimetracker.feature_change_record_tag.R as changeRecordTagR 37 + import com.example.util.simpletimetracker.feature_views.R as viewsR 33 38 34 39 @HiltAndroidTest 35 40 @RunWith(AndroidJUnit4::class) ··· 45 50 46 51 NavUtils.openSettingsScreen() 47 52 NavUtils.openCategoriesScreen() 48 - checkViewIsDisplayed(withText(R.string.categories_record_type_hint)) 49 - clickOnViewWithText(R.string.categories_add_record_tag) 53 + checkViewIsDisplayed(withText(coreR.string.categories_record_type_hint)) 54 + clickOnViewWithText(coreR.string.categories_add_record_tag) 50 55 closeSoftKeyboard() 51 56 clickOnView( 52 57 allOf( 53 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 54 - withText(R.string.change_record_tag_type_typed) 58 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 59 + withText(coreR.string.change_record_tag_type_typed) 55 60 ) 56 61 ) 57 62 58 63 // View is set up 59 - checkViewIsNotDisplayed(withId(R.id.btnChangeRecordTagDelete)) 60 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagColor)) 61 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagType)) 62 - checkViewIsNotDisplayed(withId(R.id.fieldChangeRecordTagColor)) 63 - checkViewIsDisplayed(allOf(withId(R.id.fieldChangeRecordTagType), withCardColor(R.color.colorBackground))) 64 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.btnChangeRecordTagDelete)) 65 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagColor)) 66 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagType)) 67 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagColor)) 68 + checkViewIsDisplayed( 69 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagType), withCardColor(viewsR.color.colorBackground)) 70 + ) 64 71 65 72 // Name is not selected 66 - clickOnViewWithText(R.string.change_category_save) 73 + clickOnViewWithText(coreR.string.change_category_save) 67 74 68 75 // Typing name 69 - typeTextIntoView(R.id.etChangeRecordTagName, name) 76 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, name) 70 77 tryAction { checkPreviewUpdated(hasDescendant(withText(name))) } 71 78 72 79 // Open activity chooser 73 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 74 - checkViewIsDisplayed(withId(R.id.rvChangeRecordTagType)) 75 - checkViewIsDisplayed(allOf(withId(R.id.fieldChangeRecordTagType), withCardColor(R.color.inputFieldBorder))) 80 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 81 + checkViewIsDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagType)) 82 + checkViewIsDisplayed( 83 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagType), withCardColor(viewsR.color.inputFieldBorder)) 84 + ) 76 85 77 86 // Selecting activity 78 - clickOnRecyclerItem(R.id.rvChangeRecordTagType, withText(typeName)) 87 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagType, withText(typeName)) 79 88 checkPreviewUpdated(hasDescendant(withText(name))) 80 89 checkPreviewUpdated(withCardColor(firstColor)) 81 90 checkPreviewUpdated(hasDescendant(withTag(firstIcon))) 82 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 91 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 83 92 checkViewIsDisplayed( 84 - allOf(withId(R.id.fieldChangeRecordTagType), withCardColor(R.color.colorBackground)) 93 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagType), withCardColor(viewsR.color.colorBackground)) 85 94 ) 86 95 87 - clickOnViewWithText(R.string.change_record_type_save) 96 + clickOnViewWithText(coreR.string.change_record_type_save) 88 97 89 98 // Tag added 90 99 checkViewIsDisplayed(withText(name)) ··· 95 104 checkPreviewUpdated(hasDescendant(withText(name))) 96 105 checkPreviewUpdated(withCardColor(firstColor)) 97 106 checkPreviewUpdated(hasDescendant(withTag(firstIcon))) 98 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordTagName), withText(name))) 107 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.etChangeRecordTagName), withText(name))) 99 108 } 100 109 101 110 @Test ··· 108 117 109 118 NavUtils.openSettingsScreen() 110 119 NavUtils.openCategoriesScreen() 111 - checkViewIsDisplayed(withText(R.string.categories_record_type_hint)) 112 - clickOnViewWithText(R.string.categories_add_record_tag) 120 + checkViewIsDisplayed(withText(coreR.string.categories_record_type_hint)) 121 + clickOnViewWithText(coreR.string.categories_add_record_tag) 113 122 closeSoftKeyboard() 114 123 115 124 // View is set up 116 - checkViewIsNotDisplayed(withId(R.id.btnChangeRecordTagDelete)) 117 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagColor)) 118 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagType)) 119 - checkViewIsNotDisplayed(withId(R.id.fieldChangeRecordTagType)) 120 - checkViewIsDisplayed(allOf(withId(R.id.fieldChangeRecordTagColor), withCardColor(R.color.colorBackground))) 125 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.btnChangeRecordTagDelete)) 126 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagColor)) 127 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagType)) 128 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagType)) 129 + checkViewIsDisplayed( 130 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagColor), withCardColor(viewsR.color.colorBackground)) 131 + ) 121 132 122 133 // Name is not selected 123 - clickOnViewWithText(R.string.change_category_save) 134 + clickOnViewWithText(coreR.string.change_category_save) 124 135 125 136 // Typing name 126 - typeTextIntoView(R.id.etChangeRecordTagName, name) 137 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, name) 127 138 tryAction { checkPreviewUpdated(hasDescendant(withText(name))) } 128 139 129 140 // Open color chooser 130 - clickOnViewWithId(R.id.fieldChangeRecordTagColor) 131 - checkViewIsDisplayed(withId(R.id.rvChangeRecordTagColor)) 132 - checkViewIsDisplayed(allOf(withId(R.id.fieldChangeRecordTagColor), withCardColor(R.color.inputFieldBorder))) 133 - 134 - // Selecting color 135 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withCardColor(lastColor)) 136 - checkPreviewUpdated(hasDescendant(withText(name))) 137 - checkPreviewUpdated(withCardColor(lastColor)) 138 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 139 - clickOnViewWithId(R.id.fieldChangeRecordTagColor) 141 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagColor) 142 + checkViewIsDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagColor)) 140 143 checkViewIsDisplayed( 141 - allOf(withId(R.id.fieldChangeRecordTagColor), withCardColor(R.color.colorBackground)) 144 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagColor), withCardColor(viewsR.color.inputFieldBorder)) 142 145 ) 143 146 144 - clickOnViewWithText(R.string.change_record_type_save) 147 + // Selecting color 148 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withCardColor(lastColor)) 149 + checkPreviewUpdated(hasDescendant(withText(name))) 150 + checkPreviewUpdated(withCardColor(lastColor)) 151 + checkViewIsDisplayed( 152 + allOf(withId(changeRecordTagR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 153 + ) 154 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagColor) 155 + checkViewIsDisplayed( 156 + allOf(withId(changeRecordTagR.id.fieldChangeRecordTagColor), withCardColor(viewsR.color.colorBackground)) 157 + ) 158 + 159 + clickOnViewWithText(coreR.string.change_record_type_save) 145 160 146 161 // Tag added 147 162 checkViewIsDisplayed(withText(name)) ··· 151 166 longClickOnView(withText(name)) 152 167 checkPreviewUpdated(hasDescendant(withText(name))) 153 168 checkPreviewUpdated(withCardColor(lastColor)) 154 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordTagName), withText(name))) 169 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.etChangeRecordTagName), withText(name))) 155 170 } 156 171 157 172 @Test 158 173 fun addRecordTagTypesEmpty() { 159 174 NavUtils.openSettingsScreen() 160 175 NavUtils.openCategoriesScreen() 161 - clickOnViewWithText(R.string.categories_add_record_tag) 176 + clickOnViewWithText(coreR.string.categories_add_record_tag) 162 177 163 178 // Open activity chooser 164 179 clickOnView( 165 180 allOf( 166 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 167 - withText(R.string.change_record_tag_type_typed) 181 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 182 + withText(coreR.string.change_record_tag_type_typed) 168 183 ) 169 184 ) 170 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 171 - checkViewIsDisplayed(withText(R.string.record_types_empty)) 185 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 186 + checkViewIsDisplayed(withText(coreR.string.record_types_empty)) 172 187 } 173 188 174 189 @Test ··· 185 200 // Check items 186 201 NavUtils.openSettingsScreen() 187 202 NavUtils.openCategoriesScreen() 188 - onView(withId(R.id.rvCategoriesList)).check(recyclerItemCount(7)) 203 + onView(withId(categoriesR.id.rvCategoriesList)).check(recyclerItemCount(7)) 189 204 190 205 // Add another tag 191 - clickOnViewWithText(R.string.categories_add_record_tag) 192 - typeTextIntoView(R.id.etChangeRecordTagName, tagNameActivity) 206 + clickOnViewWithText(coreR.string.categories_add_record_tag) 207 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagNameActivity) 193 208 clickOnView( 194 209 allOf( 195 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 196 - withText(R.string.change_record_tag_type_typed) 210 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 211 + withText(coreR.string.change_record_tag_type_typed) 197 212 ) 198 213 ) 199 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 200 - clickOnRecyclerItem(R.id.rvChangeRecordTagType, withText(typeName)) 201 - clickOnViewWithText(R.string.change_record_type_save) 214 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 215 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagType, withText(typeName)) 216 + clickOnViewWithText(coreR.string.change_record_type_save) 202 217 203 - onView(withId(R.id.rvCategoriesList)).check(recyclerItemCount(7)) 218 + onView(withId(categoriesR.id.rvCategoriesList)).check(recyclerItemCount(7)) 204 219 205 220 // Add another general tag 206 - clickOnViewWithText(R.string.categories_add_record_tag) 207 - typeTextIntoView(R.id.etChangeRecordTagName, tagNameGeneral) 221 + clickOnViewWithText(coreR.string.categories_add_record_tag) 222 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagNameGeneral) 208 223 closeSoftKeyboard() 209 - clickOnViewWithText(R.string.change_record_type_save) 224 + clickOnViewWithText(coreR.string.change_record_type_save) 210 225 211 - onView(withId(R.id.rvCategoriesList)).check(recyclerItemCount(7)) 226 + onView(withId(categoriesR.id.rvCategoriesList)).check(recyclerItemCount(7)) 212 227 } 213 228 214 229 @Test ··· 224 239 // Add tag 225 240 NavUtils.openRecordsScreen() 226 241 clickOnView(allOf(withText(typeName), isCompletelyDisplayed())) 227 - clickOnViewWithId(R.id.fieldChangeRecordCategory) 228 - clickOnViewWithText(R.string.categories_add_record_tag) 242 + clickOnViewWithId(changeRecordR.id.fieldChangeRecordCategory) 243 + clickOnViewWithText(coreR.string.categories_add_record_tag) 229 244 230 245 // Activity already selected 231 246 checkPreviewUpdated(withCardColor(lastColor)) 232 247 checkPreviewUpdated(hasDescendant(withTag(lastIcon))) 233 248 234 - typeTextIntoView(R.id.etChangeRecordTagName, tagName1) 249 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagName1) 235 250 closeSoftKeyboard() 236 - clickOnViewWithText(R.string.change_category_save) 251 + clickOnViewWithText(coreR.string.change_category_save) 237 252 238 253 // Tag added 239 254 checkViewIsDisplayed(withText(tagName1)) 240 255 241 256 // Change tag 242 257 longClickOnView(withText(tagName1)) 243 - typeTextIntoView(R.id.etChangeRecordTagName, tagName2) 258 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagName2) 244 259 closeSoftKeyboard() 245 - clickOnViewWithText(R.string.change_category_save) 260 + clickOnViewWithText(coreR.string.change_category_save) 246 261 247 262 // Tag changed 248 263 checkViewDoesNotExist(withText(tagName1)) ··· 258 273 // Add data 259 274 testUtils.addActivity(typeName) 260 275 tryAction { clickOnViewWithText(typeName) } 261 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(typeName))) 276 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordTagR.id.viewRunningRecordItem)), withText(typeName))) 262 277 263 278 // Add category 264 - clickOnViewWithId(R.id.fieldChangeRecordCategory) 265 - clickOnViewWithText(R.string.categories_add_record_tag) 266 - typeTextIntoView(R.id.etChangeRecordTagName, tagName1) 279 + clickOnViewWithId(changeRecordR.id.fieldChangeRecordCategory) 280 + clickOnViewWithText(coreR.string.categories_add_record_tag) 281 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagName1) 267 282 closeSoftKeyboard() 268 - clickOnViewWithText(R.string.change_category_save) 283 + clickOnViewWithText(coreR.string.change_category_save) 269 284 270 285 // Category added 271 286 checkViewIsDisplayed(withText(tagName1)) 272 287 273 288 // Change category 274 289 longClickOnView(withText(tagName1)) 275 - typeTextIntoView(R.id.etChangeRecordTagName, tagName2) 290 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagName2) 276 291 closeSoftKeyboard() 277 - clickOnViewWithText(R.string.change_category_save) 292 + clickOnViewWithText(coreR.string.change_category_save) 278 293 279 294 // Category changed 280 295 checkViewDoesNotExist(withText(tagName1)) ··· 282 297 } 283 298 284 299 private fun checkPreviewUpdated(matcher: Matcher<View>) = 285 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordTag), matcher)) 300 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.previewChangeRecordTag), matcher)) 286 301 }
+88 -74
app/src/androidTest/java/com/example/util/simpletimetracker/AddRecordTest.kt
··· 26 26 import com.example.util.simpletimetracker.utils.withCardColor 27 27 import com.example.util.simpletimetracker.utils.withTag 28 28 import dagger.hilt.android.testing.HiltAndroidTest 29 + import java.util.Calendar 29 30 import org.hamcrest.CoreMatchers.allOf 30 31 import org.hamcrest.CoreMatchers.equalTo 31 32 import org.hamcrest.Matcher 32 33 import org.junit.Test 33 34 import org.junit.runner.RunWith 34 - import java.util.Calendar 35 + import com.example.util.simpletimetracker.core.R as coreR 36 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 37 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 38 + import com.example.util.simpletimetracker.feature_records.R as recordsR 35 39 36 40 @HiltAndroidTest 37 41 @RunWith(AndroidJUnit4::class) ··· 53 57 54 58 // Add record 55 59 NavUtils.openRecordsScreen() 56 - clickOnViewWithId(R.id.btnRecordAdd) 60 + clickOnViewWithId(recordsR.id.btnRecordAdd) 57 61 58 62 // View is set up 59 - checkViewIsNotDisplayed(withId(R.id.btnChangeRecordDelete)) 60 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordType)) 61 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordCategories)) 63 + checkViewIsNotDisplayed(withId(changeRecordR.id.btnChangeRecordDelete)) 64 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordType)) 65 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordCategories)) 62 66 val currentTime = System.currentTimeMillis() 63 67 var timeStarted = timeMapper.formatDateTime( 64 68 time = currentTime - 60 * 60 * 1000, useMilitaryTime = true, showSeconds = false ··· 66 70 var timeEnded = timeMapper.formatDateTime( 67 71 time = currentTime, useMilitaryTime = true, showSeconds = false 68 72 ) 69 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 70 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeEnded), withText(timeEnded))) 73 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 74 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeEnded), withText(timeEnded))) 71 75 72 76 // Set time started 73 77 val hourStarted = 15 74 78 val minutesStarted = 16 75 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 79 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 76 80 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 77 81 .perform(setTime(hourStarted, minutesStarted)) 78 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 82 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 79 83 80 84 val timeStartedTimestamp = Calendar.getInstance().run { 81 85 set(Calendar.HOUR_OF_DAY, hourStarted) ··· 85 89 timeStarted = timeStartedTimestamp.let { 86 90 timeMapper.formatDateTime(time = it, useMilitaryTime = true, showSeconds = false) 87 91 } 88 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 92 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 89 93 90 94 // Set time ended 91 95 val hourEnded = 17 92 96 val minutesEnded = 19 93 - clickOnViewWithId(R.id.tvChangeRecordTimeEnded) 97 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeEnded) 94 98 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 95 99 .perform(setTime(hourEnded, minutesEnded)) 96 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 100 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 97 101 98 102 val timeEndedTimestamp = Calendar.getInstance().run { 99 103 set(Calendar.HOUR_OF_DAY, hourEnded) ··· 103 107 timeEnded = timeEndedTimestamp.let { 104 108 timeMapper.formatDateTime(time = it, useMilitaryTime = true, showSeconds = false) 105 109 } 106 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeEnded), withText(timeEnded))) 110 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeEnded), withText(timeEnded))) 107 111 108 112 // Preview is updated 109 113 val timeStartedPreview = timeStartedTimestamp.let { ··· 117 121 checkPreviewUpdated(hasDescendant(withText("2$hourString 3$minuteString"))) 118 122 119 123 // Activity not selected 120 - clickOnViewWithText(R.string.change_record_save) 124 + clickOnViewWithText(coreR.string.change_record_save) 121 125 122 126 // Open activity chooser 123 - clickOnViewWithText(R.string.change_record_type_field) 124 - checkViewIsDisplayed(withId(R.id.rvChangeRecordType)) 127 + clickOnViewWithText(coreR.string.change_record_type_field) 128 + checkViewIsDisplayed(withId(changeRecordR.id.rvChangeRecordType)) 125 129 126 130 // Selecting activity 127 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 131 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 128 132 checkPreviewUpdated(hasDescendant(withText(name))) 129 133 checkPreviewUpdated(withCardColor(color)) 130 134 checkPreviewUpdated(hasDescendant(withTag(icon))) 131 135 132 136 // Open tag chooser 133 - tryAction { checkViewIsDisplayed(withId(R.id.rvChangeRecordCategories)) } 137 + tryAction { checkViewIsDisplayed(withId(changeRecordR.id.rvChangeRecordCategories)) } 134 138 135 139 // Selecting tags 136 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 140 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 137 141 checkPreviewUpdated(hasDescendant(withText("$name - $tag1"))) 138 142 139 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) 143 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) 140 144 checkPreviewUpdated(hasDescendant(withText("$name - $tag1, $tag2"))) 141 145 142 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 146 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 143 147 checkPreviewUpdated(hasDescendant(withText("$name - $tag2"))) 144 148 145 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) 149 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) 146 150 checkPreviewUpdated(hasDescendant(withText(name))) 147 151 148 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 149 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) 150 - clickOnViewWithId(R.id.fieldChangeRecordCategory) 152 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 153 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) 154 + clickOnViewWithId(changeRecordR.id.fieldChangeRecordCategory) 151 155 152 156 // Set comment 153 - clickOnViewWithText(R.string.change_record_comment_field) 154 - typeTextIntoView(R.id.etChangeRecordComment, comment) 157 + clickOnViewWithText(coreR.string.change_record_comment_field) 158 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, comment) 155 159 closeSoftKeyboard() 156 160 tryAction { checkPreviewUpdated(hasDescendant(withText(comment))) } 157 - clickOnViewWithText(R.string.change_record_comment_field) 161 + clickOnViewWithText(coreR.string.change_record_comment_field) 158 162 159 163 // Save 160 - clickOnViewWithText(R.string.change_record_save) 164 + clickOnViewWithText(coreR.string.change_record_save) 161 165 162 166 // Record added 163 167 tryAction { 164 168 checkViewIsDisplayed( 165 169 allOf( 166 - withId(R.id.viewRecordItem), 170 + withId(changeRecordR.id.viewRecordItem), 167 171 withCardColor(color), 168 172 hasDescendant(withText("$name - $tag1, $tag2")), 169 173 hasDescendant(withTag(icon)), ··· 180 184 @Test 181 185 fun addRecordTypesEmpty() { 182 186 NavUtils.openRecordsScreen() 183 - clickOnViewWithId(R.id.btnRecordAdd) 187 + clickOnViewWithId(recordsR.id.btnRecordAdd) 184 188 185 189 // Open activity chooser 186 - clickOnViewWithText(R.string.change_record_type_field) 187 - checkViewIsDisplayed(withText(R.string.record_types_empty)) 190 + clickOnViewWithText(coreR.string.change_record_type_field) 191 + checkViewIsDisplayed(withText(coreR.string.record_types_empty)) 188 192 } 189 193 190 194 @Test ··· 193 197 testUtils.addActivity(name) 194 198 195 199 NavUtils.openRecordsScreen() 196 - clickOnViewWithId(R.id.btnRecordAdd) 200 + clickOnViewWithId(recordsR.id.btnRecordAdd) 197 201 198 202 // Select activity 199 - clickOnViewWithText(R.string.change_record_type_field) 200 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 203 + clickOnViewWithText(coreR.string.change_record_type_field) 204 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 201 205 202 206 // Open tag chooser 203 - clickOnViewWithId(R.id.fieldChangeRecordCategory) 204 - checkViewIsDisplayed(withText(R.string.change_record_categories_empty)) 207 + clickOnViewWithId(changeRecordR.id.fieldChangeRecordCategory) 208 + checkViewIsDisplayed(withText(coreR.string.change_record_categories_empty)) 205 209 } 206 210 207 211 @Test ··· 224 228 225 229 // Check comments 226 230 NavUtils.openRecordsScreen() 227 - clickOnViewWithId(R.id.btnRecordAdd) 231 + clickOnViewWithId(recordsR.id.btnRecordAdd) 228 232 229 233 // No last comments 230 - clickOnViewWithText(R.string.change_record_comment_field) 234 + clickOnViewWithText(coreR.string.change_record_comment_field) 231 235 closeSoftKeyboard() 232 - checkViewDoesNotExist(withText(R.string.change_record_last_comments_hint)) 236 + checkViewDoesNotExist(withText(coreR.string.change_record_last_comments_hint)) 233 237 checkViewDoesNotExist(withText(comment1)) 234 238 checkViewDoesNotExist(withText(comment2)) 235 239 checkViewDoesNotExist(withText(comment3)) 236 - clickOnViewWithText(R.string.change_record_comment_field) 240 + clickOnViewWithText(coreR.string.change_record_comment_field) 237 241 238 242 // Select activity with no previous comments 239 - clickOnViewWithText(R.string.change_record_type_field) 240 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameNoComments)) 243 + clickOnViewWithText(coreR.string.change_record_type_field) 244 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameNoComments)) 241 245 242 246 // Still no last comments 243 - clickOnViewWithText(R.string.change_record_comment_field) 247 + clickOnViewWithText(coreR.string.change_record_comment_field) 244 248 closeSoftKeyboard() 245 - checkViewDoesNotExist(withText(R.string.change_record_last_comments_hint)) 249 + checkViewDoesNotExist(withText(coreR.string.change_record_last_comments_hint)) 246 250 checkViewDoesNotExist(withText(comment1)) 247 251 checkViewDoesNotExist(withText(comment2)) 248 252 checkViewDoesNotExist(withText(comment3)) 249 - clickOnViewWithText(R.string.change_record_comment_field) 253 + clickOnViewWithText(coreR.string.change_record_comment_field) 250 254 251 255 // Select activity with one previous comment 252 - clickOnViewWithText(R.string.change_record_type_field) 253 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameComment)) 256 + clickOnViewWithText(coreR.string.change_record_type_field) 257 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameComment)) 254 258 255 259 // One last comment 256 - clickOnViewWithText(R.string.change_record_comment_field) 260 + clickOnViewWithText(coreR.string.change_record_comment_field) 257 261 closeSoftKeyboard() 258 - checkViewIsDisplayed(withText(R.string.change_record_last_comments_hint)) 262 + checkViewIsDisplayed(withText(coreR.string.change_record_last_comments_hint)) 259 263 checkViewIsDisplayed(withText(comment1)) 260 264 checkViewDoesNotExist(withText(comment2)) 261 265 checkViewDoesNotExist(withText(comment3)) ··· 263 267 // Select last comment 264 268 clickOnViewWithText(comment1) 265 269 tryAction { checkPreviewUpdated(hasDescendant(withText(comment1))) } 266 - typeTextIntoView(R.id.etChangeRecordComment, "") 267 - clickOnViewWithText(R.string.change_record_comment_field) 270 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, "") 271 + clickOnViewWithText(coreR.string.change_record_comment_field) 268 272 269 273 // Select activity with many previous comments 270 - clickOnViewWithText(R.string.change_record_type_field) 271 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameComments)) 274 + clickOnViewWithText(coreR.string.change_record_type_field) 275 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameComments)) 272 276 273 277 // Two last comments 274 - clickOnViewWithText(R.string.change_record_comment_field) 278 + clickOnViewWithText(coreR.string.change_record_comment_field) 275 279 closeSoftKeyboard() 276 - checkViewIsDisplayed(withText(R.string.change_record_last_comments_hint)) 280 + checkViewIsDisplayed(withText(coreR.string.change_record_last_comments_hint)) 277 281 checkViewDoesNotExist(withText(comment1)) 278 282 checkViewIsDisplayed(withText(comment2)) 279 283 checkViewIsDisplayed(withText(comment3)) ··· 289 293 fun addRecordAdjustTime() { 290 294 // Add record 291 295 NavUtils.openRecordsScreen() 292 - clickOnViewWithId(R.id.btnRecordAdd) 296 + clickOnViewWithId(recordsR.id.btnRecordAdd) 293 297 294 298 // Setup 295 299 val hourStarted = 15 296 300 val minutesStarted = 0 297 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 301 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 298 302 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(hourStarted, minutesStarted)) 299 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 303 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 300 304 301 305 val hourEnded = 16 302 306 val minutesEnded = 0 303 - clickOnViewWithId(R.id.tvChangeRecordTimeEnded) 307 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeEnded) 304 308 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(hourEnded, minutesEnded)) 305 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 309 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 306 310 307 311 checkAfterTimeAdjustment( 308 312 timeStarted = "15:00", timeEnded = "16:00", duration = "1$hourString 0$minuteString" 309 313 ) 310 314 311 315 // Check visibility 312 - checkViewIsDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 313 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeStartedAdjust)) 314 - checkViewIsNotDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 315 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeStartedAdjust)) 316 - checkViewIsDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 316 + checkViewIsDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 317 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeStartedAdjust)) 318 + checkViewIsNotDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 319 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeStartedAdjust)) 320 + checkViewIsDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 317 321 318 322 // Check time start adjustments 319 323 clickOnViewWithText("-30") ··· 347 351 ) 348 352 349 353 // Check time end adjustments 350 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeEndedAdjust)) 354 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeEndedAdjust)) 351 355 352 356 tryAction { clickOnViewWithText("+30") } 353 357 clickOnViewWithText("+30") ··· 386 390 timeEnded: String, 387 391 duration: String, 388 392 ) { 389 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRecordItemTimeStarted), withText(timeStarted)))) 390 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRecordItemTimeFinished), withText(timeEnded)))) 391 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRecordItemDuration), withText(duration)))) 392 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withSubstring(timeStarted))) 393 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeEnded), withSubstring(timeEnded))) 393 + checkPreviewUpdated( 394 + hasDescendant(allOf(withId(changeRecordR.id.tvRecordItemTimeStarted), withText(timeStarted))) 395 + ) 396 + checkPreviewUpdated( 397 + hasDescendant(allOf(withId(changeRecordR.id.tvRecordItemTimeFinished), withText(timeEnded))) 398 + ) 399 + checkPreviewUpdated( 400 + hasDescendant(allOf(withId(changeRecordR.id.tvRecordItemDuration), withText(duration))) 401 + ) 402 + checkViewIsDisplayed( 403 + allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withSubstring(timeStarted)) 404 + ) 405 + checkViewIsDisplayed( 406 + allOf(withId(changeRecordR.id.tvChangeRecordTimeEnded), withSubstring(timeEnded)) 407 + ) 394 408 } 395 409 396 410 private fun checkPreviewUpdated(matcher: Matcher<View>) = 397 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), matcher)) 411 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), matcher)) 398 412 }
+75 -68
app/src/androidTest/java/com/example/util/simpletimetracker/AddRecordTypeTest.kt
··· 32 32 import org.hamcrest.Matcher 33 33 import org.junit.Test 34 34 import org.junit.runner.RunWith 35 + import com.example.util.simpletimetracker.core.R as coreR 36 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 37 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 35 38 36 39 @HiltAndroidTest 37 40 @RunWith(AndroidJUnit4::class) ··· 51 54 52 55 pressBack() 53 56 NavUtils.openRunningRecordsScreen() 54 - clickOnViewWithText(R.string.running_records_add_type) 57 + clickOnViewWithText(coreR.string.running_records_add_type) 55 58 56 59 // View is set up 57 - checkViewIsNotDisplayed(withId(R.id.btnChangeRecordTypeDelete)) 58 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeColor)) 59 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeIcon)) 60 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.btnChangeRecordTypeDelete)) 61 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeColor)) 62 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)) 60 63 61 64 // Name is not selected 62 65 closeSoftKeyboard() 63 - clickOnViewWithText(R.string.change_record_type_save) 66 + clickOnViewWithText(coreR.string.change_record_type_save) 64 67 65 68 // Typing name 66 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 69 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 67 70 checkPreviewUpdated(hasDescendant(withText(name))) 68 71 69 72 // Open color chooser 70 - clickOnViewWithText(R.string.change_record_type_color_hint) 71 - checkViewIsDisplayed(withId(R.id.rvChangeRecordTypeColor)) 72 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeIcon)) 73 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 74 + checkViewIsDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeColor)) 75 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)) 73 76 74 77 // Selecting color 75 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColor(firstColor)) 78 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(firstColor)) 76 79 checkPreviewUpdated(withCardColor(firstColor)) 77 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 80 + checkViewIsDisplayed( 81 + allOf(withId(changeRecordTypeR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 82 + ) 78 83 79 84 // Selecting color 80 - scrollRecyclerToPosition(R.id.rvChangeRecordTypeColor, lastColorPosition) 81 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 85 + scrollRecyclerToPosition(changeRecordTypeR.id.rvChangeRecordTypeColor, lastColorPosition) 86 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 82 87 checkPreviewUpdated(withCardColor(lastColor)) 83 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 88 + checkViewIsDisplayed( 89 + allOf(withId(changeRecordTypeR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 90 + ) 84 91 85 92 // Open icon chooser 86 - clickOnViewWithText(R.string.change_record_type_color_hint) 87 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 88 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeColor)) 89 - checkViewIsDisplayed(withId(R.id.rvChangeRecordTypeIcon)) 93 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 94 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 95 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeColor)) 96 + checkViewIsDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)) 90 97 91 98 // Selecting icon 92 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withTag(firstIcon)) 99 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withTag(firstIcon)) 93 100 checkPreviewUpdated(hasDescendant(withTag(firstIcon))) 94 101 95 102 // Selecting icon 96 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 97 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 98 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 103 + onView(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 104 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 105 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 99 106 checkPreviewUpdated(hasDescendant(withTag(lastIcon))) 100 107 101 108 // Open category chooser 102 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 103 - clickOnViewWithText(R.string.category_hint) 104 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeIcon)) 105 - checkViewIsDisplayed(withId(R.id.rvChangeRecordTypeCategories)) 109 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 110 + clickOnViewWithText(coreR.string.category_hint) 111 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)) 112 + checkViewIsDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeCategories)) 106 113 checkViewIsDisplayed(withText(categoryName1)) 107 114 checkViewIsDisplayed(withText(categoryName2)) 108 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 109 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 110 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 111 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 115 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 116 + checkViewIsDisplayed(withId(changeRecordTypeR.id.viewDividerItem)) 117 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 118 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 112 119 113 120 // Selecting category 114 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName1)) 115 - checkViewIsDisplayed(withText(R.string.something_selected)) 116 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 117 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 118 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 121 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName1)) 122 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 123 + checkViewIsDisplayed(withId(changeRecordTypeR.id.viewDividerItem)) 124 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(changeRecordTypeR.id.viewDividerItem))) 125 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 119 126 120 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName2)) 121 - checkViewIsDisplayed(withText(R.string.something_selected)) 122 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 127 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName2)) 128 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 129 + checkViewIsDisplayed(withId(changeRecordTypeR.id.viewDividerItem)) 123 130 checkViewIsDisplayed(withText(categoryName1)) 124 131 checkViewIsDisplayed(withText(categoryName2)) 125 132 126 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName1)) 127 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName2)) 128 - checkViewIsDisplayed(withText(R.string.nothing_selected)) 129 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 130 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 131 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 133 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName1)) 134 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName2)) 135 + checkViewIsDisplayed(withText(coreR.string.nothing_selected)) 136 + checkViewIsDisplayed(withId(changeRecordTypeR.id.viewDividerItem)) 137 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 138 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 132 139 133 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName1)) 134 - clickOnViewWithText(R.string.category_hint) 140 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName1)) 141 + clickOnViewWithText(coreR.string.category_hint) 135 142 136 143 // Selecting goal time 137 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 138 - clickOnViewWithId(R.id.groupChangeRecordTypeSessionGoalTime) 139 - clickOnViewWithId(R.id.tvNumberKeyboard1) 140 - clickOnViewWithId(R.id.tvNumberKeyboard0) 141 - clickOnViewWithId(R.id.tvNumberKeyboard0) 142 - clickOnViewWithId(R.id.tvNumberKeyboard0) 143 - clickOnViewWithText(R.string.duration_dialog_save) 144 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 145 + clickOnViewWithId(changeRecordTypeR.id.groupChangeRecordTypeSessionGoalTime) 146 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 147 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 148 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 149 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 150 + clickOnViewWithText(coreR.string.duration_dialog_save) 144 151 checkViewIsDisplayed(withText("10$minuteString")) 145 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 152 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 146 153 147 154 // Save 148 - clickOnViewWithText(R.string.change_record_type_save) 155 + clickOnViewWithText(coreR.string.change_record_type_save) 149 156 150 157 // Record type added 151 158 checkViewIsDisplayed(withText(name)) ··· 154 161 155 162 // Check categories saved 156 163 longClickOnView(withText(name)) 157 - clickOnViewWithText(R.string.category_hint) 158 - checkViewIsDisplayed(withText(R.string.something_selected)) 159 - checkViewIsDisplayed(withId(R.id.viewDividerItem)) 160 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 161 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 164 + clickOnViewWithText(coreR.string.category_hint) 165 + checkViewIsDisplayed(withText(coreR.string.something_selected)) 166 + checkViewIsDisplayed(withId(changeRecordTypeR.id.viewDividerItem)) 167 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(changeRecordTypeR.id.viewDividerItem))) 168 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(changeRecordTypeR.id.viewDividerItem))) 162 169 } 163 170 164 171 @Test 165 172 fun addRecordTypeCategoriesEmpty() { 166 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 173 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 167 174 168 175 // Goal time is disabled 169 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 176 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 170 177 checkViewIsDisplayed( 171 178 allOf( 172 - withId(R.id.tvChangeRecordTypeSessionGoalTime), 173 - withText(R.string.change_record_type_goal_time_disabled) 179 + withId(changeRecordTypeR.id.tvChangeRecordTypeSessionGoalTime), 180 + withText(coreR.string.change_record_type_goal_time_disabled) 174 181 ) 175 182 ) 176 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 183 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 177 184 178 185 // Open category chooser 179 - clickOnViewWithText(R.string.category_hint) 180 - checkViewIsDisplayed(withText(R.string.change_record_type_categories_empty)) 186 + clickOnViewWithText(coreR.string.category_hint) 187 + checkViewIsDisplayed(withText(coreR.string.change_record_type_categories_empty)) 181 188 } 182 189 183 190 private fun checkPreviewUpdated(matcher: Matcher<View>) = 184 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), matcher)) 191 + checkViewIsDisplayed(allOf(withId(changeRecordTypeR.id.previewChangeRecordType), matcher)) 185 192 }
+60 -51
app/src/androidTest/java/com/example/util/simpletimetracker/ArchiveTest.kt
··· 26 26 import org.hamcrest.CoreMatchers.allOf 27 27 import org.junit.Test 28 28 import org.junit.runner.RunWith 29 + import com.example.util.simpletimetracker.core.R as coreR 30 + import com.example.util.simpletimetracker.feature_change_record_tag.R as changeRecordTagR 31 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 32 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 33 + import com.example.util.simpletimetracker.feature_records.R as recordsR 34 + import com.example.util.simpletimetracker.feature_settings.R as settingsR 35 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 36 + import com.example.util.simpletimetracker.feature_statistics_detail.R as statisticsDetailR 29 37 30 38 @HiltAndroidTest 31 39 @RunWith(AndroidJUnit4::class) ··· 46 54 47 55 // Delete one 48 56 longClickOnView(withText(name2)) 49 - clickOnViewWithId(R.id.btnChangeRecordTypeDelete) 57 + clickOnViewWithId(changeRecordTypeR.id.btnChangeRecordTypeDelete) 50 58 // Snackbar is in the way of Add button 51 59 clickOnViewWithId(com.google.android.material.R.id.snackbar_text) 52 60 tryAction { checkTypeVisible(name1) } ··· 54 62 55 63 // Not shown on records 56 64 NavUtils.openRecordsScreen() 57 - clickOnViewWithId(R.id.btnRecordAdd) 58 - clickOnViewWithText(R.string.change_record_type_field) 65 + clickOnViewWithId(recordsR.id.btnRecordAdd) 66 + clickOnViewWithText(coreR.string.change_record_type_field) 59 67 checkTypeVisible(name1) 60 68 checkTypeNotVisible(name2) 61 69 pressBack() 62 70 63 71 // Still shown in stat filter 64 72 NavUtils.openStatisticsScreen() 65 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 73 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 66 74 tryAction { checkTypeVisible(name1) } 67 75 checkTypeVisible(name2) 68 76 pressBack() 69 77 70 78 // Still shown in stat detail filter 71 79 clickOnView(allOf(withText(name1), isCompletelyDisplayed())) 72 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 80 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 73 81 tryAction { checkTypeVisible(name1) } 74 82 checkTypeVisible(name2) 75 83 pressBack() ··· 78 86 // Not shown categories selection 79 87 NavUtils.openSettingsScreen() 80 88 NavUtils.openCategoriesScreen() 81 - clickOnViewWithText(R.string.categories_add_category) 89 + clickOnViewWithText(coreR.string.categories_add_category) 82 90 closeSoftKeyboard() 83 - clickOnViewWithText(R.string.change_category_types_hint) 91 + clickOnViewWithText(coreR.string.change_category_types_hint) 84 92 checkTypeVisible(name1) 85 93 checkTypeNotVisible(name2) 86 94 pressBack() 87 95 88 96 // Not shown in record tag selection 89 - clickOnViewWithText(R.string.categories_add_record_tag) 97 + clickOnViewWithText(coreR.string.categories_add_record_tag) 90 98 closeSoftKeyboard() 91 99 clickOnView( 92 100 allOf( 93 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 94 - withText(R.string.change_record_tag_type_typed) 101 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 102 + withText(coreR.string.change_record_tag_type_typed) 95 103 ) 96 104 ) 97 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 105 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 98 106 checkTypeVisible(name1) 99 107 checkTypeNotVisible(name2) 100 108 pressBack() ··· 108 116 pressBack() 109 117 110 118 // Not shown in manual order 111 - clickOnSpinnerWithId(R.id.spinnerSettingsRecordTypeSort) 112 - clickOnViewWithText(R.string.settings_sort_manually) 119 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsRecordTypeSort) 120 + clickOnViewWithText(coreR.string.settings_sort_manually) 113 121 tryAction { checkTypeVisible(name1) } 114 122 checkTypeNotVisible(name2) 115 123 pressBack() ··· 121 129 122 130 // Restore 123 131 clickOnViewWithText(name2) 124 - clickOnViewWithText(R.string.archive_dialog_restore) 132 + clickOnViewWithText(coreR.string.archive_dialog_restore) 125 133 126 134 // Archive is empty 127 135 checkTypeNotVisible(name1) 128 136 checkTypeNotVisible(name2) 129 - checkViewIsDisplayed(withText(R.string.archive_empty)) 137 + checkViewIsDisplayed(withText(coreR.string.archive_empty)) 130 138 pressBack() 131 139 132 140 // Shown again ··· 152 160 153 161 NavUtils.openSettingsScreen() 154 162 NavUtils.openSettingsAdditional() 155 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 156 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 163 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 164 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 157 165 NavUtils.openCategoriesScreen() 158 166 checkTagVisible(tag1) 159 167 checkTagVisible(tag2) ··· 162 170 163 171 // Delete one 164 172 clickOnView(withText(tag2)) 165 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 173 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 166 174 clickOnView(withText(tag4)) 167 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 175 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 168 176 checkTagVisible(tag1) 169 177 checkTagNotVisible(tag2) 170 178 checkTagVisible(tag3) ··· 175 183 176 184 // Not shown on records 177 185 NavUtils.openRecordsScreen() 178 - clickOnViewWithId(R.id.btnRecordAdd) 179 - clickOnViewWithText(R.string.change_record_type_field) 186 + clickOnViewWithId(recordsR.id.btnRecordAdd) 187 + clickOnViewWithText(coreR.string.change_record_type_field) 180 188 clickOnView(withText(name1)) 181 189 tryAction { checkTagVisible(tag1) } 182 190 checkTagNotVisible(tag2) ··· 187 195 // Still shown in stat detail filter 188 196 NavUtils.openStatisticsScreen() 189 197 clickOnView(allOf(withText(name1), isCompletelyDisplayed())) 190 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 198 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 199 + clickOnViewWithText(coreR.string.records_filter_select_tags) 191 200 checkTagVisible(tag1) 192 201 checkTagVisible(tag2) 193 202 checkTagVisible(tag3) ··· 214 223 215 224 // Restore 216 225 clickOnViewWithText(tag2) 217 - clickOnViewWithText(R.string.archive_dialog_restore) 226 + clickOnViewWithText(coreR.string.archive_dialog_restore) 218 227 clickOnViewWithText(tag4) 219 - clickOnViewWithText(R.string.archive_dialog_restore) 228 + clickOnViewWithText(coreR.string.archive_dialog_restore) 220 229 221 230 // Archive is empty 222 231 checkTagNotVisible(tag1) 223 232 checkTagNotVisible(tag2) 224 233 checkTagNotVisible(tag3) 225 234 checkTagNotVisible(tag4) 226 - checkViewIsDisplayed(withText(R.string.archive_empty)) 235 + checkViewIsDisplayed(withText(coreR.string.archive_empty)) 227 236 pressBack() 228 237 229 238 // Shown again ··· 263 272 264 273 // Delete 265 274 tryAction { longClickOnView(withText(name1)) } 266 - clickOnViewWithId(R.id.btnChangeRecordTypeDelete) 275 + clickOnViewWithId(changeRecordTypeR.id.btnChangeRecordTypeDelete) 267 276 tryAction { longClickOnView(withText(name2)) } 268 - clickOnViewWithId(R.id.btnChangeRecordTypeDelete) 277 + clickOnViewWithId(changeRecordTypeR.id.btnChangeRecordTypeDelete) 269 278 NavUtils.openSettingsScreen() 270 279 NavUtils.openCategoriesScreen() 271 280 tryAction { clickOnViewWithText(tag1) } 272 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 281 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 273 282 tryAction { clickOnViewWithText(tag2) } 274 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 283 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 275 284 tryAction { clickOnViewWithText(tag3) } 276 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 285 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 277 286 tryAction { clickOnViewWithText(tag4) } 278 - clickOnViewWithId(R.id.btnChangeRecordTagDelete) 287 + clickOnViewWithId(changeRecordTagR.id.btnChangeRecordTagDelete) 279 288 pressBack() 280 289 281 290 // Check archive ··· 291 300 clickOnViewWithText(name1) 292 301 checkViewIsDisplayed( 293 302 allOf( 294 - withId(R.id.layoutArchiveDialogInfoItem), 295 - hasDescendant(withText(R.string.archive_records_count)), 303 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 304 + hasDescendant(withText(coreR.string.archive_records_count)), 296 305 hasDescendant(withText("6")) 297 306 ) 298 307 ) 299 308 checkViewIsDisplayed( 300 309 allOf( 301 - withId(R.id.layoutArchiveDialogInfoItem), 302 - hasDescendant(withText(R.string.archive_record_tags_count)), 310 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 311 + hasDescendant(withText(coreR.string.archive_record_tags_count)), 303 312 hasDescendant(withText("2")) 304 313 ) 305 314 ) ··· 309 318 clickOnViewWithText(name2) 310 319 checkViewIsDisplayed( 311 320 allOf( 312 - withId(R.id.layoutArchiveDialogInfoItem), 313 - hasDescendant(withText(R.string.archive_records_count)), 321 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 322 + hasDescendant(withText(coreR.string.archive_records_count)), 314 323 hasDescendant(withText("0")) 315 324 ) 316 325 ) 317 326 checkViewIsDisplayed( 318 327 allOf( 319 - withId(R.id.layoutArchiveDialogInfoItem), 320 - hasDescendant(withText(R.string.archive_record_tags_count)), 328 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 329 + hasDescendant(withText(coreR.string.archive_record_tags_count)), 321 330 hasDescendant(withText("0")) 322 331 ) 323 332 ) ··· 327 336 clickOnViewWithText(tag1) 328 337 checkViewIsDisplayed( 329 338 allOf( 330 - withId(R.id.layoutArchiveDialogInfoItem), 331 - hasDescendant(withText(R.string.archive_tagged_records_count)), 339 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 340 + hasDescendant(withText(coreR.string.archive_tagged_records_count)), 332 341 hasDescendant(withText("4")) 333 342 ) 334 343 ) ··· 338 347 clickOnViewWithText(tag2) 339 348 checkViewIsDisplayed( 340 349 allOf( 341 - withId(R.id.layoutArchiveDialogInfoItem), 342 - hasDescendant(withText(R.string.archive_tagged_records_count)), 350 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 351 + hasDescendant(withText(coreR.string.archive_tagged_records_count)), 343 352 hasDescendant(withText("0")) 344 353 ) 345 354 ) ··· 349 358 clickOnViewWithText(tag3) 350 359 checkViewIsDisplayed( 351 360 allOf( 352 - withId(R.id.layoutArchiveDialogInfoItem), 353 - hasDescendant(withText(R.string.archive_tagged_records_count)), 361 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 362 + hasDescendant(withText(coreR.string.archive_tagged_records_count)), 354 363 hasDescendant(withText("2")) 355 364 ) 356 365 ) ··· 360 369 clickOnViewWithText(tag4) 361 370 checkViewIsDisplayed( 362 371 allOf( 363 - withId(R.id.layoutArchiveDialogInfoItem), 364 - hasDescendant(withText(R.string.archive_tagged_records_count)), 372 + withId(dialogsR.id.layoutArchiveDialogInfoItem), 373 + hasDescendant(withText(coreR.string.archive_tagged_records_count)), 365 374 hasDescendant(withText("0")) 366 375 ) 367 376 ) ··· 370 379 private fun checkTypeVisible(name: String) { 371 380 checkViewIsDisplayed( 372 381 allOf( 373 - withId(R.id.viewRecordTypeItem), 382 + withId(dialogsR.id.viewRecordTypeItem), 374 383 hasDescendant(withText(name)), 375 384 isCompletelyDisplayed() 376 385 ) ··· 380 389 private fun checkTypeNotVisible(name: String) { 381 390 checkViewDoesNotExist( 382 391 allOf( 383 - withId(R.id.viewRecordTypeItem), 392 + withId(dialogsR.id.viewRecordTypeItem), 384 393 hasDescendant(withText(name)), 385 394 isCompletelyDisplayed() 386 395 ) ··· 390 399 private fun checkTagVisible(name: String) { 391 400 checkViewIsDisplayed( 392 401 allOf( 393 - withId(R.id.viewCategoryItem), 402 + withId(dialogsR.id.viewCategoryItem), 394 403 hasDescendant(withText(name)), 395 404 isCompletelyDisplayed() 396 405 ) ··· 400 409 private fun checkTagNotVisible(name: String) { 401 410 checkViewDoesNotExist( 402 411 allOf( 403 - withId(R.id.viewCategoryItem), 412 + withId(dialogsR.id.viewCategoryItem), 404 413 hasDescendant(withText(name)), 405 414 isCompletelyDisplayed() 406 415 )
+28 -22
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeCategoryTest.kt
··· 24 24 import org.hamcrest.Matcher 25 25 import org.junit.Test 26 26 import org.junit.runner.RunWith 27 + import com.example.util.simpletimetracker.core.R as coreR 28 + import com.example.util.simpletimetracker.feature_change_category.R as changeCategoryR 27 29 28 30 @HiltAndroidTest 29 31 @RunWith(AndroidJUnit4::class) ··· 48 50 longClickOnView(withText(name)) 49 51 50 52 // View is set up 51 - checkViewIsDisplayed(withId(R.id.btnChangeCategoryDelete)) 52 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryColor)) 53 - checkViewIsNotDisplayed(withId(R.id.rvChangeCategoryType)) 54 - checkViewIsDisplayed(allOf(withId(R.id.etChangeCategoryName), withText(name))) 53 + checkViewIsDisplayed(withId(changeCategoryR.id.btnChangeCategoryDelete)) 54 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryColor)) 55 + checkViewIsNotDisplayed(withId(changeCategoryR.id.rvChangeCategoryType)) 56 + checkViewIsDisplayed(allOf(withId(changeCategoryR.id.etChangeCategoryName), withText(name))) 55 57 56 58 // Preview is updated 57 59 checkPreviewUpdated(hasDescendant(withText(name))) 58 60 checkPreviewUpdated(withCardColor(firstColor)) 59 61 60 62 // Change item 61 - typeTextIntoView(R.id.etChangeCategoryName, newName) 63 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, newName) 62 64 checkPreviewUpdated(hasDescendant(withText(newName))) 63 65 64 - clickOnViewWithText(R.string.change_record_type_color_hint) 65 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 66 - scrollRecyclerToView(R.id.rvChangeCategoryColor, withCardColor(lastColor)) 67 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withCardColor(lastColor)) 66 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 67 + checkViewIsDisplayed( 68 + allOf(withId(changeCategoryR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 69 + ) 70 + scrollRecyclerToView(changeCategoryR.id.rvChangeCategoryColor, withCardColor(lastColor)) 71 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withCardColor(lastColor)) 68 72 checkPreviewUpdated(withCardColor(lastColor)) 69 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 73 + checkViewIsDisplayed( 74 + allOf(withId(changeCategoryR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 75 + ) 70 76 71 - clickOnViewWithText(R.string.change_category_types_hint) 72 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 73 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 74 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 75 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName2)) 76 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 77 - onView(withText(typeName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 77 + clickOnViewWithText(coreR.string.change_category_types_hint) 78 + onView(withText(typeName1)).check(isCompletelyAbove(withId(changeCategoryR.id.viewDividerItem))) 79 + onView(withText(typeName2)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 80 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 81 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName2)) 82 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 83 + onView(withText(typeName2)).check(isCompletelyAbove(withId(changeCategoryR.id.viewDividerItem))) 78 84 79 - clickOnViewWithText(R.string.change_record_type_save) 85 + clickOnViewWithText(coreR.string.change_record_type_save) 80 86 81 87 // Record type updated 82 88 checkViewIsDisplayed(withText(newName)) 83 89 checkViewIsDisplayed(withCardColor(lastColor)) 84 90 longClickOnView(withText(newName)) 85 - clickOnViewWithText(R.string.change_category_types_hint) 86 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 87 - onView(withText(typeName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 91 + clickOnViewWithText(coreR.string.change_category_types_hint) 92 + onView(withText(typeName1)).check(isCompletelyBelow(withId(changeCategoryR.id.viewDividerItem))) 93 + onView(withText(typeName2)).check(isCompletelyAbove(withId(changeCategoryR.id.viewDividerItem))) 88 94 } 89 95 90 96 private fun checkPreviewUpdated(matcher: Matcher<View>) = 91 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeCategory), matcher)) 97 + checkViewIsDisplayed(allOf(withId(changeCategoryR.id.previewChangeCategory), matcher)) 92 98 }
+30 -24
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeRecordTagTest.kt
··· 22 22 import org.hamcrest.Matcher 23 23 import org.junit.Test 24 24 import org.junit.runner.RunWith 25 + import com.example.util.simpletimetracker.core.R as coreR 26 + import com.example.util.simpletimetracker.feature_change_record_tag.R as changeRecordTagR 25 27 26 28 @HiltAndroidTest 27 29 @RunWith(AndroidJUnit4::class) ··· 44 46 clickOnViewWithText(name) 45 47 46 48 // View is set up 47 - checkViewIsDisplayed(withId(R.id.btnChangeRecordTagDelete)) 48 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagColor)) 49 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagType)) 50 - checkViewIsNotDisplayed(withId(R.id.buttonsChangeRecordTagType)) 51 - checkViewIsNotDisplayed(withId(R.id.fieldChangeRecordTagColor)) 52 - checkViewIsNotDisplayed(withId(R.id.fieldChangeRecordTagType)) 53 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordTagName), withText(name))) 49 + checkViewIsDisplayed(withId(changeRecordTagR.id.btnChangeRecordTagDelete)) 50 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagColor)) 51 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagType)) 52 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.buttonsChangeRecordTagType)) 53 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagColor)) 54 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagType)) 55 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.etChangeRecordTagName), withText(name))) 54 56 55 57 // Preview is updated 56 58 checkPreviewUpdated(hasDescendant(withText(name))) 57 59 checkPreviewUpdated(withCardColor(firstColor)) 58 60 59 61 // Change item 60 - typeTextIntoView(R.id.etChangeRecordTagName, newName) 62 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, newName) 61 63 tryAction { checkPreviewUpdated(hasDescendant(withText(newName))) } 62 64 63 - clickOnViewWithText(R.string.change_record_type_save) 65 + clickOnViewWithText(coreR.string.change_record_type_save) 64 66 65 67 // Record tag updated 66 68 checkViewIsDisplayed(withText(newName)) ··· 83 85 clickOnViewWithText(name) 84 86 85 87 // View is set up 86 - checkViewIsDisplayed(withId(R.id.btnChangeRecordTagDelete)) 87 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagColor)) 88 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTagType)) 89 - checkViewIsNotDisplayed(withId(R.id.buttonsChangeRecordTagType)) 90 - checkViewIsDisplayed(withId(R.id.fieldChangeRecordTagColor)) 91 - checkViewIsNotDisplayed(withId(R.id.fieldChangeRecordTagType)) 92 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordTagName), withText(name))) 88 + checkViewIsDisplayed(withId(changeRecordTagR.id.btnChangeRecordTagDelete)) 89 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagColor)) 90 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.rvChangeRecordTagType)) 91 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.buttonsChangeRecordTagType)) 92 + checkViewIsDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagColor)) 93 + checkViewIsNotDisplayed(withId(changeRecordTagR.id.fieldChangeRecordTagType)) 94 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.etChangeRecordTagName), withText(name))) 93 95 94 96 // Preview is updated 95 97 checkPreviewUpdated(hasDescendant(withText(name))) 96 98 checkPreviewUpdated(withCardColor(firstColor)) 97 99 98 100 // Change item name 99 - typeTextIntoView(R.id.etChangeRecordTagName, newName) 101 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, newName) 100 102 tryAction { checkPreviewUpdated(hasDescendant(withText(newName))) } 101 103 102 104 // Change item color 103 - clickOnViewWithId(R.id.fieldChangeRecordTagColor) 104 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 105 - scrollRecyclerToView(R.id.rvChangeRecordTagColor, withCardColor(lastColor)) 106 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withCardColor(lastColor)) 105 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagColor) 106 + checkViewIsDisplayed( 107 + allOf(withId(changeRecordTagR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 108 + ) 109 + scrollRecyclerToView(changeRecordTagR.id.rvChangeRecordTagColor, withCardColor(lastColor)) 110 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withCardColor(lastColor)) 107 111 tryAction { checkPreviewUpdated(withCardColor(lastColor)) } 108 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 112 + checkViewIsDisplayed( 113 + allOf(withId(changeRecordTagR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 114 + ) 109 115 110 - clickOnViewWithText(R.string.change_record_type_save) 116 + clickOnViewWithText(coreR.string.change_record_type_save) 111 117 112 118 // Record tag updated 113 119 checkViewIsDisplayed(withText(newName)) ··· 115 121 } 116 122 117 123 private fun checkPreviewUpdated(matcher: Matcher<View>) = 118 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordTag), matcher)) 124 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.previewChangeRecordTag), matcher)) 119 125 }
+76 -51
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeRecordTest.kt
··· 25 25 import com.example.util.simpletimetracker.utils.withCardColor 26 26 import com.example.util.simpletimetracker.utils.withTag 27 27 import dagger.hilt.android.testing.HiltAndroidTest 28 + import java.util.Calendar 28 29 import org.hamcrest.CoreMatchers.allOf 29 30 import org.hamcrest.CoreMatchers.equalTo 30 31 import org.hamcrest.Matcher 31 32 import org.junit.Test 32 33 import org.junit.runner.RunWith 33 - import java.util.Calendar 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 36 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 37 + import com.example.util.simpletimetracker.feature_records.R as recordsR 34 38 35 39 @HiltAndroidTest 36 40 @RunWith(AndroidJUnit4::class) ··· 55 59 56 60 // Add record 57 61 NavUtils.openRecordsScreen() 58 - clickOnViewWithId(R.id.btnRecordAdd) 62 + clickOnViewWithId(recordsR.id.btnRecordAdd) 59 63 60 64 val currentTime = System.currentTimeMillis() 61 65 var timeStartedTimestamp = currentTime - 60 * 60 * 1000 ··· 73 77 var timeRangePreview = (timeEndedTimestamp - timeStartedTimestamp) 74 78 .let { timeMapper.formatInterval(interval = it, forceSeconds = false, useProportionalMinutes = false) } 75 79 76 - clickOnViewWithText(R.string.change_record_comment_field) 77 - typeTextIntoView(R.id.etChangeRecordComment, comment) 78 - clickOnViewWithText(R.string.change_record_comment_field) 79 - clickOnViewWithText(R.string.change_record_type_field) 80 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 81 - tryAction { clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) } 82 - clickOnViewWithText(R.string.change_record_tag_field) 83 - clickOnViewWithText(R.string.change_record_save) 80 + clickOnViewWithText(coreR.string.change_record_comment_field) 81 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, comment) 82 + clickOnViewWithText(coreR.string.change_record_comment_field) 83 + clickOnViewWithText(coreR.string.change_record_type_field) 84 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 85 + tryAction { clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) } 86 + clickOnViewWithText(coreR.string.change_record_tag_field) 87 + clickOnViewWithText(coreR.string.change_record_save) 84 88 checkViewIsDisplayed(allOf(withText(fullName1), isCompletelyDisplayed())) 85 89 86 90 // Open edit view 87 91 clickOnView(withText(fullName1)) 88 92 89 93 // View is set up 90 - checkViewIsDisplayed(withId(R.id.btnChangeRecordDelete)) 91 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordType)) 92 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordCategories)) 93 - checkViewIsNotDisplayed(allOf(withId(R.id.etChangeRecordComment), withText(comment))) 94 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 95 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeEnded), withText(timeEnded))) 94 + checkViewIsDisplayed(withId(changeRecordR.id.btnChangeRecordDelete)) 95 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordType)) 96 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordCategories)) 97 + checkViewIsNotDisplayed(allOf(withId(changeRecordR.id.etChangeRecordComment), withText(comment))) 98 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 99 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeEnded), withText(timeEnded))) 96 100 97 101 // Preview is updated 98 102 checkPreviewUpdated(hasDescendant(withText(fullName1))) ··· 104 108 checkPreviewUpdated(hasDescendant(withText(comment))) 105 109 106 110 // Change item 107 - clickOnViewWithText(R.string.change_record_type_field) 108 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(newName)) 109 - tryAction { clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) } 110 - clickOnViewWithText(R.string.change_record_tag_field) 111 + clickOnViewWithText(coreR.string.change_record_type_field) 112 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(newName)) 113 + tryAction { clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) } 114 + clickOnViewWithText(coreR.string.change_record_tag_field) 111 115 112 116 val calendar = Calendar.getInstance().apply { 113 117 add(Calendar.DATE, -1) ··· 120 124 val month = calendar.get(Calendar.MONTH) 121 125 val day = calendar.get(Calendar.DAY_OF_MONTH) 122 126 123 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 127 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 124 128 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 125 129 .perform(PickerActions.setTime(hourStarted, minutesStarted)) 126 - clickOnViewWithText(R.string.date_time_dialog_date) 130 + clickOnViewWithText(coreR.string.date_time_dialog_date) 127 131 onView(withClassName(equalTo(DatePicker::class.java.name))) 128 132 .perform(PickerActions.setDate(year, month + 1, day)) 129 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 133 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 130 134 131 - clickOnViewWithId(R.id.tvChangeRecordTimeEnded) 135 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeEnded) 132 136 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 133 137 .perform(PickerActions.setTime(hourEnded, minutesEnded)) 134 - clickOnViewWithText(R.string.date_time_dialog_date) 138 + clickOnViewWithText(coreR.string.date_time_dialog_date) 135 139 onView(withClassName(equalTo(DatePicker::class.java.name))) 136 140 .perform(PickerActions.setDate(year, month + 1, day)) 137 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 141 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 138 142 139 143 timeStartedTimestamp = Calendar.getInstance().run { 140 144 set(Calendar.YEAR, year) ··· 163 167 timeRangePreview = (timeEndedTimestamp - timeStartedTimestamp) 164 168 .let { timeMapper.formatInterval(interval = it, forceSeconds = false, useProportionalMinutes = false) } 165 169 166 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 167 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeEnded), withText(timeEnded))) 170 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 171 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeEnded), withText(timeEnded))) 168 172 169 - clickOnViewWithText(R.string.change_record_comment_field) 170 - typeTextIntoView(R.id.etChangeRecordComment, newComment) 171 - clickOnViewWithText(R.string.change_record_comment_field) 173 + clickOnViewWithText(coreR.string.change_record_comment_field) 174 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, newComment) 175 + clickOnViewWithText(coreR.string.change_record_comment_field) 172 176 173 177 // Preview is updated 174 178 checkPreviewUpdated(hasDescendant(withText(fullName2))) ··· 179 183 checkPreviewUpdated(hasDescendant(withText(timeRangePreview))) 180 184 checkPreviewUpdated(hasDescendant(withText(newComment))) 181 185 182 - clickOnViewWithText(R.string.change_record_type_save) 186 + clickOnViewWithText(coreR.string.change_record_type_save) 183 187 184 188 // Record updated 185 189 checkViewDoesNotExist(allOf(withText(newName), isCompletelyDisplayed())) 186 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 190 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 187 191 checkViewIsDisplayed( 188 192 allOf( 189 - withId(R.id.viewRecordItem), 193 + withId(changeRecordR.id.viewRecordItem), 190 194 withCardColor(lastColor), 191 195 hasDescendant(withText(fullName2)), 192 196 hasDescendant(withText(lastEmoji)), ··· 213 217 214 218 // Add record 215 219 NavUtils.openRecordsScreen() 216 - clickOnViewWithId(R.id.btnRecordAdd) 217 - clickOnViewWithText(R.string.change_record_type_field) 218 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 219 - clickOnViewWithText(R.string.change_record_save) 220 + clickOnViewWithId(recordsR.id.btnRecordAdd) 221 + clickOnViewWithText(coreR.string.change_record_type_field) 222 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 223 + clickOnViewWithText(coreR.string.change_record_save) 220 224 221 225 // Record is added 222 - tryAction { checkViewIsDisplayed(allOf(withId(R.id.viewRecordItem), hasDescendant(withText(name)))) } 226 + tryAction { 227 + checkViewIsDisplayed( 228 + allOf( 229 + withId(changeRecordR.id.viewRecordItem), 230 + hasDescendant(withText(name)) 231 + ) 232 + ) 233 + } 223 234 224 235 // Change tag 225 236 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 226 237 checkPreviewUpdated(hasDescendant(withText(name))) 227 - clickOnViewWithText(R.string.change_record_tag_field) 228 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 229 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) 230 - clickOnViewWithText(R.string.change_record_tag_field) 238 + clickOnViewWithText(coreR.string.change_record_tag_field) 239 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 240 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) 241 + clickOnViewWithText(coreR.string.change_record_tag_field) 231 242 checkPreviewUpdated(hasDescendant(withText(fullName))) 232 - clickOnViewWithText(R.string.change_record_type_save) 243 + clickOnViewWithText(coreR.string.change_record_type_save) 233 244 234 245 // Record updated 235 - tryAction { checkViewIsDisplayed(allOf(withId(R.id.viewRecordItem), hasDescendant(withText(fullName)))) } 246 + tryAction { 247 + checkViewIsDisplayed( 248 + allOf( 249 + withId(changeRecordR.id.viewRecordItem), 250 + hasDescendant(withText(fullName)) 251 + ) 252 + ) 253 + } 236 254 237 255 // Remove tag 238 256 clickOnView(allOf(withText(fullName))) 239 257 checkPreviewUpdated(hasDescendant(withText(fullName))) 240 - clickOnViewWithText(R.string.change_record_tag_field) 241 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(R.string.change_record_untagged)) 242 - clickOnViewWithText(R.string.change_record_tag_field) 258 + clickOnViewWithText(coreR.string.change_record_tag_field) 259 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(coreR.string.change_record_untagged)) 260 + clickOnViewWithText(coreR.string.change_record_tag_field) 243 261 checkPreviewUpdated(hasDescendant(withText(name))) 244 - clickOnViewWithText(R.string.change_record_type_save) 262 + clickOnViewWithText(coreR.string.change_record_type_save) 245 263 246 264 // Record updated 247 - tryAction { checkViewIsDisplayed(allOf(withId(R.id.viewRecordItem), hasDescendant(withText(name)))) } 265 + tryAction { 266 + checkViewIsDisplayed( 267 + allOf( 268 + withId(changeRecordR.id.viewRecordItem), 269 + hasDescendant(withText(name)) 270 + ) 271 + ) 272 + } 248 273 } 249 274 250 275 private fun checkPreviewUpdated(matcher: Matcher<View>) = 251 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), matcher)) 276 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), matcher)) 252 277 }
+54 -47
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeRecordTypeTest.kt
··· 30 30 import org.hamcrest.Matcher 31 31 import org.junit.Test 32 32 import org.junit.runner.RunWith 33 + import com.example.util.simpletimetracker.core.R as coreR 34 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 35 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 33 36 34 37 @HiltAndroidTest 35 38 @RunWith(AndroidJUnit4::class) ··· 46 49 longClickOnView(withText(name)) 47 50 48 51 // View is set up 49 - checkViewIsDisplayed(withId(R.id.btnChangeRecordTypeDelete)) 50 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeColor)) 51 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordTypeIcon)) 52 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordTypeName), withText(name))) 52 + checkViewIsDisplayed(withId(changeRecordTypeR.id.btnChangeRecordTypeDelete)) 53 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeColor)) 54 + checkViewIsNotDisplayed(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)) 55 + checkViewIsDisplayed(allOf(withId(changeRecordTypeR.id.etChangeRecordTypeName), withText(name))) 53 56 54 57 // Preview is updated 55 58 checkPreviewUpdated(hasDescendant(withText(name))) ··· 57 60 checkPreviewUpdated(hasDescendant(withTag(firstIcon))) 58 61 59 62 // Change item 60 - typeTextIntoView(R.id.etChangeRecordTypeName, newName) 63 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, newName) 61 64 checkPreviewUpdated(hasDescendant(withText(newName))) 62 65 63 - clickOnViewWithText(R.string.change_record_type_color_hint) 64 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(firstColor)))) 65 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 66 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 66 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 67 + checkViewIsDisplayed( 68 + allOf(withId(changeRecordTypeR.id.viewColorItemSelected), withParent(withCardColor(firstColor))) 69 + ) 70 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 71 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 67 72 checkPreviewUpdated(withCardColor(lastColor)) 68 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColor(lastColor)))) 69 - clickOnViewWithText(R.string.change_record_type_color_hint) 73 + checkViewIsDisplayed( 74 + allOf(withId(changeRecordTypeR.id.viewColorItemSelected), withParent(withCardColor(lastColor))) 75 + ) 76 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 70 77 71 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 72 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 73 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 74 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 78 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 79 + onView(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 80 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 81 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 75 82 checkPreviewUpdated(hasDescendant(withTag(lastIcon))) 76 83 77 - clickOnViewWithText(R.string.change_record_type_save) 84 + clickOnViewWithText(coreR.string.change_record_type_save) 78 85 79 86 // Record type updated 80 87 tryAction { checkViewIsDisplayed(withText(newName)) } ··· 83 90 84 91 // Change again 85 92 longClickOnView(withText(newName)) 86 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 93 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 87 94 clickOnView( 88 95 allOf( 89 - isDescendantOfA(withId(R.id.btnChangeRecordTypeIconSwitch)), 90 - withText(R.string.change_record_type_icon_emoji_hint) 96 + isDescendantOfA(withId(changeRecordTypeR.id.btnChangeRecordTypeIconSwitch)), 97 + withText(coreR.string.change_record_type_icon_emoji_hint) 91 98 ) 92 99 ) 93 100 clickOnViewWithText(firstEmoji) ··· 95 102 // Preview is updated 96 103 checkPreviewUpdated(hasDescendant(withText(firstEmoji))) 97 104 98 - clickOnViewWithText(R.string.change_record_type_save) 105 + clickOnViewWithText(coreR.string.change_record_type_save) 99 106 100 107 // Record type updated 101 108 tryAction { checkViewIsDisplayed(withText(firstEmoji)) } ··· 113 120 tryAction { clickOnViewWithText(name) } 114 121 checkViewIsDisplayed( 115 122 allOf( 116 - withId(R.id.viewRunningRecordItem), 123 + withId(changeRecordTypeR.id.viewRunningRecordItem), 117 124 withCardColor(firstColor), 118 125 hasDescendant(withText(name)), 119 126 hasDescendant(withTag(firstIcon)) 120 127 ) 121 128 ) 122 - checkViewDoesNotExist(withSubstring(getString(R.string.change_record_type_session_goal_time).lowercase())) 129 + checkViewDoesNotExist(withSubstring(getString(coreR.string.change_record_type_session_goal_time).lowercase())) 123 130 124 131 // Change activity 125 132 longClickOnView( 126 - allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name)) 133 + allOf(isDescendantOfA(withId(changeRecordTypeR.id.viewRecordTypeItem)), withText(name)) 127 134 ) 128 135 129 - typeTextIntoView(R.id.etChangeRecordTypeName, newName) 136 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, newName) 130 137 131 - clickOnViewWithText(R.string.change_record_type_color_hint) 132 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 133 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 134 - clickOnViewWithText(R.string.change_record_type_color_hint) 138 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 139 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 140 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(lastColor)) 141 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 135 142 136 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 137 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 138 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 139 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 140 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 143 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 144 + onView(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 145 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withTag(lastIcon))) 146 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withTag(lastIcon)) 147 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 141 148 142 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 143 - clickOnViewWithId(R.id.groupChangeRecordTypeSessionGoalTime) 144 - clickOnViewWithId(R.id.tvNumberKeyboard1) 145 - clickOnViewWithId(R.id.tvNumberKeyboard0) 146 - clickOnViewWithId(R.id.tvNumberKeyboard0) 147 - clickOnViewWithId(R.id.tvNumberKeyboard0) 148 - clickOnViewWithText(R.string.duration_dialog_save) 149 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 150 + clickOnViewWithId(changeRecordTypeR.id.groupChangeRecordTypeSessionGoalTime) 151 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 152 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 153 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 154 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 155 + clickOnViewWithText(coreR.string.duration_dialog_save) 149 156 tryAction { checkViewIsDisplayed(withText("10$minuteString")) } 150 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 157 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 151 158 152 - clickOnViewWithText(R.string.change_record_type_save) 159 + clickOnViewWithText(coreR.string.change_record_type_save) 153 160 154 161 // Record running record updated 155 162 tryAction { 156 163 checkViewIsDisplayed( 157 - allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(newName)) 164 + allOf(isDescendantOfA(withId(changeRecordTypeR.id.viewRunningRecordItem)), withText(newName)) 158 165 ) 159 166 } 160 167 checkViewIsDisplayed( 161 - allOf(withId(R.id.viewRunningRecordItem), withCardColor(lastColor)) 168 + allOf(withId(changeRecordTypeR.id.viewRunningRecordItem), withCardColor(lastColor)) 162 169 ) 163 170 checkViewIsDisplayed( 164 - allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withTag(lastIcon)) 171 + allOf(isDescendantOfA(withId(changeRecordTypeR.id.viewRunningRecordItem)), withTag(lastIcon)) 165 172 ) 166 - checkViewIsDisplayed(withSubstring(getString(R.string.change_record_type_session_goal_time).lowercase())) 173 + checkViewIsDisplayed(withSubstring(getString(coreR.string.change_record_type_session_goal_time).lowercase())) 167 174 } 168 175 169 176 private fun checkPreviewUpdated(matcher: Matcher<View>) = 170 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), matcher)) 177 + checkViewIsDisplayed(allOf(withId(changeRecordTypeR.id.previewChangeRecordType), matcher)) 171 178 }
+219 -165
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeRunningRecordTest.kt
··· 31 31 import com.example.util.simpletimetracker.utils.withCardColor 32 32 import com.example.util.simpletimetracker.utils.withTag 33 33 import dagger.hilt.android.testing.HiltAndroidTest 34 + import java.util.Calendar 35 + import java.util.concurrent.TimeUnit 34 36 import org.hamcrest.CoreMatchers.allOf 35 37 import org.hamcrest.CoreMatchers.equalTo 36 38 import org.hamcrest.Matcher 37 39 import org.junit.Test 38 40 import org.junit.runner.RunWith 39 - import java.util.Calendar 40 - import java.util.concurrent.TimeUnit 41 + import com.example.util.simpletimetracker.core.R as coreR 42 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 43 + import com.example.util.simpletimetracker.feature_change_running_record.R as changeRunningRecordR 44 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 45 + import com.example.util.simpletimetracker.feature_running_records.R as runningRecordsR 41 46 42 47 @HiltAndroidTest 43 48 @RunWith(AndroidJUnit4::class) ··· 66 71 ) 67 72 var timeStartedPreview = timeStartedTimestamp 68 73 .let { timeMapper.formatTime(time = it, useMilitaryTime = true, showSeconds = false) } 69 - val goalString = getString(R.string.change_record_type_session_goal_time).lowercase() + " 9$minuteString" 74 + val goalString = getString(coreR.string.change_record_type_session_goal_time).lowercase() + " 9$minuteString" 70 75 71 76 checkRunningRecordDisplayed( 72 77 name = name1, ··· 78 83 ) 79 84 80 85 // Open edit view 81 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name1))) 86 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(name1))) 82 87 83 88 // View is set up 84 - checkViewIsDisplayed(withId(R.id.btnChangeRunningRecordDelete)) 85 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordType)) 86 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordCategories)) 87 - checkViewIsDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 88 - checkViewIsNotDisplayed(allOf(withId(R.id.etChangeRecordComment), withText(""))) 89 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 89 + checkViewIsDisplayed(withId(changeRunningRecordR.id.btnChangeRunningRecordDelete)) 90 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordType)) 91 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordCategories)) 92 + checkViewIsDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 93 + checkViewIsNotDisplayed(allOf(withId(changeRecordR.id.etChangeRecordComment), withText(""))) 94 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 90 95 91 96 // Preview is updated 92 97 checkPreviewUpdated(hasDescendant(withText(name1))) ··· 96 101 checkPreviewUpdated(hasDescendant(withSubstring(goalString))) 97 102 98 103 // Change item 99 - clickOnViewWithText(R.string.change_record_type_field) 100 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name2)) 101 - tryAction { clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) } 102 - clickOnViewWithText(R.string.change_record_tag_field) 104 + clickOnViewWithText(coreR.string.change_record_type_field) 105 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name2)) 106 + tryAction { clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) } 107 + clickOnViewWithText(coreR.string.change_record_tag_field) 103 108 104 109 val calendar = Calendar.getInstance().apply { 105 110 add(Calendar.DATE, -1) ··· 110 115 val month = calendar.get(Calendar.MONTH) 111 116 val day = calendar.get(Calendar.DAY_OF_MONTH) 112 117 113 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 118 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 114 119 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 115 120 .perform(setTime(hourStarted, minutesStarted)) 116 - clickOnViewWithText(R.string.date_time_dialog_date) 121 + clickOnViewWithText(coreR.string.date_time_dialog_date) 117 122 onView(withClassName(equalTo(DatePicker::class.java.name))) 118 123 .perform(PickerActions.setDate(year, month + 1, day)) 119 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 124 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 120 125 121 126 timeStartedTimestamp = Calendar.getInstance().run { 122 127 set(Calendar.YEAR, year) ··· 131 136 timeStartedPreview = timeStartedTimestamp 132 137 .let { timeMapper.formatTime(time = it, useMilitaryTime = true, showSeconds = false) } 133 138 134 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withText(timeStarted))) 135 - clickOnViewWithText(R.string.change_record_comment_field) 136 - typeTextIntoView(R.id.etChangeRecordComment, comment) 137 - clickOnViewWithText(R.string.change_record_comment_field) 139 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withText(timeStarted))) 140 + clickOnViewWithText(coreR.string.change_record_comment_field) 141 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, comment) 142 + clickOnViewWithText(coreR.string.change_record_comment_field) 138 143 139 144 // Preview is updated 140 145 checkPreviewUpdated(hasDescendant(withText(fullName2))) ··· 143 148 checkPreviewUpdated(hasDescendant(withText(timeStartedPreview))) 144 149 checkPreviewUpdated(hasDescendant(withText(comment))) 145 150 checkViewIsNotDisplayed( 146 - allOf(isDescendantOfA(withId(R.id.previewChangeRunningRecord)), withId(R.id.tvRunningRecordItemGoalTime)) 151 + allOf( 152 + isDescendantOfA(withId(changeRunningRecordR.id.previewChangeRunningRecord)), 153 + withId(changeRecordR.id.tvRunningRecordItemGoalTime) 154 + ) 147 155 ) 148 156 149 157 // Save 150 - clickOnViewWithText(R.string.change_record_save) 158 + clickOnViewWithText(coreR.string.change_record_save) 151 159 152 160 // Record updated 153 161 tryAction { 154 162 checkViewDoesNotExist( 155 - allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name1)) 163 + allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(name1)) 156 164 ) 157 165 } 158 166 checkRunningRecordDisplayed( ··· 189 197 checkRunningRecordDisplayed(name = name1) 190 198 191 199 // Change tag 192 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name1))) 200 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(name1))) 193 201 checkPreviewUpdated(hasDescendant(withText(name1))) 194 - clickOnViewWithText(R.string.change_record_tag_field) 195 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 202 + clickOnViewWithText(coreR.string.change_record_tag_field) 203 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 196 204 checkPreviewUpdated(hasDescendant(withText(fullName1))) 197 - clickOnViewWithText(R.string.change_record_tag_field) 198 - clickOnViewWithText(R.string.change_record_save) 205 + clickOnViewWithText(coreR.string.change_record_tag_field) 206 + clickOnViewWithText(coreR.string.change_record_save) 199 207 200 208 // Record updated 201 209 tryAction { checkRunningRecordDisplayed(name = fullName1) } 202 210 203 211 // Change activity and tag 204 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(fullName1))) 212 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(fullName1))) 205 213 checkPreviewUpdated(hasDescendant(withText(fullName1))) 206 - clickOnViewWithText(R.string.change_record_type_field) 207 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name2)) 214 + clickOnViewWithText(coreR.string.change_record_type_field) 215 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name2)) 208 216 checkPreviewUpdated(hasDescendant(withText(name2))) 209 - tryAction { clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) } 210 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag3)) 217 + tryAction { clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) } 218 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag3)) 211 219 checkPreviewUpdated(hasDescendant(withText(fullName2))) 212 - clickOnViewWithText(R.string.change_record_tag_field) 213 - clickOnViewWithText(R.string.change_record_save) 220 + clickOnViewWithText(coreR.string.change_record_tag_field) 221 + clickOnViewWithText(coreR.string.change_record_save) 214 222 215 223 // Record updated 216 224 tryAction { checkRunningRecordDisplayed(name = fullName2) } 217 225 218 226 // Remove tag 219 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(fullName2))) 227 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(fullName2))) 220 228 checkPreviewUpdated(hasDescendant(withText(fullName2))) 221 - clickOnViewWithText(R.string.change_record_tag_field) 222 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(R.string.change_record_untagged)) 229 + clickOnViewWithText(coreR.string.change_record_tag_field) 230 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(coreR.string.change_record_untagged)) 223 231 checkPreviewUpdated(hasDescendant(withText(name2))) 224 - clickOnViewWithText(R.string.change_record_tag_field) 225 - clickOnViewWithText(R.string.change_record_save) 232 + clickOnViewWithText(coreR.string.change_record_tag_field) 233 + clickOnViewWithText(coreR.string.change_record_save) 226 234 227 235 // Record updated 228 236 tryAction { checkRunningRecordDisplayed(name = name2) } ··· 239 247 val minutesStarted = 0 240 248 241 249 tryAction { clickOnViewWithText(name) } 242 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 243 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 250 + longClickOnView(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(name))) 251 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 244 252 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(hourStarted, minutesStarted)) 245 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 253 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 246 254 247 255 checkAfterTimeAdjustment(timeStarted = "00:00") 248 256 249 257 // Check visibility 250 - checkViewIsDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 251 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeStartedAdjust)) 252 - checkViewIsNotDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 253 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeStartedAdjust)) 254 - checkViewIsDisplayed(withId(R.id.containerChangeRecordTimeAdjust)) 258 + checkViewIsDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 259 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeStartedAdjust)) 260 + checkViewIsNotDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 261 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeStartedAdjust)) 262 + checkViewIsDisplayed(withId(changeRecordR.id.containerChangeRecordTimeAdjust)) 255 263 256 264 // Check time adjustments 257 265 clickOnViewWithText("+30") ··· 268 276 checkAfterTimeAdjustment(timeStarted = "00:00") 269 277 clickOnViewWithText("-30") 270 278 checkAfterTimeAdjustment(timeStarted = "23:30") 271 - clickOnViewWithText(R.string.time_now) 272 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRunningRecordItemTimer), withText("0$secondString")))) 279 + clickOnViewWithText(coreR.string.time_now) 280 + checkPreviewUpdated( 281 + hasDescendant(allOf(withId(changeRecordR.id.tvRunningRecordItemTimer), withText("0$secondString"))) 282 + ) 273 283 clickOnViewWithText("+30") 274 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRunningRecordItemTimer), withText("0$secondString")))) 284 + checkPreviewUpdated( 285 + hasDescendant(allOf(withId(changeRecordR.id.tvRunningRecordItemTimer), withText("0$secondString"))) 286 + ) 275 287 } 276 288 277 289 @Test ··· 295 307 296 308 // No last comments 297 309 tryAction { clickOnViewWithText(nameNoComments) } 298 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(nameNoComments))) 310 + longClickOnView( 311 + allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(nameNoComments)) 312 + ) 299 313 300 - clickOnViewWithText(R.string.change_record_comment_field) 314 + clickOnViewWithText(coreR.string.change_record_comment_field) 301 315 closeSoftKeyboard() 302 - checkViewDoesNotExist(withText(R.string.change_record_last_comments_hint)) 316 + checkViewDoesNotExist(withText(coreR.string.change_record_last_comments_hint)) 303 317 checkViewDoesNotExist(withText(comment1)) 304 318 checkViewDoesNotExist(withText(comment2)) 305 319 checkViewDoesNotExist(withText(comment3)) 306 - clickOnViewWithText(R.string.change_record_comment_field) 320 + clickOnViewWithText(coreR.string.change_record_comment_field) 307 321 308 322 // Select activity with one previous comment 309 - clickOnViewWithText(R.string.change_record_type_field) 310 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameComment)) 323 + clickOnViewWithText(coreR.string.change_record_type_field) 324 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameComment)) 311 325 312 326 // One last comment 313 - clickOnViewWithText(R.string.change_record_comment_field) 327 + clickOnViewWithText(coreR.string.change_record_comment_field) 314 328 closeSoftKeyboard() 315 - checkViewIsDisplayed(withText(R.string.change_record_last_comments_hint)) 329 + checkViewIsDisplayed(withText(coreR.string.change_record_last_comments_hint)) 316 330 checkViewIsDisplayed(withText(comment1)) 317 331 checkViewDoesNotExist(withText(comment2)) 318 332 checkViewDoesNotExist(withText(comment3)) ··· 320 334 // Select last comment 321 335 clickOnViewWithText(comment1) 322 336 tryAction { checkPreviewUpdated(hasDescendant(withText(comment1))) } 323 - typeTextIntoView(R.id.etChangeRecordComment, "") 324 - clickOnViewWithText(R.string.change_record_comment_field) 337 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, "") 338 + clickOnViewWithText(coreR.string.change_record_comment_field) 325 339 326 340 // Select activity with many previous comments 327 - clickOnViewWithText(R.string.change_record_type_field) 328 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameComments)) 341 + clickOnViewWithText(coreR.string.change_record_type_field) 342 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameComments)) 329 343 330 344 // Two last comments 331 - clickOnViewWithText(R.string.change_record_comment_field) 345 + clickOnViewWithText(coreR.string.change_record_comment_field) 332 346 closeSoftKeyboard() 333 - checkViewIsDisplayed(withText(R.string.change_record_last_comments_hint)) 347 + checkViewIsDisplayed(withText(coreR.string.change_record_last_comments_hint)) 334 348 checkViewDoesNotExist(withText(comment1)) 335 349 checkViewIsDisplayed(withText(comment2)) 336 350 checkViewIsDisplayed(withText(comment3)) ··· 340 354 tryAction { checkPreviewUpdated(hasDescendant(withText(comment2))) } 341 355 clickOnViewWithText(comment3) 342 356 tryAction { checkPreviewUpdated(hasDescendant(withText(comment3))) } 343 - typeTextIntoView(R.id.etChangeRecordComment, "") 344 - clickOnViewWithText(R.string.change_record_comment_field) 357 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, "") 358 + clickOnViewWithText(coreR.string.change_record_comment_field) 345 359 346 360 // Select activity with no previous comments 347 - clickOnViewWithText(R.string.change_record_type_field) 348 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(nameNoComments)) 361 + clickOnViewWithText(coreR.string.change_record_type_field) 362 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(nameNoComments)) 349 363 350 364 // No last comments 351 - clickOnViewWithText(R.string.change_record_comment_field) 365 + clickOnViewWithText(coreR.string.change_record_comment_field) 352 366 closeSoftKeyboard() 353 - checkViewDoesNotExist(withText(R.string.change_record_last_comments_hint)) 367 + checkViewDoesNotExist(withText(coreR.string.change_record_last_comments_hint)) 354 368 checkViewDoesNotExist(withText(comment1)) 355 369 checkViewDoesNotExist(withText(comment2)) 356 370 checkViewDoesNotExist(withText(comment3)) 357 - clickOnViewWithText(R.string.change_record_comment_field) 371 + clickOnViewWithText(coreR.string.change_record_comment_field) 358 372 } 359 373 360 374 @Test 361 375 fun goalTimes() { 362 376 fun checkGoal(typeName: String, @IdRes goalTextId: Int, goal: String) { 363 377 allOf( 364 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 378 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 365 379 hasSibling(withText(typeName)), 366 380 withId(goalTextId), 367 381 withSubstring(goal), ··· 370 384 371 385 fun checkNoGoal(typeName: String, @IdRes goalTextId: Int) { 372 386 allOf( 373 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 387 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 374 388 hasSibling(withText(typeName)), 375 389 withId(goalTextId), 376 390 ).let(::checkViewIsNotDisplayed) ··· 378 392 379 393 fun checkGoalMark(typeName: String, @IdRes checkId: Int, isVisible: Boolean) { 380 394 allOf( 381 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 395 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 382 396 hasSibling(withText(typeName)), 383 397 withId(checkId), 384 398 ).let { ··· 389 403 fun scrollTo(typeName: String) { 390 404 tryAction { 391 405 scrollRecyclerToView( 392 - R.id.rvRunningRecordsList, 393 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(typeName))) 406 + runningRecordsR.id.rvRunningRecordsList, 407 + allOf(withId(changeRecordR.id.viewRunningRecordItem), hasDescendant(withText(typeName))) 394 408 ) 395 409 } 396 410 } 397 411 398 - val sessionGoal = getString(R.string.change_record_type_session_goal_time).lowercase() 399 - val dailyGoal = getString(R.string.change_record_type_daily_goal_time).lowercase() 400 - val weeklyGoal = getString(R.string.change_record_type_weekly_goal_time).lowercase() 412 + val sessionGoal = getString(coreR.string.change_record_type_session_goal_time).lowercase() 413 + val dailyGoal = getString(coreR.string.change_record_type_daily_goal_time).lowercase() 414 + val weeklyGoal = getString(coreR.string.change_record_type_weekly_goal_time).lowercase() 401 415 val currentTime = Calendar.getInstance().timeInMillis 402 416 403 417 val noGoals = "noGoals" ··· 524 538 // No goals 525 539 Thread.sleep(1000) 526 540 scrollTo(noGoals) 527 - checkNoGoal(noGoals, R.id.tvRunningRecordItemGoalTime) 528 - checkGoalMark(noGoals, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 529 - checkNoGoal(noGoals, R.id.tvRunningRecordItemGoalTime2) 530 - checkGoalMark(noGoals, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 531 - checkNoGoal(noGoals, R.id.tvRunningRecordItemGoalTime3) 532 - checkGoalMark(noGoals, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 541 + checkNoGoal(noGoals, changeRecordR.id.tvRunningRecordItemGoalTime) 542 + checkGoalMark(noGoals, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 543 + checkNoGoal(noGoals, changeRecordR.id.tvRunningRecordItemGoalTime2) 544 + checkGoalMark(noGoals, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 545 + checkNoGoal(noGoals, changeRecordR.id.tvRunningRecordItemGoalTime3) 546 + checkGoalMark(noGoals, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 533 547 534 548 // Session goal not finished 535 549 scrollTo(sessionGoalNotFinished) 536 - checkGoal(sessionGoalNotFinished, R.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString") 537 - checkGoalMark(sessionGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 538 - checkNoGoal(sessionGoalNotFinished, R.id.tvRunningRecordItemGoalTime2) 539 - checkGoalMark(sessionGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 540 - checkNoGoal(sessionGoalNotFinished, R.id.tvRunningRecordItemGoalTime3) 541 - checkGoalMark(sessionGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 550 + checkGoal( 551 + sessionGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString" 552 + ) 553 + checkGoalMark(sessionGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 554 + checkNoGoal(sessionGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime2) 555 + checkGoalMark(sessionGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 556 + checkNoGoal(sessionGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime3) 557 + checkGoalMark(sessionGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 542 558 543 559 // Session goal finished 544 560 scrollTo(sessionGoalFinished) 545 - checkGoal(sessionGoalFinished, R.id.tvRunningRecordItemGoalTime, sessionGoal) 546 - checkGoalMark(sessionGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 547 - checkNoGoal(sessionGoalFinished, R.id.tvRunningRecordItemGoalTime2) 548 - checkGoalMark(sessionGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 549 - checkNoGoal(sessionGoalFinished, R.id.tvRunningRecordItemGoalTime3) 550 - checkGoalMark(sessionGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 561 + checkGoal(sessionGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime, sessionGoal) 562 + checkGoalMark(sessionGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 563 + checkNoGoal(sessionGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime2) 564 + checkGoalMark(sessionGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 565 + checkNoGoal(sessionGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime3) 566 + checkGoalMark(sessionGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 551 567 552 568 // Daily goal not finished 553 569 scrollTo(dailyGoalNotFinished) 554 - checkNoGoal(dailyGoalNotFinished, R.id.tvRunningRecordItemGoalTime) 555 - checkGoalMark(dailyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 556 - checkGoal(dailyGoalNotFinished, R.id.tvRunningRecordItemGoalTime2, "$dailyGoal 4$minuteString") 557 - checkGoalMark(dailyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 558 - checkNoGoal(dailyGoalNotFinished, R.id.tvRunningRecordItemGoalTime3) 559 - checkGoalMark(dailyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 570 + checkNoGoal(dailyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime) 571 + checkGoalMark(dailyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 572 + checkGoal( 573 + dailyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, "$dailyGoal 4$minuteString" 574 + ) 575 + checkGoalMark(dailyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 576 + checkNoGoal(dailyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime3) 577 + checkGoalMark(dailyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 560 578 561 579 // Daily goal finished 562 580 scrollTo(dailyGoalFinished) 563 - checkNoGoal(dailyGoalFinished, R.id.tvRunningRecordItemGoalTime) 564 - checkGoalMark(dailyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 565 - checkGoal(dailyGoalFinished, R.id.tvRunningRecordItemGoalTime2, dailyGoal) 566 - checkGoalMark(dailyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 567 - checkNoGoal(dailyGoalFinished, R.id.tvRunningRecordItemGoalTime3) 568 - checkGoalMark(dailyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 581 + checkNoGoal(dailyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime) 582 + checkGoalMark(dailyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 583 + checkGoal(dailyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, dailyGoal) 584 + checkGoalMark(dailyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 585 + checkNoGoal(dailyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime3) 586 + checkGoalMark(dailyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 569 587 570 588 // Weekly goal not finished 571 589 scrollTo(weeklyGoalNotFinished) 572 - checkNoGoal(weeklyGoalNotFinished, R.id.tvRunningRecordItemGoalTime) 573 - checkGoalMark(weeklyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 574 - checkNoGoal(weeklyGoalNotFinished, R.id.tvRunningRecordItemGoalTime2) 575 - checkGoalMark(weeklyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 576 - checkGoal(weeklyGoalNotFinished, R.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 4$minuteString") 577 - checkGoalMark(weeklyGoalNotFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 590 + checkNoGoal(weeklyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime) 591 + checkGoalMark(weeklyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 592 + checkNoGoal(weeklyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime2) 593 + checkGoalMark(weeklyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 594 + checkGoal( 595 + weeklyGoalNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 4$minuteString" 596 + ) 597 + checkGoalMark(weeklyGoalNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 578 598 579 599 // Weekly goal finished 580 600 scrollTo(weeklyGoalFinished) 581 - checkNoGoal(weeklyGoalFinished, R.id.tvRunningRecordItemGoalTime) 582 - checkGoalMark(weeklyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 583 - checkNoGoal(weeklyGoalFinished, R.id.tvRunningRecordItemGoalTime2) 584 - checkGoalMark(weeklyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 585 - checkGoal(weeklyGoalFinished, R.id.tvRunningRecordItemGoalTime3, weeklyGoal) 586 - checkGoalMark(weeklyGoalFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 601 + checkNoGoal(weeklyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime) 602 + checkGoalMark(weeklyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 603 + checkNoGoal(weeklyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime2) 604 + checkGoalMark(weeklyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 605 + checkGoal(weeklyGoalFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, weeklyGoal) 606 + checkGoalMark(weeklyGoalFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 587 607 588 608 // All goals, all not finished 589 609 scrollTo(allGoalsNotFinished) 590 - checkGoal(allGoalsNotFinished, R.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString") 591 - checkGoalMark(allGoalsNotFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 592 - checkGoal(allGoalsNotFinished, R.id.tvRunningRecordItemGoalTime2, "$dailyGoal 14$minuteString") 593 - checkGoalMark(allGoalsNotFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 594 - checkGoal(allGoalsNotFinished, R.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 24$minuteString") 595 - checkGoalMark(allGoalsNotFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 610 + checkGoal( 611 + allGoalsNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString" 612 + ) 613 + checkGoalMark(allGoalsNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 614 + checkGoal( 615 + allGoalsNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, "$dailyGoal 14$minuteString" 616 + ) 617 + checkGoalMark(allGoalsNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 618 + checkGoal( 619 + allGoalsNotFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 24$minuteString" 620 + ) 621 + checkGoalMark(allGoalsNotFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 596 622 597 623 // All goals, all finished 598 624 scrollTo(allGoalsFinished) 599 - checkGoal(allGoalsFinished, R.id.tvRunningRecordItemGoalTime, sessionGoal) 600 - checkGoalMark(allGoalsFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 601 - checkGoal(allGoalsFinished, R.id.tvRunningRecordItemGoalTime2, dailyGoal) 602 - checkGoalMark(allGoalsFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 603 - checkGoal(allGoalsFinished, R.id.tvRunningRecordItemGoalTime3, weeklyGoal) 604 - checkGoalMark(allGoalsFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 625 + checkGoal(allGoalsFinished, changeRecordR.id.tvRunningRecordItemGoalTime, sessionGoal) 626 + checkGoalMark(allGoalsFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 627 + checkGoal(allGoalsFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, dailyGoal) 628 + checkGoalMark(allGoalsFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 629 + checkGoal(allGoalsFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, weeklyGoal) 630 + checkGoalMark(allGoalsFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 605 631 606 632 // All goals, session finished 607 633 scrollTo(allGoalsSessionFinished) 608 - checkGoal(allGoalsSessionFinished, R.id.tvRunningRecordItemGoalTime, sessionGoal) 609 - checkGoalMark(allGoalsSessionFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 610 - checkGoal(allGoalsSessionFinished, R.id.tvRunningRecordItemGoalTime2, "$dailyGoal 9$minuteString") 611 - checkGoalMark(allGoalsSessionFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 612 - checkGoal(allGoalsSessionFinished, R.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 19$minuteString") 613 - checkGoalMark(allGoalsSessionFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 634 + checkGoal(allGoalsSessionFinished, changeRecordR.id.tvRunningRecordItemGoalTime, sessionGoal) 635 + checkGoalMark(allGoalsSessionFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = true) 636 + checkGoal( 637 + allGoalsSessionFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, "$dailyGoal 9$minuteString" 638 + ) 639 + checkGoalMark( 640 + allGoalsSessionFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false 641 + ) 642 + checkGoal( 643 + allGoalsSessionFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 19$minuteString" 644 + ) 645 + checkGoalMark( 646 + allGoalsSessionFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false 647 + ) 614 648 615 649 // All goals, daily finished 616 650 scrollTo(allGoalsDailyFinished) 617 - checkGoal(allGoalsDailyFinished, R.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString") 618 - checkGoalMark(allGoalsDailyFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 619 - checkGoal(allGoalsDailyFinished, R.id.tvRunningRecordItemGoalTime2, dailyGoal) 620 - checkGoalMark(allGoalsDailyFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 621 - checkGoal(allGoalsDailyFinished, R.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 19$minuteString") 622 - checkGoalMark(allGoalsDailyFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 651 + checkGoal( 652 + allGoalsDailyFinished, changeRecordR.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString" 653 + ) 654 + checkGoalMark(allGoalsDailyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 655 + checkGoal( 656 + allGoalsDailyFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, dailyGoal 657 + ) 658 + checkGoalMark(allGoalsDailyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = true) 659 + checkGoal( 660 + allGoalsDailyFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, "$weeklyGoal 19$minuteString" 661 + ) 662 + checkGoalMark(allGoalsDailyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = false) 623 663 624 664 // All goals, weekly finished 625 665 scrollTo(allGoalsWeeklyFinished) 626 - checkGoal(allGoalsWeeklyFinished, R.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString") 627 - checkGoalMark(allGoalsWeeklyFinished, R.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 628 - checkGoal(allGoalsWeeklyFinished, R.id.tvRunningRecordItemGoalTime2, "$dailyGoal 19$minuteString") 629 - checkGoalMark(allGoalsWeeklyFinished, R.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 630 - checkGoal(allGoalsWeeklyFinished, R.id.tvRunningRecordItemGoalTime3, weeklyGoal) 631 - checkGoalMark(allGoalsWeeklyFinished, R.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 666 + checkGoal( 667 + allGoalsWeeklyFinished, changeRecordR.id.tvRunningRecordItemGoalTime, "$sessionGoal 9$minuteString" 668 + ) 669 + checkGoalMark(allGoalsWeeklyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck, isVisible = false) 670 + checkGoal( 671 + allGoalsWeeklyFinished, changeRecordR.id.tvRunningRecordItemGoalTime2, "$dailyGoal 19$minuteString" 672 + ) 673 + checkGoalMark(allGoalsWeeklyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck2, isVisible = false) 674 + checkGoal( 675 + allGoalsWeeklyFinished, changeRecordR.id.tvRunningRecordItemGoalTime3, weeklyGoal 676 + ) 677 + checkGoalMark(allGoalsWeeklyFinished, changeRecordR.id.ivRunningRecordItemGoalTimeCheck3, isVisible = true) 632 678 } 633 679 634 680 private fun checkAfterTimeAdjustment(timeStarted: String) { 635 - checkPreviewUpdated(hasDescendant(allOf(withId(R.id.tvRunningRecordItemTimeStarted), withText(timeStarted)))) 636 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeStarted), withSubstring(timeStarted))) 681 + checkPreviewUpdated( 682 + hasDescendant(allOf(withId(changeRecordR.id.tvRunningRecordItemTimeStarted), withText(timeStarted))) 683 + ) 684 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeStarted), withSubstring(timeStarted))) 637 685 } 638 686 639 687 private fun checkPreviewUpdated(matcher: Matcher<View>) = 640 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRunningRecord), matcher)) 688 + checkViewIsDisplayed(allOf(withId(changeRunningRecordR.id.previewChangeRunningRecord), matcher)) 641 689 642 690 private fun checkRunningRecordDisplayed( 643 691 name: String, ··· 648 696 goalTime: String? = null, 649 697 comment: String? = null, 650 698 ) { 651 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 699 + checkViewIsDisplayed(allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(name))) 652 700 653 701 if (color != null) { 654 - checkViewIsDisplayed(allOf(withId(R.id.viewRunningRecordItem), withCardColor(color))) 702 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.viewRunningRecordItem), withCardColor(color))) 655 703 } 656 704 if (icon != null) { 657 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withTag(icon))) 705 + checkViewIsDisplayed( 706 + allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withTag(icon)) 707 + ) 658 708 } 659 709 if (text != null) { 660 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(text))) 710 + checkViewIsDisplayed( 711 + allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(text)) 712 + ) 661 713 } 662 714 if (timeStarted != null) { 663 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(timeStarted))) 715 + checkViewIsDisplayed( 716 + allOf(isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), withText(timeStarted)) 717 + ) 664 718 } 665 719 if (!goalTime.isNullOrEmpty()) { 666 720 checkViewIsDisplayed( 667 721 allOf( 668 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 722 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 669 723 withSubstring(goalTime), 670 724 ) 671 725 ) 672 726 } else { 673 727 checkViewIsNotDisplayed( 674 728 allOf( 675 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 676 - withId(R.id.tvRunningRecordItemGoalTime) 729 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 730 + withId(changeRecordR.id.tvRunningRecordItemGoalTime) 677 731 ) 678 732 ) 679 733 } 680 734 if (!comment.isNullOrEmpty()) { 681 735 checkViewIsDisplayed( 682 736 allOf( 683 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), 737 + isDescendantOfA(withId(changeRecordR.id.viewRunningRecordItem)), 684 738 withText(comment) 685 739 ) 686 740 )
+16 -12
app/src/androidTest/java/com/example/util/simpletimetracker/ChangeUntrackedTest.kt
··· 24 24 import org.hamcrest.Matcher 25 25 import org.junit.Test 26 26 import org.junit.runner.RunWith 27 + import com.example.util.simpletimetracker.core.R as coreR 28 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 29 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 30 + import com.example.util.simpletimetracker.feature_views.R as viewsR 27 31 28 32 @HiltAndroidTest 29 33 @RunWith(AndroidJUnit4::class) ··· 41 45 42 46 // Open edit view 43 47 NavUtils.openRecordsScreen() 44 - clickOnView(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 48 + clickOnView(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 45 49 46 50 // View is set up 47 - checkViewIsNotDisplayed(withId(R.id.btnChangeRecordDelete)) 48 - checkViewIsNotDisplayed(withId(R.id.rvChangeRecordType)) 49 - checkPreviewUpdated(withCardColor(R.color.colorUntracked)) 51 + checkViewIsNotDisplayed(withId(changeRecordR.id.btnChangeRecordDelete)) 52 + checkViewIsNotDisplayed(withId(changeRecordR.id.rvChangeRecordType)) 53 + checkPreviewUpdated(withCardColor(viewsR.color.colorUntracked)) 50 54 51 55 // Change item 52 - clickOnViewWithText(R.string.change_record_type_field) 53 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 56 + clickOnViewWithText(coreR.string.change_record_type_field) 57 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 54 58 55 59 // Preview is updated 56 60 checkPreviewUpdated(hasDescendant(withText(name))) ··· 58 62 checkPreviewUpdated(hasDescendant(withTag(icon))) 59 63 60 64 // Save 61 - clickOnViewWithText(R.string.change_record_type_save) 65 + clickOnViewWithText(coreR.string.change_record_type_save) 62 66 63 67 // Record updated 64 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 68 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 65 69 checkViewIsDisplayed( 66 70 allOf( 67 - withId(R.id.viewRecordItem), 71 + withId(baseR.id.viewRecordItem), 68 72 withCardColor(color), 69 73 hasDescendant(withText(name)), 70 74 hasDescendant(withTag(icon)), ··· 74 78 75 79 // Delete record 76 80 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 77 - clickOnViewWithId(R.id.btnChangeRecordDelete) 81 + clickOnViewWithId(changeRecordR.id.btnChangeRecordDelete) 78 82 79 83 // Untracked is back 80 84 tryAction { checkViewDoesNotExist(allOf(withText(name), isCompletelyDisplayed())) } 81 - checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 85 + checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 82 86 } 83 87 84 88 private fun checkPreviewUpdated(matcher: Matcher<View>) = 85 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), matcher)) 89 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), matcher)) 86 90 }
+159 -110
app/src/androidTest/java/com/example/util/simpletimetracker/CustomColorTest.kt
··· 31 31 import org.hamcrest.Matcher 32 32 import org.junit.Test 33 33 import org.junit.runner.RunWith 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_change_category.R as changeCategoryR 37 + import com.example.util.simpletimetracker.feature_change_record_tag.R as changeRecordTagR 38 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 39 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 40 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 34 41 35 42 @HiltAndroidTest 36 43 @RunWith(AndroidJUnit4::class) ··· 38 45 39 46 @Test 40 47 fun colorSelectionDialog() { 41 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 48 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 42 49 43 50 // Open color selection dialog 44 - clickOnViewWithText(R.string.change_record_type_color_hint) 45 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 46 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 51 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 52 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(baseR.id.layoutColorPaletteItem)) 53 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(baseR.id.layoutColorPaletteItem)) 47 54 48 - checkViewIsDisplayed(withText(R.string.color_selection_base_color_hint)) 49 - checkViewIsDisplayed(withText(R.string.color_selection_adjust_color_hint)) 50 - checkViewIsDisplayed(withText(R.string.color_selection_final_color_hint)) 55 + checkViewIsDisplayed(withText(coreR.string.color_selection_base_color_hint)) 56 + checkViewIsDisplayed(withText(coreR.string.color_selection_adjust_color_hint)) 57 + checkViewIsDisplayed(withText(coreR.string.color_selection_final_color_hint)) 51 58 52 59 // Change slider hue 53 - onView(withId(R.id.sliderColorSelectionHue)).perform(clickLocation(GeneralLocation.CENTER_LEFT)) 54 - checkSliderValue(R.id.sliderColorSelectionHue, 0) 55 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionHue), withText("0"))) 60 + onView(withId(dialogsR.id.sliderColorSelectionHue)).perform(clickLocation(GeneralLocation.CENTER_LEFT)) 61 + checkSliderValue(dialogsR.id.sliderColorSelectionHue, 0) 62 + checkViewIsDisplayed(allOf(withId(dialogsR.id.etColorSelectionHue), withText("0"))) 56 63 57 - onView(withId(R.id.sliderColorSelectionHue)).perform(clickLocation(GeneralLocation.CENTER_RIGHT)) 58 - checkSliderValue(R.id.sliderColorSelectionHue, 360) 59 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionHue), withText("360"))) 64 + onView(withId(dialogsR.id.sliderColorSelectionHue)).perform(clickLocation(GeneralLocation.CENTER_RIGHT)) 65 + checkSliderValue(dialogsR.id.sliderColorSelectionHue, 360) 66 + checkViewIsDisplayed(allOf(withId(dialogsR.id.etColorSelectionHue), withText("360"))) 60 67 61 68 // Change hex 62 - typeTextIntoView(R.id.etColorSelectionHex, "#FF0000") 69 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#FF0000") 63 70 checkColorState( 64 71 finalColorInt = 0xffff0000.toInt(), 65 72 colorRed = 255, 66 73 ) 67 74 68 - typeTextIntoView(R.id.etColorSelectionHex, "#00FF00") 75 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#00FF00") 69 76 checkColorState( 70 77 finalColorInt = 0xff00ff00.toInt(), 71 78 colorGreen = 255, 72 79 colorHue = 120 73 80 ) 74 81 75 - typeTextIntoView(R.id.etColorSelectionHex, "#0000FF") 82 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#0000FF") 76 83 checkColorState( 77 84 finalColorInt = 0xff0000ff.toInt(), 78 85 colorBlue = 255, 79 86 colorHue = 240 80 87 ) 81 88 82 - typeTextIntoView(R.id.etColorSelectionHex, "#29a674") 89 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#29a674") 83 90 checkColorState( 84 91 finalColorInt = 0xff29a674.toInt(), 85 92 colorRed = 41, ··· 91 98 ) 92 99 93 100 // Change RGB 94 - typeTextIntoView(R.id.etColorSelectionRed, "255") 95 - typeTextIntoView(R.id.etColorSelectionGreen, "0") 96 - typeTextIntoView(R.id.etColorSelectionBlue, "0") 101 + typeTextIntoView(dialogsR.id.etColorSelectionRed, "255") 102 + typeTextIntoView(dialogsR.id.etColorSelectionGreen, "0") 103 + typeTextIntoView(dialogsR.id.etColorSelectionBlue, "0") 97 104 checkColorState( 98 105 finalColorInt = 0xffff0000.toInt(), 99 106 colorRed = 255, 100 107 ) 101 108 102 - typeTextIntoView(R.id.etColorSelectionRed, "0") 103 - typeTextIntoView(R.id.etColorSelectionGreen, "255") 104 - typeTextIntoView(R.id.etColorSelectionBlue, "0") 109 + typeTextIntoView(dialogsR.id.etColorSelectionRed, "0") 110 + typeTextIntoView(dialogsR.id.etColorSelectionGreen, "255") 111 + typeTextIntoView(dialogsR.id.etColorSelectionBlue, "0") 105 112 checkColorState( 106 113 finalColorInt = 0xff00ff00.toInt(), 107 114 colorGreen = 255, 108 115 colorHue = 120 109 116 ) 110 117 111 - typeTextIntoView(R.id.etColorSelectionRed, "0") 112 - typeTextIntoView(R.id.etColorSelectionGreen, "0") 113 - typeTextIntoView(R.id.etColorSelectionBlue, "255") 118 + typeTextIntoView(dialogsR.id.etColorSelectionRed, "0") 119 + typeTextIntoView(dialogsR.id.etColorSelectionGreen, "0") 120 + typeTextIntoView(dialogsR.id.etColorSelectionBlue, "255") 114 121 checkColorState( 115 122 finalColorInt = 0xff0000ff.toInt(), 116 123 colorBlue = 255, 117 124 colorHue = 240 118 125 ) 119 126 120 - typeTextIntoView(R.id.etColorSelectionRed, "41") 121 - typeTextIntoView(R.id.etColorSelectionGreen, "166") 122 - typeTextIntoView(R.id.etColorSelectionBlue, "116") 127 + typeTextIntoView(dialogsR.id.etColorSelectionRed, "41") 128 + typeTextIntoView(dialogsR.id.etColorSelectionGreen, "166") 129 + typeTextIntoView(dialogsR.id.etColorSelectionBlue, "116") 123 130 checkColorState( 124 131 finalColorInt = 0xff29a674.toInt(), 125 132 colorRed = 41, ··· 131 138 ) 132 139 133 140 // Change HSV 134 - typeTextIntoView(R.id.etColorSelectionHue, "0") 135 - typeTextIntoView(R.id.etColorSelectionSaturation, "100") 136 - typeTextIntoView(R.id.etColorSelectionValue, "100") 141 + typeTextIntoView(dialogsR.id.etColorSelectionHue, "0") 142 + typeTextIntoView(dialogsR.id.etColorSelectionSaturation, "100") 143 + typeTextIntoView(dialogsR.id.etColorSelectionValue, "100") 137 144 checkColorState( 138 145 finalColorInt = 0xffff0000.toInt(), 139 146 colorRed = 255, 140 147 ) 141 148 142 - typeTextIntoView(R.id.etColorSelectionHue, "120") 149 + typeTextIntoView(dialogsR.id.etColorSelectionHue, "120") 143 150 checkColorState( 144 151 finalColorInt = 0xff00ff00.toInt(), 145 152 colorGreen = 255, 146 153 colorHue = 120 147 154 ) 148 155 149 - typeTextIntoView(R.id.etColorSelectionHue, "240") 156 + typeTextIntoView(dialogsR.id.etColorSelectionHue, "240") 150 157 checkColorState( 151 158 finalColorInt = 0xff0000ff.toInt(), 152 159 colorBlue = 255, 153 160 colorHue = 240 154 161 ) 155 162 156 - typeTextIntoView(R.id.etColorSelectionHue, "156") 157 - typeTextIntoView(R.id.etColorSelectionSaturation, "75") 158 - typeTextIntoView(R.id.etColorSelectionValue, "65") 163 + typeTextIntoView(dialogsR.id.etColorSelectionHue, "156") 164 + typeTextIntoView(dialogsR.id.etColorSelectionSaturation, "75") 165 + typeTextIntoView(dialogsR.id.etColorSelectionValue, "65") 159 166 checkColorState( 160 167 finalColorInt = 0xff29a674.toInt(), 161 168 colorRed = 41, ··· 170 177 @Test 171 178 fun colorTransferRecordType() { 172 179 fun checkPreviewUpdated(matcher: Matcher<View>) = 173 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), matcher)) 180 + checkViewIsDisplayed(allOf(withId(changeRecordTypeR.id.previewChangeRecordType), matcher)) 174 181 175 182 val name = "name" 176 183 val tagName = "tag" ··· 178 185 val colorInt = colorId.let(::getColor) // red 179 186 val customColorInt = 0xff29a674.toInt() 180 187 181 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 188 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 182 189 183 190 // Select color 184 - clickOnViewWithText(R.string.change_record_type_color_hint) 185 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColorInt(colorInt)) 191 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 192 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColorInt(colorInt)) 186 193 checkPreviewUpdated(withCardColorInt(colorInt)) 187 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 194 + checkViewIsDisplayed(allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 188 195 189 196 // Check selected color is preselected on color selection 190 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 191 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 197 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(dialogsR.id.layoutColorPaletteItem)) 198 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(dialogsR.id.layoutColorPaletteItem)) 192 199 checkColorState( 193 200 finalColorInt = 0xfff53639.toInt(), 194 201 colorRed = 245, ··· 200 207 ) 201 208 202 209 // Select different color 203 - typeTextIntoView(R.id.etColorSelectionHex, "#29a674") 204 - clickOnViewWithText(R.string.duration_dialog_save) 210 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#29a674") 211 + clickOnViewWithText(coreR.string.duration_dialog_save) 205 212 206 213 // Check new color selected 207 214 checkPreviewUpdated(withCardColorInt(customColorInt)) 208 - checkViewIsNotDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 215 + checkViewIsNotDisplayed( 216 + allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt))) 217 + ) 209 218 checkViewIsDisplayed( 210 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 219 + allOf( 220 + withId(dialogsR.id.viewColorPaletteItemSelected), 221 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 222 + ) 211 223 ) 212 224 213 225 // Save record type 214 - clickOnViewWithText(R.string.change_record_type_color_hint) 215 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 216 - clickOnViewWithText(R.string.change_record_type_save) 226 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 227 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 228 + clickOnViewWithText(coreR.string.change_record_type_save) 217 229 218 230 // Record type saved 219 231 checkViewIsDisplayed( 220 232 allOf( 221 - withId(R.id.viewRecordTypeItem), 233 + withId(dialogsR.id.viewRecordTypeItem), 222 234 withCardColorInt(customColorInt), 223 235 hasDescendant(withText(name)), 224 236 ) 225 237 ) 226 238 longClickOnView(withText(name)) 227 239 checkPreviewUpdated(withCardColorInt(customColorInt)) 228 - clickOnViewWithText(R.string.change_record_type_color_hint) 240 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 229 241 checkViewIsDisplayed( 230 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 242 + allOf( 243 + withId(dialogsR.id.viewColorPaletteItemSelected), 244 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 245 + ) 231 246 ) 232 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 233 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withId(R.id.layoutColorPaletteItem)) 247 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(dialogsR.id.layoutColorPaletteItem)) 248 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withId(dialogsR.id.layoutColorPaletteItem)) 234 249 checkColorState( 235 250 finalColorInt = 0xff29a674.toInt(), 236 251 colorRed = 41, ··· 249 264 NavUtils.openRecordsScreen() 250 265 checkViewIsDisplayed( 251 266 allOf( 252 - withId(R.id.viewRecordItem), 267 + withId(dialogsR.id.viewRecordItem), 253 268 withCardColorInt(customColorInt), 254 269 hasDescendant(withText(name)), 255 270 isCompletelyDisplayed() ··· 260 275 NavUtils.openStatisticsScreen() 261 276 checkViewIsDisplayed( 262 277 allOf( 263 - withId(R.id.viewStatisticsItem), 278 + withId(dialogsR.id.viewStatisticsItem), 264 279 withCardColorInt(customColorInt), 265 280 hasDescendant(withText(name)), 266 281 isCompletelyDisplayed() ··· 272 287 NavUtils.openCategoriesScreen() 273 288 checkViewIsDisplayed( 274 289 allOf( 275 - withId(R.id.viewCategoryItem), 290 + withId(dialogsR.id.viewCategoryItem), 276 291 withCardColorInt(customColorInt), 277 292 hasDescendant(withText(tagName)), 278 293 ) ··· 282 297 @Test 283 298 fun colorTransferCategory() { 284 299 fun checkPreviewUpdated(matcher: Matcher<View>) = 285 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeCategory), matcher)) 300 + checkViewIsDisplayed(allOf(withId(changeCategoryR.id.previewChangeCategory), matcher)) 286 301 287 302 val name = "name" 288 303 val categoryName = "category" ··· 292 307 293 308 NavUtils.openSettingsScreen() 294 309 NavUtils.openCategoriesScreen() 295 - clickOnViewWithText(R.string.categories_add_category) 310 + clickOnViewWithText(coreR.string.categories_add_category) 296 311 297 312 // Select color 298 - clickOnViewWithText(R.string.change_category_color_hint) 299 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withCardColorInt(colorInt)) 313 + clickOnViewWithText(coreR.string.change_category_color_hint) 314 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withCardColorInt(colorInt)) 300 315 checkPreviewUpdated(withCardColorInt(colorInt)) 301 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 316 + checkViewIsDisplayed(allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 302 317 303 318 // Check selected color is preselected on color selection 304 - scrollRecyclerToView(R.id.rvChangeCategoryColor, withId(R.id.layoutColorPaletteItem)) 305 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withId(R.id.layoutColorPaletteItem)) 319 + scrollRecyclerToView(changeCategoryR.id.rvChangeCategoryColor, withId(dialogsR.id.layoutColorPaletteItem)) 320 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withId(dialogsR.id.layoutColorPaletteItem)) 306 321 checkColorState( 307 322 finalColorInt = 0xfff53639.toInt(), 308 323 colorRed = 245, ··· 314 329 ) 315 330 316 331 // Select different color 317 - typeTextIntoView(R.id.etColorSelectionHex, "#29a674") 318 - clickOnViewWithText(R.string.duration_dialog_save) 332 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#29a674") 333 + clickOnViewWithText(coreR.string.duration_dialog_save) 319 334 320 335 // Check new color selected 321 336 checkPreviewUpdated(withCardColorInt(customColorInt)) 322 - checkViewIsNotDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 337 + checkViewIsNotDisplayed( 338 + allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt))) 339 + ) 323 340 checkViewIsDisplayed( 324 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 341 + allOf( 342 + withId(dialogsR.id.viewColorPaletteItemSelected), 343 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 344 + ) 325 345 ) 326 346 327 347 // Save tag 328 - typeTextIntoView(R.id.etChangeCategoryName, categoryName) 329 - clickOnViewWithText(R.string.change_category_save) 348 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, categoryName) 349 + clickOnViewWithText(coreR.string.change_category_save) 330 350 331 351 // Tag saved 332 352 checkViewIsDisplayed( 333 353 allOf( 334 - withId(R.id.viewCategoryItem), 354 + withId(dialogsR.id.viewCategoryItem), 335 355 withCardColorInt(customColorInt), 336 356 hasDescendant(withText(categoryName)), 337 357 ) 338 358 ) 339 359 longClickOnView(withText(categoryName)) 340 360 checkPreviewUpdated(withCardColorInt(customColorInt)) 341 - clickOnViewWithText(R.string.change_category_color_hint) 342 - checkViewIsNotDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 343 - checkViewIsDisplayed( 344 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 361 + clickOnViewWithText(coreR.string.change_category_color_hint) 362 + checkViewIsNotDisplayed( 363 + allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt))) 345 364 ) 346 - scrollRecyclerToView(R.id.rvChangeCategoryColor, withId(R.id.layoutColorPaletteItem)) 347 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withId(R.id.layoutColorPaletteItem)) 365 + checkViewIsDisplayed( 366 + allOf( 367 + withId(dialogsR.id.viewColorPaletteItemSelected), 368 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 369 + ) 370 + ) 371 + scrollRecyclerToView(changeCategoryR.id.rvChangeCategoryColor, withId(dialogsR.id.layoutColorPaletteItem)) 372 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withId(dialogsR.id.layoutColorPaletteItem)) 348 373 checkColorState( 349 374 finalColorInt = 0xff29a674.toInt(), 350 375 colorRed = 41, ··· 362 387 testUtils.addActivity(name = name, categories = listOf(categoryName)) 363 388 testUtils.addRecord(name) 364 389 NavUtils.openStatisticsScreen() 365 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 366 - clickOnViewWithText(R.string.category_hint) 390 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 391 + clickOnViewWithText(coreR.string.category_hint) 367 392 pressBack() 368 393 Thread.sleep(1000) 369 394 checkViewIsDisplayed( 370 395 allOf( 371 - withId(R.id.viewStatisticsItem), 396 + withId(dialogsR.id.viewStatisticsItem), 372 397 withCardColorInt(customColorInt), 373 398 hasDescendant(withText(categoryName)), 374 399 isCompletelyDisplayed() ··· 379 404 @Test 380 405 fun colorTransferGeneralRecordTag() { 381 406 fun checkPreviewUpdated(matcher: Matcher<View>) = 382 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordTag), matcher)) 407 + checkViewIsDisplayed(allOf(withId(changeRecordTagR.id.previewChangeRecordTag), matcher)) 383 408 384 409 val tagName = "tag" 385 410 val colorId = ColorMapper.getAvailableColors()[1] ··· 388 413 389 414 NavUtils.openSettingsScreen() 390 415 NavUtils.openCategoriesScreen() 391 - clickOnViewWithText(R.string.categories_add_record_tag) 416 + clickOnViewWithText(coreR.string.categories_add_record_tag) 392 417 393 418 // Select color 394 - clickOnViewWithText(R.string.change_category_color_hint) 395 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withCardColorInt(colorInt)) 419 + clickOnViewWithText(coreR.string.change_category_color_hint) 420 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withCardColorInt(colorInt)) 396 421 checkPreviewUpdated(withCardColorInt(colorInt)) 397 - checkViewIsDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 422 + checkViewIsDisplayed(allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 398 423 399 424 // Check selected color is preselected on color selection 400 - scrollRecyclerToView(R.id.rvChangeRecordTagColor, withId(R.id.layoutColorPaletteItem)) 401 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withId(R.id.layoutColorPaletteItem)) 425 + scrollRecyclerToView(changeRecordTagR.id.rvChangeRecordTagColor, withId(dialogsR.id.layoutColorPaletteItem)) 426 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withId(dialogsR.id.layoutColorPaletteItem)) 402 427 checkColorState( 403 428 finalColorInt = 0xfff53639.toInt(), 404 429 colorRed = 245, ··· 410 435 ) 411 436 412 437 // Select different color 413 - typeTextIntoView(R.id.etColorSelectionHex, "#29a674") 414 - clickOnViewWithText(R.string.duration_dialog_save) 438 + typeTextIntoView(dialogsR.id.etColorSelectionHex, "#29a674") 439 + clickOnViewWithText(coreR.string.duration_dialog_save) 415 440 416 441 // Check new color selected 417 442 checkPreviewUpdated(withCardColorInt(customColorInt)) 418 - checkViewIsNotDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 443 + checkViewIsNotDisplayed( 444 + allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt))) 445 + ) 419 446 checkViewIsDisplayed( 420 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 447 + allOf( 448 + withId(dialogsR.id.viewColorPaletteItemSelected), 449 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 450 + ) 421 451 ) 422 452 423 453 // Save tag 424 - typeTextIntoView(R.id.etChangeRecordTagName, tagName) 425 - clickOnViewWithText(R.string.change_category_save) 454 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, tagName) 455 + clickOnViewWithText(coreR.string.change_category_save) 426 456 427 457 // Tag saved 428 458 checkViewIsDisplayed( 429 459 allOf( 430 - withId(R.id.viewCategoryItem), 460 + withId(dialogsR.id.viewCategoryItem), 431 461 withCardColorInt(customColorInt), 432 462 hasDescendant(withText(tagName)), 433 463 ) 434 464 ) 435 465 longClickOnView(withText(tagName)) 436 466 checkPreviewUpdated(withCardColorInt(customColorInt)) 437 - clickOnViewWithText(R.string.change_category_color_hint) 438 - checkViewIsNotDisplayed(allOf(withId(R.id.viewColorItemSelected), withParent(withCardColorInt(colorInt)))) 439 - checkViewIsDisplayed( 440 - allOf(withId(R.id.viewColorPaletteItemSelected), withParent(withId(R.id.layoutColorPaletteItem))) 467 + clickOnViewWithText(coreR.string.change_category_color_hint) 468 + checkViewIsNotDisplayed( 469 + allOf(withId(dialogsR.id.viewColorItemSelected), withParent(withCardColorInt(colorInt))) 441 470 ) 442 - scrollRecyclerToView(R.id.rvChangeRecordTagColor, withId(R.id.layoutColorPaletteItem)) 443 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withId(R.id.layoutColorPaletteItem)) 471 + checkViewIsDisplayed( 472 + allOf( 473 + withId(dialogsR.id.viewColorPaletteItemSelected), 474 + withParent(withId(dialogsR.id.layoutColorPaletteItem)) 475 + ) 476 + ) 477 + scrollRecyclerToView(changeRecordTagR.id.rvChangeRecordTagColor, withId(dialogsR.id.layoutColorPaletteItem)) 478 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withId(dialogsR.id.layoutColorPaletteItem)) 444 479 checkColorState( 445 480 finalColorInt = 0xff29a674.toInt(), 446 481 colorRed = 41, ··· 461 496 colorSaturation: Int = 100, 462 497 colorValue: Int = 100, 463 498 ) { 464 - checkSliderValue(R.id.sliderColorSelectionHue, colorHue) 465 - checkViewIsDisplayed(allOf(withId(R.id.cardColorSelectionSelectedColor), withCardColorInt(finalColorInt))) 466 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionRed), withText(colorRed.toString()))) 467 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionGreen), withText(colorGreen.toString()))) 468 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionBlue), withText(colorBlue.toString()))) 469 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionHue), withText(colorHue.toString()))) 470 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionSaturation), withText(colorSaturation.toString()))) 471 - checkViewIsDisplayed(allOf(withId(R.id.etColorSelectionValue), withText(colorValue.toString()))) 499 + checkSliderValue(dialogsR.id.sliderColorSelectionHue, colorHue) 500 + checkViewIsDisplayed( 501 + allOf(withId(dialogsR.id.cardColorSelectionSelectedColor), withCardColorInt(finalColorInt)) 502 + ) 503 + checkViewIsDisplayed( 504 + allOf(withId(dialogsR.id.etColorSelectionRed), withText(colorRed.toString())) 505 + ) 506 + checkViewIsDisplayed( 507 + allOf(withId(dialogsR.id.etColorSelectionGreen), withText(colorGreen.toString())) 508 + ) 509 + checkViewIsDisplayed( 510 + allOf(withId(dialogsR.id.etColorSelectionBlue), withText(colorBlue.toString())) 511 + ) 512 + checkViewIsDisplayed( 513 + allOf(withId(dialogsR.id.etColorSelectionHue), withText(colorHue.toString())) 514 + ) 515 + checkViewIsDisplayed( 516 + allOf(withId(dialogsR.id.etColorSelectionSaturation), withText(colorSaturation.toString())) 517 + ) 518 + checkViewIsDisplayed( 519 + allOf(withId(dialogsR.id.etColorSelectionValue), withText(colorValue.toString())) 520 + ) 472 521 } 473 522 }
+8 -5
app/src/androidTest/java/com/example/util/simpletimetracker/DeleteRecordTest.kt
··· 19 19 import org.hamcrest.Matchers.allOf 20 20 import org.junit.Test 21 21 import org.junit.runner.RunWith 22 + import com.example.util.simpletimetracker.core.R as coreR 23 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 24 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 22 25 23 26 @HiltAndroidTest 24 27 @RunWith(AndroidJUnit4::class) ··· 39 42 40 43 // Delete item 41 44 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 42 - checkViewIsDisplayed(withId(R.id.btnChangeRecordDelete)) 43 - clickOnViewWithId(R.id.btnChangeRecordDelete) 45 + checkViewIsDisplayed(withId(changeRecordR.id.btnChangeRecordDelete)) 46 + clickOnViewWithId(changeRecordR.id.btnChangeRecordDelete) 44 47 45 48 // Check message 46 49 checkViewIsDisplayed( 47 50 allOf( 48 - withText(getString(R.string.record_removed, name)), 51 + withText(getString(coreR.string.record_removed, name)), 49 52 withId(com.google.android.material.R.id.snackbar_text) 50 53 ) 51 54 ) ··· 56 59 checkViewDoesNotExist(allOf(withTag(icon), isCompletelyDisplayed())) 57 60 58 61 // Check undo 59 - clickOnViewWithText(R.string.record_removed_undo) 62 + clickOnViewWithText(coreR.string.record_removed_undo) 60 63 61 64 // Record is back 62 65 checkViewIsDisplayed( 63 66 CoreMatchers.allOf( 64 - withId(R.id.viewRecordItem), 67 + withId(baseR.id.viewRecordItem), 65 68 withCardColor(color), 66 69 hasDescendant(withText(name)), 67 70 hasDescendant(withTag(icon)),
+24 -10
app/src/androidTest/java/com/example/util/simpletimetracker/DeleteRecordTypeTest.kt
··· 15 15 import com.example.util.simpletimetracker.utils.tryAction 16 16 import com.example.util.simpletimetracker.utils.withCardColor 17 17 import com.example.util.simpletimetracker.utils.withTag 18 + import com.google.android.material.R 18 19 import dagger.hilt.android.testing.HiltAndroidTest 19 - import org.hamcrest.CoreMatchers.allOf 20 + import org.hamcrest.Matchers.allOf 20 21 import org.junit.Test 21 22 import org.junit.runner.RunWith 23 + import com.example.util.simpletimetracker.core.R as coreR 24 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 25 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 22 26 23 27 @HiltAndroidTest 24 28 @RunWith(AndroidJUnit4::class) ··· 37 41 tryAction { 38 42 checkViewIsDisplayed( 39 43 allOf( 40 - withId(R.id.viewRecordTypeItem), 44 + withId(baseR.id.viewRecordTypeItem), 41 45 hasDescendant(withText(name)), 42 46 hasDescendant(withTag(icon)), 43 47 withCardColor(color) ··· 47 51 48 52 // Archive item 49 53 longClickOnView(withText(name)) 50 - checkViewIsDisplayed(withId(R.id.btnChangeRecordTypeDelete)) 51 - clickOnViewWithId(R.id.btnChangeRecordTypeDelete) 52 - 53 - // TODO check message 54 + checkViewIsDisplayed(withId(changeRecordTypeR.id.btnChangeRecordTypeDelete)) 55 + clickOnViewWithId(changeRecordTypeR.id.btnChangeRecordTypeDelete) 56 + checkViewIsDisplayed( 57 + allOf( 58 + withText(coreR.string.change_record_type_archived), 59 + withId(R.id.snackbar_text) 60 + ) 61 + ) 54 62 55 63 // Record type is deleted 56 64 checkViewDoesNotExist( 57 65 allOf( 58 - withId(R.id.viewRecordTypeItem), 66 + withId(baseR.id.viewRecordTypeItem), 59 67 hasDescendant(withText(name)), 60 68 hasDescendant(withTag(icon)), 61 69 withCardColor(color) ··· 66 74 NavUtils.openSettingsScreen() 67 75 NavUtils.openArchiveScreen() 68 76 clickOnViewWithText(name) 69 - clickOnViewWithText(R.string.archive_dialog_delete) 70 - clickOnViewWithText(R.string.archive_dialog_delete) 77 + clickOnViewWithText(coreR.string.archive_dialog_delete) 78 + clickOnViewWithText(coreR.string.archive_dialog_delete) 71 79 checkViewDoesNotExist(withText(name)) 72 - checkViewIsDisplayed(withText(R.string.archive_empty)) 80 + tryAction { checkViewIsDisplayed(withText(coreR.string.archive_empty)) } 81 + checkViewIsDisplayed( 82 + allOf( 83 + withText(coreR.string.archive_activity_deleted), 84 + withId(R.id.snackbar_text) 85 + ) 86 + ) 73 87 pressBack() 74 88 75 89 // Record removed
+99 -71
app/src/androidTest/java/com/example/util/simpletimetracker/IconTest.kt
··· 27 27 import org.hamcrest.CoreMatchers.allOf 28 28 import org.junit.Test 29 29 import org.junit.runner.RunWith 30 + import com.example.util.simpletimetracker.core.R as coreR 31 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 32 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 33 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 34 + import com.example.util.simpletimetracker.feature_change_running_record.R as changeRunningRecordR 35 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 30 36 31 37 @HiltAndroidTest 32 38 @RunWith(AndroidJUnit4::class) ··· 41 47 testUtils.addActivity(name = secondName, text = lastEmoji) 42 48 43 49 // Open change record type screen 44 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 50 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 45 51 46 52 // Select emoji 47 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 53 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 48 54 clickOnView( 49 55 allOf( 50 - isDescendantOfA(withId(R.id.btnChangeRecordTypeIconSwitch)), 51 - withText(R.string.change_record_type_icon_emoji_hint) 56 + isDescendantOfA(withId(changeRecordTypeR.id.btnChangeRecordTypeIconSwitch)), 57 + withText(coreR.string.change_record_type_icon_emoji_hint) 52 58 ) 53 59 ) 54 60 tryAction { clickOnViewWithText(firstEmoji) } 55 61 56 62 // Preview is updated 57 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), hasDescendant(withText(firstEmoji)))) 63 + checkViewIsDisplayed( 64 + allOf(withId(changeRecordTypeR.id.previewChangeRecordType), hasDescendant(withText(firstEmoji))) 65 + ) 58 66 59 67 // Save 60 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 61 - typeTextIntoView(R.id.etChangeRecordTypeName, firstName) 62 - clickOnViewWithText(R.string.change_record_type_save) 68 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 69 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, firstName) 70 + clickOnViewWithText(coreR.string.change_record_type_save) 63 71 64 72 // Record type is created 65 73 tryAction { 66 74 checkViewIsDisplayed( 67 75 allOf( 68 - withId(R.id.viewRecordTypeItem), 76 + withId(baseR.id.viewRecordTypeItem), 69 77 hasDescendant(withText(firstName)), 70 78 hasDescendant(withText(firstEmoji)) 71 79 ) ··· 78 86 // Check running record 79 87 checkViewIsDisplayed( 80 88 allOf( 81 - withId(R.id.viewRunningRecordItem), 89 + withId(baseR.id.viewRunningRecordItem), 82 90 hasDescendant(withText(firstName)), 83 91 hasDescendant(withText(firstEmoji)) 84 92 ) 85 93 ) 86 94 87 95 // Change running record 88 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(firstName))) 89 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRunningRecord), hasDescendant(withText(firstEmoji)))) 90 - clickOnViewWithText(R.string.change_record_type_field) 91 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(secondName)) 92 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRunningRecord), hasDescendant(withText(lastEmoji)))) 93 - clickOnViewWithText(R.string.change_record_save) 96 + longClickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(firstName))) 97 + checkViewIsDisplayed( 98 + allOf(withId(changeRunningRecordR.id.previewChangeRunningRecord), hasDescendant(withText(firstEmoji))) 99 + ) 100 + clickOnViewWithText(coreR.string.change_record_type_field) 101 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(secondName)) 102 + checkViewIsDisplayed( 103 + allOf(withId(changeRunningRecordR.id.previewChangeRunningRecord), hasDescendant(withText(lastEmoji))) 104 + ) 105 + clickOnViewWithText(coreR.string.change_record_save) 94 106 95 107 // Check running record 96 108 tryAction { 97 109 checkViewIsDisplayed( 98 110 allOf( 99 - withId(R.id.viewRunningRecordItem), 111 + withId(baseR.id.viewRunningRecordItem), 100 112 hasDescendant(withText(secondName)), 101 113 hasDescendant(withText(lastEmoji)) 102 114 ) ··· 104 116 } 105 117 106 118 // Stop timer 107 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(secondName))) 119 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(secondName))) 108 120 109 121 // Record is added 110 122 NavUtils.openRecordsScreen() 111 123 checkViewIsDisplayed( 112 124 allOf( 113 - withId(R.id.viewRecordItem), 125 + withId(baseR.id.viewRecordItem), 114 126 hasDescendant(withText(secondName)), 115 127 hasDescendant(withText(lastEmoji)), 116 128 isCompletelyDisplayed() ··· 119 131 120 132 // Change record 121 133 clickOnView(allOf(withText(secondName), isCompletelyDisplayed())) 122 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), hasDescendant(withText(lastEmoji)))) 123 - clickOnViewWithText(R.string.change_record_type_field) 124 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(firstName)) 125 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), hasDescendant(withText(firstEmoji)))) 126 - clickOnViewWithText(R.string.change_record_type_save) 134 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), hasDescendant(withText(lastEmoji)))) 135 + clickOnViewWithText(coreR.string.change_record_type_field) 136 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(firstName)) 137 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), hasDescendant(withText(firstEmoji)))) 138 + clickOnViewWithText(coreR.string.change_record_type_save) 127 139 128 140 // Check record 129 141 tryAction { 130 142 checkViewIsDisplayed( 131 143 allOf( 132 - withId(R.id.viewRecordItem), 144 + withId(baseR.id.viewRecordItem), 133 145 hasDescendant(withText(firstName)), 134 146 hasDescendant(withText(firstEmoji)), 135 147 isCompletelyDisplayed() ··· 149 161 testUtils.addActivity(name = secondName, text = secondIconText) 150 162 151 163 // Open change record type screen 152 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 164 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 153 165 154 166 // Select emoji 155 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 167 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 156 168 clickOnView( 157 169 allOf( 158 - isDescendantOfA(withId(R.id.btnChangeRecordTypeIconSwitch)), 159 - withText(R.string.change_record_type_icon_text_hint) 170 + isDescendantOfA(withId(changeRecordTypeR.id.btnChangeRecordTypeIconSwitch)), 171 + withText(coreR.string.change_record_type_icon_text_hint) 160 172 ) 161 173 ) 162 - tryAction { typeTextIntoView(R.id.etChangeRecordTypeIconText, firstIconText) } 174 + tryAction { typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeIconText, firstIconText) } 163 175 164 176 // Preview is updated 165 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), hasDescendant(withText(firstIconText)))) 177 + checkViewIsDisplayed( 178 + allOf(withId(changeRecordTypeR.id.previewChangeRecordType), hasDescendant(withText(firstIconText))) 179 + ) 166 180 167 181 // Save 168 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 169 - typeTextIntoView(R.id.etChangeRecordTypeName, firstName) 170 - clickOnViewWithText(R.string.change_record_type_save) 182 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 183 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, firstName) 184 + clickOnViewWithText(coreR.string.change_record_type_save) 171 185 172 186 // Record type is created 173 187 tryAction { 174 188 checkViewIsDisplayed( 175 189 allOf( 176 - withId(R.id.viewRecordTypeItem), 190 + withId(baseR.id.viewRecordTypeItem), 177 191 hasDescendant(withText(firstName)), 178 192 hasDescendant(withText(firstIconText)) 179 193 ) ··· 186 200 // Check running record 187 201 checkViewIsDisplayed( 188 202 allOf( 189 - withId(R.id.viewRunningRecordItem), 203 + withId(baseR.id.viewRunningRecordItem), 190 204 hasDescendant(withText(firstName)), 191 205 hasDescendant(withText(firstIconText)) 192 206 ) 193 207 ) 194 208 195 209 // Change running record 196 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(firstName))) 197 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRunningRecord), hasDescendant(withText(firstIconText)))) 198 - clickOnViewWithText(R.string.change_record_type_field) 199 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(secondName)) 200 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRunningRecord), hasDescendant(withText(secondIconText)))) 201 - clickOnViewWithText(R.string.change_record_save) 210 + longClickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(firstName))) 211 + checkViewIsDisplayed( 212 + allOf(withId(changeRunningRecordR.id.previewChangeRunningRecord), hasDescendant(withText(firstIconText))) 213 + ) 214 + clickOnViewWithText(coreR.string.change_record_type_field) 215 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(secondName)) 216 + checkViewIsDisplayed( 217 + allOf(withId(changeRunningRecordR.id.previewChangeRunningRecord), hasDescendant(withText(secondIconText))) 218 + ) 219 + clickOnViewWithText(coreR.string.change_record_save) 202 220 203 221 // Check running record 204 222 tryAction { 205 223 checkViewIsDisplayed( 206 224 allOf( 207 - withId(R.id.viewRunningRecordItem), 225 + withId(baseR.id.viewRunningRecordItem), 208 226 hasDescendant(withText(secondName)), 209 227 hasDescendant(withText(secondIconText)) 210 228 ) ··· 212 230 } 213 231 214 232 // Stop timer 215 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(secondName))) 233 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(secondName))) 216 234 217 235 // Record is added 218 236 NavUtils.openRecordsScreen() 219 237 checkViewIsDisplayed( 220 238 allOf( 221 - withId(R.id.viewRecordItem), 239 + withId(baseR.id.viewRecordItem), 222 240 hasDescendant(withText(secondName)), 223 241 hasDescendant(withText(secondIconText)), 224 242 isCompletelyDisplayed() ··· 227 245 228 246 // Change record 229 247 clickOnView(allOf(withText(secondName), isCompletelyDisplayed())) 230 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), hasDescendant(withText(secondIconText)))) 231 - clickOnViewWithText(R.string.change_record_type_field) 232 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(firstName)) 233 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), hasDescendant(withText(firstIconText)))) 234 - clickOnViewWithText(R.string.change_record_type_save) 248 + checkViewIsDisplayed( 249 + allOf(withId(changeRecordR.id.previewChangeRecord), hasDescendant(withText(secondIconText))) 250 + ) 251 + clickOnViewWithText(coreR.string.change_record_type_field) 252 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(firstName)) 253 + checkViewIsDisplayed( 254 + allOf(withId(changeRecordR.id.previewChangeRecord), hasDescendant(withText(firstIconText))) 255 + ) 256 + clickOnViewWithText(coreR.string.change_record_type_save) 235 257 236 258 // Check record 237 259 tryAction { 238 260 checkViewIsDisplayed( 239 261 allOf( 240 - withId(R.id.viewRecordItem), 262 + withId(baseR.id.viewRecordItem), 241 263 hasDescendant(withText(firstName)), 242 264 hasDescendant(withText(firstIconText)), 243 265 isCompletelyDisplayed() ··· 249 271 @Test 250 272 fun iconImageCategorySelection() { 251 273 // Open record type add 252 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 274 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 253 275 254 276 // Open image icons 255 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 277 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 256 278 257 279 // Check categories 258 280 iconImageMapper.getAvailableImages().forEach { (category, images) -> ··· 261 283 val firstImage = images.values.first() 262 284 263 285 if (category == iconImageMapper.getAvailableCategories().last()) { 264 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 265 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(swipeUp(50)) 286 + onView( 287 + withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar() 288 + ) 289 + onView( 290 + withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(swipeUp(50) 291 + ) 266 292 } 267 293 268 294 // Check category hint ··· 275 301 @Test 276 302 fun iconEmojiCategorySelection() { 277 303 // Open record type add 278 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 304 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 279 305 280 306 // Open emoji icons 281 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 307 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 282 308 clickOnView( 283 309 allOf( 284 - isDescendantOfA(withId(R.id.btnChangeRecordTypeIconSwitch)), 285 - withText(R.string.change_record_type_icon_emoji_hint) 310 + isDescendantOfA(withId(changeRecordTypeR.id.btnChangeRecordTypeIconSwitch)), 311 + withText(coreR.string.change_record_type_icon_emoji_hint) 286 312 ) 287 313 ) 288 314 ··· 309 335 val emojiSkinTone = emojiSkinTones.last() 310 336 311 337 // Open record type add 312 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 313 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 338 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 339 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 314 340 315 341 // Open emoji icons 316 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 342 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 317 343 clickOnView( 318 344 allOf( 319 - isDescendantOfA(withId(R.id.btnChangeRecordTypeIconSwitch)), 320 - withText(R.string.change_record_type_icon_emoji_hint) 345 + isDescendantOfA(withId(changeRecordTypeR.id.btnChangeRecordTypeIconSwitch)), 346 + withText(coreR.string.change_record_type_icon_emoji_hint) 321 347 ) 322 348 ) 323 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 324 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withText(emojiDefault))) 325 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withText(emojiDefault)) 349 + onView(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 350 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withText(emojiDefault))) 351 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withText(emojiDefault)) 326 352 327 353 // Check dialog 328 - onView(withId(R.id.rvEmojiSelectionContainer)).check(recyclerItemCount(6)) 354 + onView(withId(dialogsR.id.rvEmojiSelectionContainer)).check(recyclerItemCount(6)) 329 355 330 356 // Check emojis 331 357 checkViewIsDisplayed(withText(emojiDefault)) ··· 336 362 clickOnViewWithText(emojiSkinTone) 337 363 338 364 // Preview is updated 339 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecordType), hasDescendant(withText(emojiSkinTone)))) 365 + checkViewIsDisplayed( 366 + allOf(withId(changeRecordTypeR.id.previewChangeRecordType), hasDescendant(withText(emojiSkinTone))) 367 + ) 340 368 341 369 // Check record type 342 - clickOnViewWithText(R.string.change_record_type_save) 370 + clickOnViewWithText(coreR.string.change_record_type_save) 343 371 checkViewIsDisplayed( 344 372 allOf( 345 - withId(R.id.viewRecordTypeItem), 373 + withId(baseR.id.viewRecordTypeItem), 346 374 hasDescendant(withText(name)), 347 375 hasDescendant(withText(emojiSkinTone)) 348 376 )
+77 -67
app/src/androidTest/java/com/example/util/simpletimetracker/MainScreenEmptyTest.kt
··· 25 25 import org.hamcrest.CoreMatchers.allOf 26 26 import org.junit.Test 27 27 import org.junit.runner.RunWith 28 + import com.example.util.simpletimetracker.core.R as coreR 29 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 30 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 31 + import com.example.util.simpletimetracker.feature_records.R as recordsR 32 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 28 33 29 34 @HiltAndroidTest 30 35 @RunWith(AndroidJUnit4::class) ··· 34 39 fun mainScreenEmpty() { 35 40 val name = "Test" 36 41 37 - tryAction { checkViewIsDisplayed(withText(R.string.running_records_types_empty)) } 38 - checkViewDoesNotExist(withText(R.string.running_records_empty)) 42 + tryAction { checkViewIsDisplayed(withText(coreR.string.running_records_types_empty)) } 43 + checkViewDoesNotExist(withText(coreR.string.running_records_empty)) 39 44 40 45 // Add activity 41 46 NavUtils.openRunningRecordsScreen() 42 - clickOnView(withText(R.string.running_records_add_type)) 43 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 47 + clickOnView(withText(coreR.string.running_records_add_type)) 48 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 44 49 closeSoftKeyboard() 45 - clickOnView(withText(R.string.change_record_type_save)) 46 - checkViewDoesNotExist(withText(R.string.running_records_types_empty)) 47 - checkViewIsDisplayed(withText(R.string.running_records_empty)) 50 + clickOnView(withText(coreR.string.change_record_type_save)) 51 + checkViewDoesNotExist(withText(coreR.string.running_records_types_empty)) 52 + checkViewIsDisplayed(withText(coreR.string.running_records_empty)) 48 53 49 54 // Start timer 50 55 clickOnViewWithText(name) 51 - checkViewDoesNotExist(withText(R.string.running_records_empty)) 52 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 53 - tryAction { checkViewIsDisplayed(withText(R.string.running_records_empty)) } 56 + checkViewDoesNotExist(withText(coreR.string.running_records_empty)) 57 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 58 + tryAction { checkViewIsDisplayed(withText(coreR.string.running_records_empty)) } 54 59 } 55 60 56 61 @Test ··· 60 65 NavUtils.openRecordsScreen() 61 66 checkViewIsDisplayed( 62 67 allOf( 63 - withId(R.id.viewRecordItem), 64 - hasDescendant(withText(R.string.untracked_time_name)), 68 + withId(baseR.id.viewRecordItem), 69 + hasDescendant(withText(coreR.string.untracked_time_name)), 65 70 isCompletelyDisplayed() 66 71 ) 67 72 ) 68 - checkViewIsDisplayed(allOf(withText(R.string.records_hint), isCompletelyDisplayed())) 69 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 73 + checkViewIsDisplayed(allOf(withText(coreR.string.records_hint), isCompletelyDisplayed())) 74 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 70 75 checkViewIsDisplayed( 71 76 allOf( 72 - withId(R.id.viewRecordItem), 73 - hasDescendant(withText(R.string.untracked_time_name)), 77 + withId(baseR.id.viewRecordItem), 78 + hasDescendant(withText(coreR.string.untracked_time_name)), 74 79 hasDescendant(withSubstring("24$hourString 0$minuteString")), 75 80 isCompletelyDisplayed() 76 81 ) 77 82 ) 78 - checkViewIsDisplayed(allOf(withText(R.string.records_hint), isCompletelyDisplayed())) 79 - clickOnViewWithId(R.id.btnRecordsContainerNext) 80 - clickOnViewWithId(R.id.btnRecordsContainerNext) 81 - checkViewIsDisplayed(allOf(withText(R.string.records_empty), isCompletelyDisplayed())) 82 - checkViewDoesNotExist(allOf(withText(R.string.records_hint), isCompletelyDisplayed())) 83 - checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 83 + checkViewIsDisplayed(allOf(withText(coreR.string.records_hint), isCompletelyDisplayed())) 84 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 85 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 86 + checkViewIsDisplayed(allOf(withText(coreR.string.records_empty), isCompletelyDisplayed())) 87 + checkViewDoesNotExist(allOf(withText(coreR.string.records_hint), isCompletelyDisplayed())) 88 + checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 84 89 } 85 90 86 91 @Test ··· 89 94 checkRanges() 90 95 91 96 // Week range 92 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 93 - clickOnViewWithText(R.string.range_week) 97 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 98 + clickOnViewWithText(coreR.string.range_week) 94 99 checkRanges() 95 100 96 101 // Month range 97 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 98 - clickOnViewWithText(R.string.range_month) 102 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 103 + clickOnViewWithText(coreR.string.range_month) 99 104 checkRanges() 100 105 101 106 // Year range 102 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 103 - clickOnViewWithText(R.string.range_year) 107 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 108 + clickOnViewWithText(coreR.string.range_year) 104 109 checkRanges() 105 110 106 111 // Overall range 107 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 108 - clickOnViewWithText(R.string.range_overall) 109 - tryAction { checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) } 112 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 113 + clickOnViewWithText(coreR.string.range_overall) 114 + checkViewIsDisplayed( 115 + allOf( 116 + withId(baseR.id.viewStatisticsItem), 117 + hasDescendant(withText(coreR.string.untracked_time_name)), 118 + hasDescendant(withSubstring("100%")), 119 + isCompletelyDisplayed() 120 + ) 121 + ) 110 122 111 123 // Back to day range 112 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 113 - clickOnViewWithText(R.string.range_day) 124 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 125 + clickOnViewWithText(coreR.string.range_day) 114 126 checkRanges() 115 127 116 128 // Empty category statistics 117 - clickOnViewWithIdOnPager(R.id.btnStatisticsEmptyFilter) 118 - clickOnViewWithText(R.string.category_hint) 129 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsEmptyFilter) 130 + clickOnViewWithText(coreR.string.category_hint) 119 131 pressBack() 132 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 120 133 121 134 // Day range 122 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 123 - clickOnViewWithText(R.string.range_day) 124 - checkCategoryRanges() 135 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 136 + clickOnViewWithText(coreR.string.range_day) 137 + checkRanges() 125 138 126 139 // Week range 127 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 128 - clickOnViewWithText(R.string.range_week) 129 - checkCategoryRanges() 140 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 141 + clickOnViewWithText(coreR.string.range_week) 142 + checkRanges() 130 143 131 144 // Month range 132 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 133 - clickOnViewWithText(R.string.range_month) 134 - checkCategoryRanges() 145 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 146 + clickOnViewWithText(coreR.string.range_month) 147 + checkRanges() 135 148 136 149 // Year range 137 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 138 - clickOnViewWithText(R.string.range_year) 139 - checkCategoryRanges() 150 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 151 + clickOnViewWithText(coreR.string.range_year) 152 + checkRanges() 140 153 141 154 // Overall range 142 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 143 - clickOnViewWithText(R.string.range_overall) 144 - tryAction { checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) } 155 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 156 + clickOnViewWithText(coreR.string.range_overall) 157 + checkViewIsDisplayed( 158 + allOf( 159 + withId(baseR.id.viewStatisticsItem), 160 + hasDescendant(withText(coreR.string.untracked_time_name)), 161 + hasDescendant(withSubstring("100%")), 162 + isCompletelyDisplayed() 163 + ) 164 + ) 145 165 146 166 // Back to day range 147 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 148 - clickOnViewWithText(R.string.range_day) 149 - checkCategoryRanges() 167 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 168 + clickOnViewWithText(coreR.string.range_day) 169 + checkRanges() 150 170 } 151 171 152 172 private fun checkRanges() { 153 173 checkViewIsDisplayed( 154 174 allOf( 155 - withId(R.id.viewStatisticsItem), 156 - hasDescendant(withText(R.string.untracked_time_name)), 175 + withId(baseR.id.viewStatisticsItem), 176 + hasDescendant(withText(coreR.string.untracked_time_name)), 157 177 hasDescendant(withSubstring("100%")), 158 178 isCompletelyDisplayed() 159 179 ) 160 180 ) 161 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 162 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 163 - } 164 - 165 - private fun checkCategoryRanges() { 166 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 167 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 168 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 169 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 170 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 171 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 172 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 181 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 182 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 173 183 } 174 184 }
+23 -17
app/src/androidTest/java/com/example/util/simpletimetracker/MainScreenTest.kt
··· 21 21 import org.hamcrest.CoreMatchers.allOf 22 22 import org.junit.Test 23 23 import org.junit.runner.RunWith 24 + import com.example.util.simpletimetracker.core.R as coreR 25 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 26 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 27 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 28 + import com.example.util.simpletimetracker.feature_records.R as recordsR 29 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 24 30 25 31 @HiltAndroidTest 26 32 @RunWith(AndroidJUnit4::class) ··· 31 37 val name = "Test" 32 38 33 39 // Add activity 34 - tryAction { clickOnView(withText(R.string.running_records_add_type)) } 40 + tryAction { clickOnView(withText(coreR.string.running_records_add_type)) } 35 41 closeSoftKeyboard() 36 42 pressBack() 37 43 38 - clickOnView(withText(R.string.running_records_add_type)) 39 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 44 + clickOnView(withText(coreR.string.running_records_add_type)) 45 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 40 46 closeSoftKeyboard() 41 - clickOnView(withText(R.string.change_record_type_save)) 47 + clickOnView(withText(coreR.string.change_record_type_save)) 42 48 Thread.sleep(1000) 43 49 44 50 // Start timer 45 51 clickOnViewWithText(name) 46 52 47 53 // Stop timer 48 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 54 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 49 55 50 56 // Records 51 57 NavUtils.openRecordsScreen() ··· 53 59 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 54 60 pressBack() 55 61 56 - clickOnViewWithId(R.id.btnRecordAdd) 62 + clickOnViewWithId(recordsR.id.btnRecordAdd) 57 63 pressBack() 58 64 59 - clickOnViewWithId(R.id.btnRecordAdd) 60 - clickOnViewWithText(R.string.change_record_type_field) 61 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 62 - clickOnViewWithText(R.string.change_record_save) 65 + clickOnViewWithId(recordsR.id.btnRecordAdd) 66 + clickOnViewWithText(coreR.string.change_record_type_field) 67 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 68 + clickOnViewWithText(coreR.string.change_record_save) 63 69 64 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 65 - longClickOnViewWithId(R.id.btnRecordsContainerToday) 66 - clickOnViewWithId(R.id.btnRecordsContainerNext) 70 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 71 + longClickOnViewWithId(recordsR.id.btnRecordsContainerToday) 72 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 67 73 68 74 // Statistics 69 75 NavUtils.openStatisticsScreen() 70 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 76 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 71 77 pressBack() 72 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 73 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 74 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 78 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 79 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 80 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 75 81 76 82 // Settings 77 83 NavUtils.openSettingsScreen()
+10 -7
app/src/androidTest/java/com/example/util/simpletimetracker/MessagesTest.kt
··· 13 13 import org.hamcrest.Matchers.allOf 14 14 import org.junit.Test 15 15 import org.junit.runner.RunWith 16 + import com.example.util.simpletimetracker.core.R as coreR 17 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 18 + import com.example.util.simpletimetracker.feature_records.R as recordsR 16 19 17 20 @HiltAndroidTest 18 21 @RunWith(AndroidJUnit4::class) ··· 20 23 21 24 @Test 22 25 fun messageRecordTypeName() { 23 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 24 - clickOnViewWithId(R.id.fieldChangeRecordTypeColor) 25 - clickOnViewWithText(R.string.change_record_type_save) 26 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 27 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeColor) 28 + clickOnViewWithText(coreR.string.change_record_type_save) 26 29 checkViewIsDisplayed( 27 30 allOf( 28 - withText(R.string.change_record_message_choose_name), 31 + withText(coreR.string.change_record_message_choose_name), 29 32 withId(com.google.android.material.R.id.snackbar_text) 30 33 ) 31 34 ) ··· 34 37 @Test 35 38 fun messageRecordActivity() { 36 39 NavUtils.openRecordsScreen() 37 - clickOnViewWithId(R.id.btnRecordAdd) 38 - clickOnViewWithText(R.string.change_record_save) 40 + clickOnViewWithId(recordsR.id.btnRecordAdd) 41 + clickOnViewWithText(coreR.string.change_record_save) 39 42 checkViewIsDisplayed( 40 43 allOf( 41 - withText(R.string.change_record_message_choose_type), 44 + withText(coreR.string.change_record_message_choose_type), 42 45 withId(com.google.android.material.R.id.snackbar_text) 43 46 ) 44 47 )
+72 -60
app/src/androidTest/java/com/example/util/simpletimetracker/RecordActionsContinueTest.kt
··· 25 25 import com.example.util.simpletimetracker.utils.withCardColor 26 26 import com.example.util.simpletimetracker.utils.withTag 27 27 import dagger.hilt.android.testing.HiltAndroidTest 28 + import java.util.Calendar 29 + import java.util.concurrent.TimeUnit 28 30 import kotlinx.coroutines.runBlocking 29 31 import org.hamcrest.CoreMatchers.allOf 30 32 import org.junit.Test 31 33 import org.junit.runner.RunWith 32 - import java.util.Calendar 33 - import java.util.concurrent.TimeUnit 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 37 + import com.example.util.simpletimetracker.feature_records.R as recordsR 34 38 35 39 @HiltAndroidTest 36 40 @RunWith(AndroidJUnit4::class) ··· 70 74 71 75 // Continue 72 76 clickOnViewWithText(fullName) 73 - clickOnViewWithText(R.string.change_record_actions_hint) 74 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 77 + clickOnViewWithText(coreR.string.change_record_actions_hint) 78 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 75 79 76 80 // Check no record 77 81 checkViewDoesNotExist( 78 - allOf(withText(fullName), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 82 + allOf(withText(fullName), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 79 83 ) 80 84 81 85 // Check running record ··· 102 106 // Open untracked time 103 107 checkViewIsDisplayed( 104 108 allOf( 105 - withId(R.id.viewRecordItem), 106 - hasDescendant(withText(R.string.untracked_time_name)), 109 + withId(baseR.id.viewRecordItem), 110 + hasDescendant(withText(coreR.string.untracked_time_name)), 107 111 hasDescendant(withText(timeStartedPreview)), 108 112 hasDescendant(withText(timeEndedPreview)), 109 113 hasDescendant(withText(timeRangePreview)), 110 114 isCompletelyDisplayed() 111 115 ) 112 116 ) 113 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2)) 114 - clickOnViewWithText(R.string.untracked_time_name) 117 + onView( 118 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2) 119 + ) 120 + clickOnViewWithText(coreR.string.untracked_time_name) 115 121 116 122 // Continue untracked doesn't work 117 - clickOnViewWithText(R.string.change_record_actions_hint) 118 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 123 + clickOnViewWithText(coreR.string.change_record_actions_hint) 124 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 119 125 clickOnViewWithId(com.google.android.material.R.id.snackbar_text) 120 - clickOnViewWithText(R.string.change_record_actions_hint) 126 + clickOnViewWithText(coreR.string.change_record_actions_hint) 121 127 122 128 // Select activity 123 - clickOnViewWithText(R.string.change_record_type_field) 124 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 129 + clickOnViewWithText(coreR.string.change_record_type_field) 130 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 125 131 126 132 // Continue 127 - clickOnViewWithText(R.string.change_record_actions_hint) 128 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 133 + clickOnViewWithText(coreR.string.change_record_actions_hint) 134 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 129 135 130 136 checkViewIsDisplayed( 131 137 allOf( 132 - withId(R.id.viewRunningRecordItem), 138 + withId(baseR.id.viewRunningRecordItem), 133 139 hasDescendant(withText(name)), 134 140 hasDescendant(withText(timeStartedPreview)), 135 141 isCompletelyDisplayed() 136 142 ) 137 143 ) 138 - checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 139 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2)) 144 + checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 145 + onView( 146 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2) 147 + ) 140 148 141 149 NavUtils.openRunningRecordsScreen() 142 150 checkViewIsDisplayed( 143 151 allOf( 144 - withId(R.id.viewRunningRecordItem), 152 + withId(baseR.id.viewRunningRecordItem), 145 153 hasDescendant(withText(name)), 146 154 hasDescendant(withText(timeStartedPreview)), 147 155 isCompletelyDisplayed() ··· 164 172 NavUtils.openRecordsScreen() 165 173 166 174 // Open add new record 167 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(1)) 168 - clickOnViewWithId(R.id.btnRecordAdd) 175 + onView( 176 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(1) 177 + ) 178 + clickOnViewWithId(recordsR.id.btnRecordAdd) 169 179 170 180 // Continue untracked doesn't work 171 - clickOnViewWithText(R.string.change_record_actions_hint) 172 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 181 + clickOnViewWithText(coreR.string.change_record_actions_hint) 182 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 173 183 clickOnViewWithId(com.google.android.material.R.id.snackbar_text) 174 - clickOnViewWithText(R.string.change_record_actions_hint) 184 + clickOnViewWithText(coreR.string.change_record_actions_hint) 175 185 176 186 // Select activity 177 - clickOnViewWithText(R.string.change_record_type_field) 178 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 187 + clickOnViewWithText(coreR.string.change_record_type_field) 188 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 179 189 180 190 // Continue 181 - clickOnViewWithText(R.string.change_record_actions_hint) 182 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 191 + clickOnViewWithText(coreR.string.change_record_actions_hint) 192 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 183 193 184 194 checkViewDoesNotExist( 185 195 allOf( 186 196 withText(name), 187 - isDescendantOfA(withId(R.id.viewRecordItem)), 197 + isDescendantOfA(withId(baseR.id.viewRecordItem)), 188 198 isCompletelyDisplayed() 189 199 ) 190 200 ) 191 201 checkViewIsDisplayed( 192 202 allOf( 193 - withId(R.id.viewRunningRecordItem), 203 + withId(baseR.id.viewRunningRecordItem), 194 204 hasDescendant(withText(name)), 195 205 hasDescendant(withText(timeStartedPreview)), 196 206 isCompletelyDisplayed() 197 207 ) 198 208 ) 199 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2)) 209 + onView( 210 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2) 211 + ) 200 212 201 213 NavUtils.openRunningRecordsScreen() 202 214 checkViewIsDisplayed( 203 215 allOf( 204 - withId(R.id.viewRunningRecordItem), 216 + withId(baseR.id.viewRunningRecordItem), 205 217 hasDescendant(withText(name)), 206 218 hasDescendant(withText(timeStartedPreview)), 207 219 isCompletelyDisplayed() ··· 228 240 // Try continue record 229 241 NavUtils.openRecordsScreen() 230 242 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 231 - clickOnViewWithText(R.string.change_record_actions_hint) 232 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 243 + clickOnViewWithText(coreR.string.change_record_actions_hint) 244 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 233 245 // Snackbar is in the way of Add button 234 246 clickOnViewWithId(com.google.android.material.R.id.snackbar_text) 235 247 pressBack() 236 248 237 249 // Try continue from add record 238 - clickOnViewWithId(R.id.btnRecordAdd) 239 - clickOnViewWithText(R.string.change_record_type_field) 240 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 250 + clickOnViewWithId(recordsR.id.btnRecordAdd) 251 + clickOnViewWithText(coreR.string.change_record_type_field) 252 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 241 253 clickOnViewWithText("+30") 242 254 clickOnViewWithText("+30") 243 255 clickOnViewWithText("+5") 244 - clickOnViewWithText(R.string.change_record_actions_hint) 245 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 256 + clickOnViewWithText(coreR.string.change_record_actions_hint) 257 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 246 258 247 259 // Still on edit screen 248 - checkViewIsDisplayed(withText(R.string.change_record_save)) 260 + checkViewIsDisplayed(withText(coreR.string.change_record_save)) 249 261 } 250 262 251 263 @Test ··· 257 269 Thread.sleep(1000) 258 270 tryAction { 259 271 clickOnView( 260 - allOf(withId(R.id.viewRecordTypeItem), hasDescendant(withText(name))) 272 + allOf(withId(baseR.id.viewRecordTypeItem), hasDescendant(withText(name))) 261 273 ) 262 274 } 263 275 tryAction { 264 276 longClickOnView( 265 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 277 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 266 278 ) 267 279 } 268 280 269 281 // Try continue record 270 - clickOnViewWithText(R.string.change_record_actions_hint) 271 - checkViewIsNotDisplayed(withText(R.string.change_record_continue)) 282 + clickOnViewWithText(coreR.string.change_record_actions_hint) 283 + checkViewIsNotDisplayed(withText(coreR.string.change_record_continue)) 272 284 } 273 285 274 286 @Test ··· 281 293 NavUtils.openRecordsScreen() 282 294 283 295 // Continue 284 - clickOnViewWithId(R.id.btnRecordAdd) 285 - clickOnViewWithText(R.string.change_record_type_field) 286 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 287 - clickOnViewWithText(R.string.change_record_actions_hint) 288 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 296 + clickOnViewWithId(recordsR.id.btnRecordAdd) 297 + clickOnViewWithText(coreR.string.change_record_type_field) 298 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 299 + clickOnViewWithText(coreR.string.change_record_actions_hint) 300 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 289 301 290 302 // Running record stopped 291 303 checkViewIsDisplayed( 292 - allOf(withText(name), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 304 + allOf(withText(name), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 293 305 ) 294 306 295 307 // New running record 296 308 NavUtils.openRunningRecordsScreen() 297 309 checkViewIsDisplayed( 298 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 310 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 299 311 ) 300 312 } 301 313 ··· 312 324 NavUtils.openRecordsScreen() 313 325 314 326 // Continue 315 - clickOnViewWithId(R.id.btnRecordAdd) 316 - clickOnViewWithText(R.string.change_record_type_field) 317 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name2)) 318 - clickOnViewWithText(R.string.change_record_actions_hint) 319 - onView(withText(R.string.change_record_continue)).perform(nestedScrollTo(), click()) 327 + clickOnViewWithId(recordsR.id.btnRecordAdd) 328 + clickOnViewWithText(coreR.string.change_record_type_field) 329 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name2)) 330 + clickOnViewWithText(coreR.string.change_record_actions_hint) 331 + onView(withText(coreR.string.change_record_continue)).perform(nestedScrollTo(), click()) 320 332 321 333 // Running record stopped 322 334 checkViewIsDisplayed(allOf(withText(name1), isCompletelyDisplayed())) ··· 324 336 // New running record 325 337 NavUtils.openRunningRecordsScreen() 326 338 checkViewIsDisplayed( 327 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 339 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 328 340 ) 329 341 } 330 342 ··· 338 350 ) { 339 351 checkViewIsDisplayed( 340 352 allOf( 341 - withId(R.id.viewRecordItem), 353 + withId(baseR.id.viewRecordItem), 342 354 withCardColor(firstColor), 343 355 hasDescendant(withText(name)), 344 356 hasDescendant(withTag(firstIcon)), ··· 359 371 ) { 360 372 checkViewIsDisplayed( 361 373 allOf( 362 - withId(R.id.viewRunningRecordItem), 374 + withId(baseR.id.viewRunningRecordItem), 363 375 withCardColor(firstColor), 364 376 hasDescendant(withText(name)), 365 377 hasDescendant(withTag(firstIcon)),
+35 -31
app/src/androidTest/java/com/example/util/simpletimetracker/RecordActionsMergeTest.kt
··· 20 20 import com.example.util.simpletimetracker.utils.nestedScrollTo 21 21 import com.example.util.simpletimetracker.utils.tryAction 22 22 import dagger.hilt.android.testing.HiltAndroidTest 23 + import java.util.Calendar 24 + import java.util.concurrent.TimeUnit 23 25 import kotlinx.coroutines.runBlocking 24 26 import org.hamcrest.CoreMatchers.allOf 25 27 import org.junit.Test 26 28 import org.junit.runner.RunWith 27 - import java.util.Calendar 28 - import java.util.concurrent.TimeUnit 29 + import com.example.util.simpletimetracker.core.R as coreR 30 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 31 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 32 + import com.example.util.simpletimetracker.feature_records.R as recordsR 29 33 30 34 @HiltAndroidTest 31 35 @RunWith(AndroidJUnit4::class) ··· 50 54 // Running record - not shown 51 55 tryAction { 52 56 longClickOnView( 53 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 57 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 54 58 ) 55 59 } 56 - clickOnViewWithText(R.string.change_record_actions_hint) 57 - checkViewIsNotDisplayed(withText(R.string.change_record_merge)) 60 + clickOnViewWithText(coreR.string.change_record_actions_hint) 61 + checkViewIsNotDisplayed(withText(coreR.string.change_record_merge)) 58 62 pressBack() 59 63 60 64 // Record - not shown 61 65 NavUtils.openRecordsScreen() 62 66 clickOnView( 63 - allOf(withId(R.id.viewRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 67 + allOf(withId(baseR.id.viewRecordItem), hasDescendant(withText(name)), isCompletelyDisplayed()) 64 68 ) 65 - clickOnViewWithText(R.string.change_record_actions_hint) 66 - checkViewIsNotDisplayed(withText(R.string.change_record_merge)) 69 + clickOnViewWithText(coreR.string.change_record_actions_hint) 70 + checkViewIsNotDisplayed(withText(coreR.string.change_record_merge)) 67 71 pressBack() 68 72 69 73 // New record - not shown 70 - clickOnViewWithId(R.id.btnRecordAdd) 71 - clickOnViewWithText(R.string.change_record_actions_hint) 72 - checkViewIsNotDisplayed(withText(R.string.change_record_merge)) 74 + clickOnViewWithId(recordsR.id.btnRecordAdd) 75 + clickOnViewWithText(coreR.string.change_record_actions_hint) 76 + checkViewIsNotDisplayed(withText(coreR.string.change_record_merge)) 73 77 pressBack() 74 78 75 79 // Untracked and have prev record - shown 76 - clickOnView(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 77 - clickOnViewWithText(R.string.change_record_actions_hint) 78 - onView(withText(R.string.change_record_merge)).perform(nestedScrollTo()) 79 - checkViewIsDisplayed(withText(R.string.change_record_merge)) 80 + clickOnView(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 81 + clickOnViewWithText(coreR.string.change_record_actions_hint) 82 + onView(withText(coreR.string.change_record_merge)).perform(nestedScrollTo()) 83 + checkViewIsDisplayed(withText(coreR.string.change_record_merge)) 80 84 pressBack() 81 85 82 86 // Untracked and have no prev record - not shown 83 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 87 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 84 88 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 85 - clickOnViewWithId(R.id.btnChangeRecordDelete) 86 - clickOnViewWithId(R.id.btnRecordsContainerNext) 87 - clickOnView(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 88 - clickOnViewWithText(R.string.change_record_actions_hint) 89 - checkViewIsNotDisplayed(withText(R.string.change_record_merge)) 89 + clickOnViewWithId(changeRecordR.id.btnChangeRecordDelete) 90 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 91 + clickOnView(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 92 + clickOnViewWithText(coreR.string.change_record_actions_hint) 93 + checkViewIsNotDisplayed(withText(coreR.string.change_record_merge)) 90 94 } 91 95 92 96 @Test ··· 109 113 tryAction { 110 114 checkViewIsDisplayed( 111 115 allOf( 112 - withId(R.id.viewRecordItem), 113 - hasDescendant(withText(R.string.untracked_time_name)), 116 + withId(baseR.id.viewRecordItem), 117 + hasDescendant(withText(coreR.string.untracked_time_name)), 114 118 hasDescendant(withText(current.formatTime())), 115 119 hasDescendant(withText(timeEndedTimestamp.formatTime())), 116 120 hasDescendant(withText(untrackedRangePreview)), ··· 120 124 } 121 125 checkViewIsDisplayed( 122 126 allOf( 123 - withId(R.id.viewRecordItem), 127 + withId(baseR.id.viewRecordItem), 124 128 hasDescendant(withText(name)), 125 129 hasDescendant(withText(timeStartedTimestamp.formatTime())), 126 130 hasDescendant(withText(timeEndedTimestamp.formatTime())), ··· 132 136 // Merge 133 137 clickOnView( 134 138 allOf( 135 - withId(R.id.viewRecordItem), 136 - hasDescendant(withText(R.string.untracked_time_name)), 139 + withId(baseR.id.viewRecordItem), 140 + hasDescendant(withText(coreR.string.untracked_time_name)), 137 141 hasDescendant(withText(untrackedRangePreview)), 138 142 isCompletelyDisplayed() 139 143 ) 140 144 ) 141 - clickOnViewWithText(R.string.change_record_actions_hint) 142 - onView(withText(R.string.change_record_merge)).perform(nestedScrollTo(), click()) 145 + clickOnViewWithText(coreR.string.change_record_actions_hint) 146 + onView(withText(coreR.string.change_record_merge)).perform(nestedScrollTo(), click()) 143 147 144 148 // Check records 145 149 checkViewDoesNotExist( 146 150 allOf( 147 - withId(R.id.viewRecordItem), 148 - hasDescendant(withText(R.string.untracked_time_name)), 151 + withId(baseR.id.viewRecordItem), 152 + hasDescendant(withText(coreR.string.untracked_time_name)), 149 153 hasDescendant(withText(untrackedRangePreview)), 150 154 isCompletelyDisplayed() 151 155 ) ··· 153 157 timeRangePreview = (current - timeStartedTimestamp).formatInterval() 154 158 checkViewIsDisplayed( 155 159 allOf( 156 - withId(R.id.viewRecordItem), 160 + withId(baseR.id.viewRecordItem), 157 161 hasDescendant(withText(name)), 158 162 hasDescendant(withText(timeStartedTimestamp.formatTime())), 159 163 hasDescendant(withText(current.formatTime())),
+101 -55
app/src/androidTest/java/com/example/util/simpletimetracker/RecordActionsSplitTest.kt
··· 25 25 import com.example.util.simpletimetracker.utils.withCardColor 26 26 import com.example.util.simpletimetracker.utils.withTag 27 27 import dagger.hilt.android.testing.HiltAndroidTest 28 + import java.util.Calendar 29 + import java.util.concurrent.TimeUnit 28 30 import kotlinx.coroutines.runBlocking 29 31 import org.hamcrest.CoreMatchers.allOf 30 32 import org.junit.Test 31 33 import org.junit.runner.RunWith 32 - import java.util.Calendar 33 - import java.util.concurrent.TimeUnit 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 37 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 38 + import com.example.util.simpletimetracker.feature_records.R as recordsR 34 39 35 40 @HiltAndroidTest 36 41 @RunWith(AndroidJUnit4::class) ··· 50 55 // Open record 51 56 NavUtils.openRecordsScreen() 52 57 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 53 - clickOnViewWithText(R.string.change_record_actions_hint) 58 + clickOnViewWithText(coreR.string.change_record_actions_hint) 54 59 55 60 // Check new time set 56 61 val newHour = 16 57 62 val newMinute = 30 58 - clickOnViewWithId(R.id.tvChangeRecordTimeSplit) 63 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeSplit) 59 64 setPickerTime(newHour, newMinute) 60 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 65 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 61 66 var timePreview = calendar.getMillis(newHour, newMinute).formatDateTime() 62 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 67 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 63 68 64 69 // Check time adjust 65 - clickOnView(allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("-5"))) 70 + clickOnView( 71 + allOf(isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), withText("-5")) 72 + ) 66 73 timePreview = calendar.apply { add(Calendar.MINUTE, -5) }.timeInMillis.formatDateTime() 67 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 74 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 68 75 69 - clickOnView(allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("+5"))) 76 + clickOnView( 77 + allOf(isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), withText("+5")) 78 + ) 70 79 timePreview = calendar.apply { add(Calendar.MINUTE, +5) }.timeInMillis.formatDateTime() 71 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 80 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 72 81 } 73 82 74 83 @Test ··· 85 94 // Check record limits 86 95 NavUtils.openRecordsScreen() 87 96 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 88 - clickOnViewWithText(R.string.change_record_actions_hint) 97 + clickOnViewWithText(coreR.string.change_record_actions_hint) 89 98 90 99 repeat(4) { 91 100 clickOnView( 92 - allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("-30")) 101 + allOf( 102 + isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), 103 + withText("-30") 104 + ) 93 105 ) 94 106 } 95 107 var timePreview = timeStartedTimestamp.formatDateTime() 96 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 108 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 97 109 repeat(4) { 98 110 clickOnView( 99 - allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("+30")) 111 + allOf( 112 + isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), 113 + withText("+30") 114 + ) 100 115 ) 101 116 } 102 117 timePreview = timeEndedTimestamp.formatDateTime() 103 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 118 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 104 119 pressBack() 105 120 106 121 // Check running record limits 107 122 timeStartedTimestamp = System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1) 108 123 testUtils.addRunningRecord(typeName = name, timeStarted = timeStartedTimestamp) 109 124 NavUtils.openRunningRecordsScreen() 110 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 111 - clickOnViewWithText(R.string.change_record_actions_hint) 125 + longClickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 126 + clickOnViewWithText(coreR.string.change_record_actions_hint) 112 127 113 128 repeat(4) { 114 129 clickOnView( 115 - allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("-30")) 130 + allOf( 131 + isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), 132 + withText("-30") 133 + ) 116 134 ) 117 135 } 118 136 timePreview = timeStartedTimestamp.formatDateTime() 119 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 137 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 120 138 repeat(4) { 121 139 clickOnView( 122 - allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("+30")) 140 + allOf( 141 + isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), 142 + withText("+30") 143 + ) 123 144 ) 124 145 } 125 146 timePreview = System.currentTimeMillis().formatDateTime() 126 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timePreview))) 147 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timePreview))) 127 148 } 128 149 129 150 @Test ··· 159 180 160 181 // Check time split set to time started 161 182 clickOnViewWithText(fullName) 162 - clickOnViewWithText(R.string.change_record_actions_hint) 183 + clickOnViewWithText(coreR.string.change_record_actions_hint) 163 184 timeStartedPreview = timeStartedTimestamp.formatDateTime() 164 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timeStartedPreview))) 185 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timeStartedPreview))) 165 186 166 187 // Divide 167 - clickOnView(allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("+30"))) 168 - clickOnViewWithText(R.string.change_record_split) 188 + clickOnView( 189 + allOf( 190 + isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), 191 + withText("+30") 192 + ) 193 + ) 194 + clickOnViewWithText(coreR.string.change_record_split) 169 195 170 196 // Check that two records created 171 197 val difference = TimeUnit.MINUTES.toMillis(30) ··· 192 218 NavUtils.openRecordsScreen() 193 219 194 220 // Open untracked time 195 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(2)) 196 - clickOnViewWithText(R.string.untracked_time_name) 221 + onView( 222 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed()) 223 + ).check( 224 + recyclerItemCount(2) 225 + ) 226 + clickOnViewWithText(coreR.string.untracked_time_name) 197 227 198 228 // Split untracked doesn't work 199 - clickOnViewWithText(R.string.change_record_actions_hint) 200 - clickOnViewWithText(R.string.change_record_split) 201 - clickOnViewWithText(R.string.change_record_actions_hint) 229 + clickOnViewWithText(coreR.string.change_record_actions_hint) 230 + clickOnViewWithText(coreR.string.change_record_split) 231 + clickOnViewWithText(coreR.string.change_record_actions_hint) 202 232 203 233 // Select activity 204 - clickOnViewWithText(R.string.change_record_type_field) 205 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 234 + clickOnViewWithText(coreR.string.change_record_type_field) 235 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 206 236 207 237 // Split 208 - clickOnViewWithText(R.string.change_record_actions_hint) 209 - clickOnView(allOf(isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)), withText("+1"))) 210 - clickOnViewWithText(R.string.change_record_split) 238 + clickOnViewWithText(coreR.string.change_record_actions_hint) 239 + clickOnView( 240 + allOf(isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust)), withText("+1")) 241 + ) 242 + clickOnViewWithText(coreR.string.change_record_split) 211 243 212 - checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 213 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(3)) 244 + checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 245 + onView( 246 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed()) 247 + ).check( 248 + recyclerItemCount(3) 249 + ) 214 250 } 215 251 216 252 @Test ··· 222 258 NavUtils.openRecordsScreen() 223 259 224 260 // Open untracked time 225 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(1)) 226 - clickOnViewWithId(R.id.btnRecordAdd) 261 + onView( 262 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed()) 263 + ).check( 264 + recyclerItemCount(1) 265 + ) 266 + clickOnViewWithId(recordsR.id.btnRecordAdd) 227 267 228 268 // Split untracked doesn't work 229 - clickOnViewWithText(R.string.change_record_actions_hint) 230 - clickOnViewWithText(R.string.change_record_split) 231 - clickOnViewWithText(R.string.change_record_actions_hint) 269 + clickOnViewWithText(coreR.string.change_record_actions_hint) 270 + clickOnViewWithText(coreR.string.change_record_split) 271 + clickOnViewWithText(coreR.string.change_record_actions_hint) 232 272 233 273 // Select activity 234 - clickOnViewWithText(R.string.change_record_type_field) 235 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 274 + clickOnViewWithText(coreR.string.change_record_type_field) 275 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 236 276 237 277 // Split 238 - clickOnViewWithText(R.string.change_record_actions_hint) 239 - clickOnViewWithText(R.string.change_record_split) 278 + clickOnViewWithText(coreR.string.change_record_actions_hint) 279 + clickOnViewWithText(coreR.string.change_record_split) 240 280 241 - checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 242 - onView(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())).check(recyclerItemCount(3)) 281 + checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 282 + onView( 283 + allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed()) 284 + ).check( 285 + recyclerItemCount(3) 286 + ) 243 287 } 244 288 245 289 @Test ··· 269 313 longClickOnView(withText(fullName)) 270 314 clickOnViewWithText("-30") 271 315 clickOnViewWithText("-30") 272 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeStartedAdjust)) 316 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeStartedAdjust)) 273 317 274 318 // Check time split set to time started 275 - clickOnViewWithText(R.string.change_record_actions_hint) 319 + clickOnViewWithText(coreR.string.change_record_actions_hint) 276 320 timeStartedPreview = currentTime.formatDateTime() 277 - checkViewIsDisplayed(allOf(withId(R.id.tvChangeRecordTimeSplit), withText(timeStartedPreview))) 321 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.tvChangeRecordTimeSplit), withText(timeStartedPreview))) 278 322 279 323 // Divide 280 - clickOnView(allOf(withText("-30"), isDescendantOfA(withId(R.id.containerChangeRecordTimeSplitAdjust)))) 281 - clickOnViewWithText(R.string.change_record_split) 324 + clickOnView( 325 + allOf(withText("-30"), isDescendantOfA(withId(changeRecordR.id.containerChangeRecordTimeSplitAdjust))) 326 + ) 327 + clickOnViewWithText(coreR.string.change_record_split) 282 328 283 329 // Check that two records created 284 330 val difference = TimeUnit.MINUTES.toMillis(30) ··· 301 347 ) { 302 348 checkViewIsDisplayed( 303 349 allOf( 304 - withId(R.id.viewRecordItem), 350 + withId(baseR.id.viewRecordItem), 305 351 withCardColor(firstColor), 306 352 hasDescendant(withText(name)), 307 353 hasDescendant(withTag(firstIcon)), ··· 322 368 ) { 323 369 checkViewIsDisplayed( 324 370 allOf( 325 - withId(R.id.viewRunningRecordItem), 371 + withId(baseR.id.viewRunningRecordItem), 326 372 withCardColor(firstColor), 327 373 hasDescendant(withText(name)), 328 374 hasDescendant(withTag(firstIcon)),
+27 -24
app/src/androidTest/java/com/example/util/simpletimetracker/RecordAdjustTimeTest.kt
··· 19 19 import com.example.util.simpletimetracker.utils.tryAction 20 20 import com.example.util.simpletimetracker.utils.unconstrainedClickOnView 21 21 import dagger.hilt.android.testing.HiltAndroidTest 22 + import java.util.Calendar 23 + import java.util.concurrent.TimeUnit 22 24 import kotlinx.coroutines.runBlocking 23 25 import org.hamcrest.CoreMatchers.allOf 24 26 import org.junit.Test 25 27 import org.junit.runner.RunWith 26 - import java.util.Calendar 27 - import java.util.concurrent.TimeUnit 28 + import com.example.util.simpletimetracker.core.R as coreR 29 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 30 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 28 31 29 32 @HiltAndroidTest 30 33 @RunWith(AndroidJUnit4::class) ··· 79 82 // Change record 80 83 longClickOnView(allOf(withText(name2), isCompletelyDisplayed())) 81 84 clickOnViewWithText("-30") 82 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeEndedAdjust)) 85 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeEndedAdjust)) 83 86 tryAction { clickOnViewWithText("+30") } 84 87 clickOnViewWithText("+30") 85 - clickOnViewWithText(R.string.change_record_actions_hint) 86 - onView(withText(R.string.change_record_adjust)).perform(nestedScrollTo()) 87 - onView(withId(R.id.containerChangeRecordAction)).perform(swipeUp()) 88 - clickOnViewWithText(R.string.change_record_adjust) 88 + clickOnViewWithText(coreR.string.change_record_actions_hint) 89 + onView(withText(coreR.string.change_record_adjust)).perform(nestedScrollTo()) 90 + onView(withId(changeRecordR.id.containerChangeRecordAction)).perform(swipeUp()) 91 + clickOnViewWithText(coreR.string.change_record_adjust) 89 92 90 93 // Check records 91 94 checkRecord( ··· 143 146 timeEndedPreview = timeEndedTimeStamp2.formatTime(), 144 147 ) 145 148 checkRecord( 146 - name = getString(R.string.untracked_time_name), 149 + name = getString(coreR.string.untracked_time_name), 147 150 timeStartedPreview = timeEndedTimeStamp1.formatTime(), 148 151 timeEndedPreview = timeStartedTimeStamp2.formatTime(), 149 152 ) ··· 156 159 // Change record 157 160 longClickOnView( 158 161 allOf( 159 - withId(R.id.viewRecordItem), 160 - hasDescendant(withText(R.string.untracked_time_name)), 162 + withId(baseR.id.viewRecordItem), 163 + hasDescendant(withText(coreR.string.untracked_time_name)), 161 164 hasDescendant(withText(timeEndedTimeStamp1.formatTime())), 162 165 hasDescendant(withText(timeStartedTimeStamp2.formatTime())), 163 166 isCompletelyDisplayed() ··· 165 168 ) 166 169 clickOnViewWithText("-1") 167 170 clickOnViewWithText("-1") 168 - unconstrainedClickOnView(withId(R.id.btnChangeRecordTimeEndedAdjust)) 171 + unconstrainedClickOnView(withId(changeRecordR.id.btnChangeRecordTimeEndedAdjust)) 169 172 tryAction { clickOnViewWithText("+1") } 170 - clickOnViewWithText(R.string.change_record_type_field) 171 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name2)) 172 - clickOnViewWithText(R.string.change_record_actions_hint) 173 - onView(withText(R.string.change_record_adjust)).perform(nestedScrollTo()) 174 - onView(withId(R.id.containerChangeRecordAction)).perform(swipeUp()) 175 - clickOnViewWithText(R.string.change_record_adjust) 173 + clickOnViewWithText(coreR.string.change_record_type_field) 174 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name2)) 175 + clickOnViewWithText(coreR.string.change_record_actions_hint) 176 + onView(withText(coreR.string.change_record_adjust)).perform(nestedScrollTo()) 177 + onView(withId(changeRecordR.id.containerChangeRecordAction)).perform(swipeUp()) 178 + clickOnViewWithText(coreR.string.change_record_adjust) 176 179 177 180 // Check records 178 181 val newUntrackedTimeStarted = timeEndedTimeStamp1 - TimeUnit.MINUTES.toMillis(2) ··· 231 234 232 235 // Change record 233 236 longClickOnView( 234 - allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name2), isCompletelyDisplayed()) 237 + allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name2), isCompletelyDisplayed()) 235 238 ) 236 239 clickOnViewWithText("-5") 237 - clickOnViewWithText(R.string.change_record_actions_hint) 238 - onView(withText(R.string.change_record_adjust)).perform(nestedScrollTo()) 239 - onView(withId(R.id.containerChangeRecordAction)).perform(swipeUp()) 240 - clickOnViewWithText(R.string.change_record_adjust) 240 + clickOnViewWithText(coreR.string.change_record_actions_hint) 241 + onView(withText(coreR.string.change_record_adjust)).perform(nestedScrollTo()) 242 + onView(withId(changeRecordR.id.containerChangeRecordAction)).perform(swipeUp()) 243 + clickOnViewWithText(coreR.string.change_record_adjust) 241 244 242 245 // Check records 243 246 val newTimeEnded = current - TimeUnit.MINUTES.toMillis(5) ··· 261 264 ) { 262 265 checkViewIsDisplayed( 263 266 allOf( 264 - withId(R.id.viewRecordItem), 267 + withId(baseR.id.viewRecordItem), 265 268 hasDescendant(withText(name)), 266 269 hasDescendant(withText(timeStartedPreview)), 267 270 hasDescendant(withText(timeEndedPreview)), ··· 277 280 ) { 278 281 checkViewIsDisplayed( 279 282 allOf( 280 - withId(R.id.viewRunningRecordItem), 283 + withId(baseR.id.viewRunningRecordItem), 281 284 hasDescendant(withText(name)), 282 285 hasDescendant(withText(timeStartedPreview)), 283 286 isCompletelyDisplayed()
+42 -38
app/src/androidTest/java/com/example/util/simpletimetracker/RecordTypeCategoryTest.kt
··· 15 15 import dagger.hilt.android.testing.HiltAndroidTest 16 16 import org.junit.Test 17 17 import org.junit.runner.RunWith 18 + import com.example.util.simpletimetracker.core.R as coreR 19 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 20 + import com.example.util.simpletimetracker.feature_change_category.R as changeCategoryR 21 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 18 22 19 23 @HiltAndroidTest 20 24 @RunWith(AndroidJUnit4::class) ··· 44 48 NavUtils.openCategoriesScreen() 45 49 46 50 longClickOnView(withText(categoryName1)) 47 - clickOnViewWithText(R.string.change_category_types_hint) 48 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 49 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 51 + clickOnViewWithText(coreR.string.change_category_types_hint) 52 + onView(withText(typeName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 53 + onView(withText(typeName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 50 54 51 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 52 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName2)) 53 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 54 - onView(withText(typeName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 55 - clickOnViewWithText(R.string.change_category_save) 55 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 56 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName2)) 57 + onView(withText(typeName1)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 58 + onView(withText(typeName2)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 59 + clickOnViewWithText(coreR.string.change_category_save) 56 60 57 61 // Check second category 58 62 longClickOnView(withText(categoryName2)) 59 - clickOnViewWithText(R.string.change_category_types_hint) 60 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 61 - onView(withText(typeName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 63 + clickOnViewWithText(coreR.string.change_category_types_hint) 64 + onView(withText(typeName1)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 65 + onView(withText(typeName2)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 62 66 63 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName1)) 64 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName2)) 65 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 66 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 67 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName1)) 68 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName2)) 69 + onView(withText(typeName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 70 + onView(withText(typeName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 67 71 68 - clickOnViewWithText(R.string.change_category_save) 72 + clickOnViewWithText(coreR.string.change_category_save) 69 73 pressBack() 70 74 71 75 // Check first activity 72 76 NavUtils.openRunningRecordsScreen() 73 77 longClickOnView(withText(typeName1)) 74 - clickOnViewWithText(R.string.category_hint) 75 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 76 - onView(withText(categoryName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 78 + clickOnViewWithText(coreR.string.category_hint) 79 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 80 + onView(withText(categoryName2)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 77 81 78 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName1)) 79 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName2)) 80 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 81 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 82 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName1)) 83 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName2)) 84 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 85 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 82 86 83 - clickOnViewWithText(R.string.change_record_type_save) 87 + clickOnViewWithText(coreR.string.change_record_type_save) 84 88 85 89 // Check second activity 86 90 longClickOnView(withText(typeName2)) 87 - clickOnViewWithText(R.string.category_hint) 88 - onView(withText(categoryName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 89 - onView(withText(categoryName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 91 + clickOnViewWithText(coreR.string.category_hint) 92 + onView(withText(categoryName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 93 + onView(withText(categoryName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 90 94 91 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName1)) 92 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName2)) 93 - onView(withText(categoryName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 94 - onView(withText(categoryName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 95 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName1)) 96 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName2)) 97 + onView(withText(categoryName1)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 98 + onView(withText(categoryName2)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 95 99 96 - clickOnViewWithText(R.string.change_record_type_save) 100 + clickOnViewWithText(coreR.string.change_record_type_save) 97 101 98 102 // Check first category again 99 103 NavUtils.openSettingsScreen() 100 104 NavUtils.openCategoriesScreen() 101 105 102 106 longClickOnView(withText(categoryName1)) 103 - clickOnViewWithText(R.string.change_category_types_hint) 104 - onView(withText(typeName1)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 105 - onView(withText(typeName2)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 107 + clickOnViewWithText(coreR.string.change_category_types_hint) 108 + onView(withText(typeName1)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 109 + onView(withText(typeName2)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 106 110 107 111 pressBack() 108 112 109 113 // Check second category 110 114 longClickOnView(withText(categoryName2)) 111 - clickOnViewWithText(R.string.change_category_types_hint) 112 - onView(withText(typeName1)).check(isCompletelyBelow(withId(R.id.viewDividerItem))) 113 - onView(withText(typeName2)).check(isCompletelyAbove(withId(R.id.viewDividerItem))) 115 + clickOnViewWithText(coreR.string.change_category_types_hint) 116 + onView(withText(typeName1)).check(isCompletelyBelow(withId(baseR.id.viewDividerItem))) 117 + onView(withText(typeName2)).check(isCompletelyAbove(withId(baseR.id.viewDividerItem))) 114 118 } 115 119 }
+58 -51
app/src/androidTest/java/com/example/util/simpletimetracker/RecordsAllTest.kt
··· 28 28 import org.hamcrest.CoreMatchers.allOf 29 29 import org.junit.Test 30 30 import org.junit.runner.RunWith 31 + import com.example.util.simpletimetracker.core.R as coreR 32 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 33 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 34 + import com.example.util.simpletimetracker.feature_records.R as recordsR 35 + import com.example.util.simpletimetracker.feature_records_all.R as recordsAllR 36 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 37 + import com.example.util.simpletimetracker.feature_statistics_detail.R as statisticsDetailR 31 38 32 39 @HiltAndroidTest 33 40 @RunWith(AndroidJUnit4::class) ··· 55 62 ) 56 63 57 64 val firstRecord = allOf( 58 - withId(R.id.viewRecordItem), 65 + withId(baseR.id.viewRecordItem), 59 66 hasDescendant(withText(name)), 60 67 hasDescendant(withText("1$hourString 0$minuteString")), 61 68 isCompletelyDisplayed() ··· 65 72 checkViewIsDisplayed(firstRecord) 66 73 67 74 // Add another record 68 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 75 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 69 76 NavUtils.addRecordWithTime( 70 77 name = name, 71 78 hourStarted = 17, ··· 77 84 ) 78 85 79 86 val secondRecord = allOf( 80 - withId(R.id.viewRecordItem), 87 + withId(baseR.id.viewRecordItem), 81 88 hasDescendant(withText(fullName)), 82 89 hasDescendant(withText("2$hourString 0$minuteString")), 83 90 hasDescendant(withText(comment)), ··· 90 97 // Open statistics 91 98 NavUtils.openStatisticsScreen() 92 99 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 93 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 94 - clickOnViewWithText(R.string.range_overall) 100 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 101 + clickOnViewWithText(coreR.string.range_overall) 95 102 96 103 // Open records all 97 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 104 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 98 105 99 106 // Records shown 100 107 checkViewIsDisplayed(firstRecord) ··· 102 109 onView(firstRecord).check(isCompletelyAbove(secondRecord)) 103 110 104 111 // Sort by duration 105 - clickOnViewWithId(R.id.spinnerRecordsAllSort) 106 - clickOnViewWithText(R.string.records_all_sort_duration) 112 + clickOnViewWithId(recordsAllR.id.spinnerRecordsAllSort) 113 + clickOnViewWithText(coreR.string.records_all_sort_duration) 107 114 108 115 // Check new order 109 116 tryAction { onView(secondRecord).check(isCompletelyAbove(firstRecord)) } ··· 127 134 ) 128 135 129 136 val firstRecord = allOf( 130 - withId(R.id.viewRecordItem), 137 + withId(baseR.id.viewRecordItem), 131 138 hasDescendant(withText(name)), 132 139 hasDescendant(withText("1$hourString 0$minuteString")), 133 140 isCompletelyDisplayed() ··· 146 153 ) 147 154 148 155 val secondRecord = allOf( 149 - withId(R.id.viewRecordItem), 156 + withId(baseR.id.viewRecordItem), 150 157 hasDescendant(withText(name)), 151 158 hasDescendant(withText("2$hourString 0$minuteString")), 152 159 isCompletelyDisplayed() ··· 158 165 // Check statistics 159 166 NavUtils.openStatisticsScreen() 160 167 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 161 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 162 - clickOnViewWithText(R.string.range_overall) 163 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 168 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 169 + clickOnViewWithText(coreR.string.range_overall) 170 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 164 171 checkViewIsDisplayed( 165 172 allOf( 166 - withPluralText(R.plurals.statistics_detail_times_tracked, 2), 173 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 2), 167 174 hasSibling(withText("2")) 168 175 ) 169 176 ) 170 177 171 178 // Open records all 172 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 179 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 173 180 174 181 // Records shown 175 182 tryAction { checkViewIsDisplayed(firstRecord) } ··· 177 184 178 185 // Delete item 179 186 clickOnView(firstRecord) 180 - checkViewIsDisplayed(withId(R.id.btnChangeRecordDelete)) 181 - clickOnViewWithId(R.id.btnChangeRecordDelete) 187 + checkViewIsDisplayed(withId(changeRecordR.id.btnChangeRecordDelete)) 188 + clickOnViewWithId(changeRecordR.id.btnChangeRecordDelete) 182 189 183 190 // Check message 184 191 val message = InstrumentationRegistry.getInstrumentation().targetContext 185 - .resources.getString(R.string.record_removed, name) 192 + .resources.getString(coreR.string.record_removed, name) 186 193 checkViewIsDisplayed( 187 194 allOf( 188 195 withText(message), ··· 196 203 197 204 // Check detailed statistics 198 205 pressBack() 199 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 206 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 200 207 checkViewIsDisplayed( 201 208 allOf( 202 - withPluralText(R.plurals.statistics_detail_times_tracked, 1), 209 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 1), 203 210 hasSibling(withText("1")) 204 211 ) 205 212 ) ··· 237 244 ) 238 245 239 246 val firstRecord = allOf( 240 - withId(R.id.viewRecordItem), 247 + withId(baseR.id.viewRecordItem), 241 248 hasDescendant(withText(typeName1)), 242 249 hasDescendant(withText("1$hourString 0$minuteString")), 243 250 isCompletelyDisplayed() ··· 247 254 tryAction { checkViewIsDisplayed(firstRecord) } 248 255 249 256 // Add another record 250 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 257 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 251 258 NavUtils.addRecordWithTime( 252 259 name = typeName2, 253 260 hourStarted = 17, ··· 257 264 ) 258 265 259 266 val secondRecord = allOf( 260 - withId(R.id.viewRecordItem), 267 + withId(baseR.id.viewRecordItem), 261 268 hasDescendant(withText(typeName2)), 262 269 hasDescendant(withText("2$hourString 0$minuteString")), 263 270 isCompletelyDisplayed() ··· 268 275 269 276 // Open statistics 270 277 NavUtils.openStatisticsScreen() 271 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 272 - clickOnViewWithText(R.string.category_hint) 278 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 279 + clickOnViewWithText(coreR.string.category_hint) 273 280 pressBack() 274 281 tryAction { clickOnView(allOf(withText(categoryName1), isCompletelyDisplayed())) } 275 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 276 - clickOnViewWithText(R.string.range_overall) 282 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 283 + clickOnViewWithText(coreR.string.range_overall) 277 284 278 285 // Open records all 279 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 286 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 280 287 281 288 // Records shown 282 289 tryAction { checkViewIsDisplayed(firstRecord) } ··· 284 291 onView(firstRecord).check(isCompletelyAbove(secondRecord)) 285 292 286 293 // Sort by duration 287 - clickOnViewWithId(R.id.spinnerRecordsAllSort) 288 - clickOnViewWithText(R.string.records_all_sort_duration) 294 + clickOnViewWithId(recordsAllR.id.spinnerRecordsAllSort) 295 + clickOnViewWithText(coreR.string.records_all_sort_duration) 289 296 290 297 // Check new order 291 298 tryAction { onView(secondRecord).check(isCompletelyAbove(firstRecord)) } ··· 311 318 // Open records all 312 319 NavUtils.openStatisticsScreen() 313 320 clickOnView(allOf(withText(name1), isCompletelyDisplayed())) 314 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 315 - clickOnViewWithText(R.string.range_overall) 316 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 321 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 322 + clickOnViewWithText(coreR.string.range_overall) 323 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 317 324 318 325 // Check records 319 326 val record1 = allOf(withText(name1), isCompletelyDisplayed()) ··· 326 333 327 334 // Change filter 328 335 pressBack() 329 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 330 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 331 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 332 - checkViewIsDisplayed(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name3))) 333 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 336 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 337 + checkViewIsDisplayed(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 338 + checkViewIsDisplayed(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 339 + checkViewIsDisplayed(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name3))) 340 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 334 341 pressBack() 335 342 336 343 // Check records 337 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 344 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 338 345 checkViewIsDisplayed(record1) 339 346 checkViewIsDisplayed(record2) 340 347 checkViewDoesNotExist(record3) 341 348 342 349 // Change filter 343 350 pressBack() 344 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 345 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 346 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 351 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 352 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 353 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 347 354 pressBack() 348 355 349 356 // Check records 350 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 357 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 351 358 checkViewDoesNotExist(record1) 352 359 checkViewDoesNotExist(record2) 353 360 checkViewDoesNotExist(record3) 354 - checkViewIsDisplayed(withText(R.string.records_empty)) 361 + checkViewIsDisplayed(withText(coreR.string.records_empty)) 355 362 356 363 // Show all 357 364 pressBack() 358 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 359 - clickOnViewWithId(R.id.btnTypesFilterShowAll) 365 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 366 + // clickOnViewWithId(R.id.btnTypesFilterShowAll) 360 367 pressBack() 361 368 362 369 // Check records 363 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 370 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 364 371 checkViewIsDisplayed(record1) 365 372 checkViewIsDisplayed(record2) 366 373 checkViewIsDisplayed(record3) 367 374 368 375 // Hide all 369 376 pressBack() 370 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 371 - clickOnViewWithId(R.id.btnTypesFilterHideAll) 377 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 378 + // clickOnViewWithId(R.id.btnTypesFilterHideAll) 372 379 pressBack() 373 380 374 381 // Check records 375 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 382 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 376 383 checkViewDoesNotExist(record1) 377 384 checkViewDoesNotExist(record2) 378 385 checkViewDoesNotExist(record3) 379 - checkViewIsDisplayed(withText(R.string.records_empty)) 386 + checkViewIsDisplayed(withText(coreR.string.records_empty)) 380 387 } 381 388 }
+29 -25
app/src/androidTest/java/com/example/util/simpletimetracker/RecordsRangesTest.kt
··· 18 18 import com.example.util.simpletimetracker.utils.clickOnViewWithText 19 19 import com.example.util.simpletimetracker.utils.longClickOnViewWithId 20 20 import dagger.hilt.android.testing.HiltAndroidTest 21 + import java.text.SimpleDateFormat 22 + import java.util.Calendar 23 + import java.util.Locale 21 24 import kotlinx.coroutines.runBlocking 22 25 import org.hamcrest.CoreMatchers.allOf 23 26 import org.hamcrest.CoreMatchers.equalTo 24 27 import org.junit.Test 25 28 import org.junit.runner.RunWith 26 - import java.text.SimpleDateFormat 27 - import java.util.Calendar 28 - import java.util.Locale 29 + import com.example.util.simpletimetracker.core.R as coreR 30 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 31 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 32 + import com.example.util.simpletimetracker.feature_records.R as recordsR 29 33 30 34 @HiltAndroidTest 31 35 @RunWith(AndroidJUnit4::class) ··· 42 46 43 47 // Start timer 44 48 clickOnViewWithText(name) 45 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 49 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 46 50 47 51 // Records 48 52 NavUtils.openRecordsScreen() 49 53 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 50 54 51 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 55 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 52 56 checkViewIsDisplayed( 53 57 allOf( 54 - withId(R.id.viewRecordItem), 55 - hasDescendant(withText(R.string.untracked_time_name)), 58 + withId(baseR.id.viewRecordItem), 59 + hasDescendant(withText(coreR.string.untracked_time_name)), 56 60 isCompletelyDisplayed() 57 61 ) 58 62 ) 59 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 63 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 60 64 checkViewIsDisplayed( 61 65 allOf( 62 - withId(R.id.viewRecordItem), 63 - hasDescendant(withText(R.string.untracked_time_name)), 66 + withId(baseR.id.viewRecordItem), 67 + hasDescendant(withText(coreR.string.untracked_time_name)), 64 68 isCompletelyDisplayed() 65 69 ) 66 70 ) 67 71 68 - longClickOnViewWithId(R.id.btnRecordsContainerToday) 72 + longClickOnViewWithId(recordsR.id.btnRecordsContainerToday) 69 73 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 70 74 71 - clickOnViewWithId(R.id.btnRecordsContainerNext) 72 - checkViewIsDisplayed(allOf(withText(R.string.records_empty), isCompletelyDisplayed())) 73 - clickOnViewWithId(R.id.btnRecordsContainerNext) 74 - checkViewIsDisplayed(allOf(withText(R.string.records_empty), isCompletelyDisplayed())) 75 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 76 + checkViewIsDisplayed(allOf(withText(coreR.string.records_empty), isCompletelyDisplayed())) 77 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 78 + checkViewIsDisplayed(allOf(withText(coreR.string.records_empty), isCompletelyDisplayed())) 75 79 } 76 80 77 81 @Test ··· 86 90 } 87 91 88 92 // Check yesterday 89 - clickOnViewWithId(R.id.btnRecordsContainerToday) 93 + clickOnViewWithId(recordsR.id.btnRecordsContainerToday) 90 94 onView(withClassName(equalTo(DatePicker::class.java.name))) 91 95 .perform( 92 96 setDate( ··· 95 99 calendarPrev.get(Calendar.DAY_OF_MONTH) 96 100 ) 97 101 ) 98 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 102 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 99 103 100 - checkViewIsDisplayed(allOf(withText(R.string.title_yesterday), isCompletelyDisplayed())) 104 + checkViewIsDisplayed(allOf(withText(coreR.string.title_yesterday), isCompletelyDisplayed())) 101 105 102 106 // Check tomorrow 103 - clickOnViewWithId(R.id.btnRecordsContainerToday) 107 + clickOnViewWithId(recordsR.id.btnRecordsContainerToday) 104 108 onView(withClassName(equalTo(DatePicker::class.java.name))) 105 109 .perform( 106 110 setDate( ··· 109 113 calendarNext.get(Calendar.DAY_OF_MONTH) 110 114 ) 111 115 ) 112 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 116 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 113 117 114 - checkViewIsDisplayed(allOf(withText(R.string.title_tomorrow), isCompletelyDisplayed())) 118 + checkViewIsDisplayed(allOf(withText(coreR.string.title_tomorrow), isCompletelyDisplayed())) 115 119 } 116 120 117 121 @Test ··· 132 136 val titleNext = dayTitleFormat.format(calendarNext.timeInMillis) 133 137 134 138 // Check prev date 135 - clickOnViewWithId(R.id.btnRecordsContainerToday) 139 + clickOnViewWithId(recordsR.id.btnRecordsContainerToday) 136 140 onView(withClassName(equalTo(DatePicker::class.java.name))) 137 141 .perform( 138 142 setDate( ··· 141 145 calendarPrev.get(Calendar.DAY_OF_MONTH) 142 146 ) 143 147 ) 144 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 148 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 145 149 146 150 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 147 151 148 152 // Check next date 149 - clickOnViewWithId(R.id.btnRecordsContainerToday) 153 + clickOnViewWithId(recordsR.id.btnRecordsContainerToday) 150 154 onView(withClassName(equalTo(DatePicker::class.java.name))) 151 155 .perform( 152 156 setDate( ··· 155 159 calendarNext.get(Calendar.DAY_OF_MONTH) 156 160 ) 157 161 ) 158 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 162 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 159 163 160 164 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 161 165 }
+25 -21
app/src/androidTest/java/com/example/util/simpletimetracker/SettingsCardOrder.kt
··· 31 31 import org.hamcrest.Matcher 32 32 import org.junit.Test 33 33 import org.junit.runner.RunWith 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_running_records.R as runningRecordsR 37 + import com.example.util.simpletimetracker.feature_settings.R as settingsR 34 38 35 39 @HiltAndroidTest 36 40 @RunWith(AndroidJUnit4::class) ··· 84 88 Thread.sleep(1000) 85 89 checkOrder(name1, name2, ::isCompletelyAbove) 86 90 checkOrder(name2, name3, ::isCompletelyAbove) 87 - clickOnViewWithText(R.string.card_size_default) 91 + clickOnViewWithText(coreR.string.card_size_default) 88 92 89 93 // Check order 90 94 checkOrder(name1, name2, ::isCompletelyLeftOf) ··· 112 116 // Check settings 113 117 NavUtils.openSettingsScreen() 114 118 NavUtils.openSettingsDisplay() 115 - onView(withId(R.id.spinnerSettingsRecordTypeSort)).perform(nestedScrollTo()) 119 + onView(withId(settingsR.id.spinnerSettingsRecordTypeSort)).perform(nestedScrollTo()) 116 120 checkViewIsDisplayed( 117 - allOf(withId(R.id.tvSettingsRecordTypeSortValue), withText(R.string.settings_sort_by_name)) 121 + allOf(withId(settingsR.id.tvSettingsRecordTypeSortValue), withText(coreR.string.settings_sort_by_name)) 118 122 ) 119 123 } 120 124 ··· 160 164 clickOnViewWithText("1") 161 165 pressBack() 162 166 163 - clickOnSpinnerWithId(R.id.spinnerSettingsRecordTypeSort) 164 - clickOnViewWithText(R.string.settings_sort_by_color) 167 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsRecordTypeSort) 168 + clickOnViewWithText(coreR.string.settings_sort_by_color) 165 169 checkViewIsDisplayed( 166 - allOf(withId(R.id.tvSettingsRecordTypeSortValue), withText(R.string.settings_sort_by_color)) 170 + allOf(withId(settingsR.id.tvSettingsRecordTypeSortValue), withText(coreR.string.settings_sort_by_color)) 167 171 ) 168 172 169 173 // Check new order ··· 178 182 try { 179 183 checkOrder(previousItem, currentItem, ::isCompletelyAbove) 180 184 } catch (e: Throwable) { 181 - onView(withId(R.id.rvRunningRecordsList)).perform(slowHalfSwipe()) 185 + onView(withId(runningRecordsR.id.rvRunningRecordsList)).perform(slowHalfSwipe()) 182 186 tryAction { checkOrder(previousItem, currentItem, ::isCompletelyAbove) } 183 187 } 184 188 } ··· 198 202 // Change settings 199 203 NavUtils.openSettingsScreen() 200 204 NavUtils.openSettingsDisplay() 201 - clickOnSpinnerWithId(R.id.spinnerSettingsRecordTypeSort) 202 - clickOnViewWithText(R.string.settings_sort_manually) 205 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsRecordTypeSort) 206 + clickOnViewWithText(coreR.string.settings_sort_manually) 203 207 Thread.sleep(1000) 204 208 205 209 // Check old order ··· 207 211 checkOrder(name2, name3, ::isCompletelyLeftOf) 208 212 209 213 // Drag 210 - onView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 214 + onView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 211 215 .perform(drag(Direction.LEFT, 300)) 212 216 213 217 // Check new order 214 218 pressBack() 215 219 checkViewIsDisplayed( 216 - allOf(withId(R.id.tvSettingsRecordTypeSortValue), withText(R.string.settings_sort_manually)) 220 + allOf(withId(settingsR.id.tvSettingsRecordTypeSortValue), withText(coreR.string.settings_sort_manually)) 217 221 ) 218 222 NavUtils.openRunningRecordsScreen() 219 223 checkOrder(name2, name1, ::isCompletelyLeftOf) ··· 221 225 222 226 // Change order 223 227 NavUtils.openSettingsScreen() 224 - onView(withId(R.id.btnCardOrderManual)).perform(nestedScrollTo()) 225 - clickOnViewWithId(R.id.btnCardOrderManual) 228 + onView(withId(settingsR.id.btnCardOrderManual)).perform(nestedScrollTo()) 229 + clickOnViewWithId(settingsR.id.btnCardOrderManual) 226 230 checkOrder(name2, name1, ::isCompletelyLeftOf) 227 231 checkOrder(name1, name3, ::isCompletelyLeftOf) 228 - onView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 232 + onView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 229 233 .perform(drag(Direction.RIGHT, 300)) 230 234 231 235 // Check new order ··· 251 255 NavUtils.openCardSizeScreen() 252 256 tryAction { clickOnViewWithText("4") } 253 257 pressBack() 254 - clickOnSpinnerWithId(R.id.spinnerSettingsRecordTypeSort) 255 - clickOnViewWithText(R.string.settings_sort_by_color) 256 - clickOnSpinnerWithId(R.id.spinnerSettingsRecordTypeSort) 257 - clickOnViewWithText(R.string.settings_sort_manually) 258 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsRecordTypeSort) 259 + clickOnViewWithText(coreR.string.settings_sort_by_color) 260 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsRecordTypeSort) 261 + clickOnViewWithText(coreR.string.settings_sort_manually) 258 262 Thread.sleep(1000) 259 263 260 264 val resources = InstrumentationRegistry.getInstrumentation().targetContext.resources ··· 263 267 264 268 // Drag 265 269 (1..cardsCount).forEach { 266 - onView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText("$name$it"))) 270 + onView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText("$name$it"))) 267 271 .perform( 268 272 drag(Direction.RIGHT, screenWidth), 269 273 drag(Direction.DOWN, screenHeight), ··· 281 285 282 286 private fun checkOrder(first: String, second: String, vararg matchers: (Matcher<View>) -> ViewAssertion) { 283 287 matchers.forEach { matcher -> 284 - onView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(first))).check( 285 - matcher(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(second))) 288 + onView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(first))).check( 289 + matcher(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(second))) 286 290 ) 287 291 } 288 292 }
+488 -470
app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt
··· 39 39 import com.example.util.simpletimetracker.utils.unconstrainedClickOnView 40 40 import com.example.util.simpletimetracker.utils.withPluralText 41 41 import dagger.hilt.android.testing.HiltAndroidTest 42 + import java.util.Calendar 43 + import java.util.concurrent.TimeUnit 42 44 import kotlinx.coroutines.runBlocking 43 45 import org.hamcrest.CoreMatchers.allOf 44 46 import org.hamcrest.CoreMatchers.equalTo 45 47 import org.junit.Test 46 48 import org.junit.runner.RunWith 47 - import java.util.Calendar 48 - import java.util.concurrent.TimeUnit 49 + import com.example.util.simpletimetracker.core.R as coreR 50 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 51 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 52 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 53 + import com.example.util.simpletimetracker.feature_records.R as recordsR 54 + import com.example.util.simpletimetracker.feature_settings.R as settingsR 55 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 56 + import com.example.util.simpletimetracker.feature_statistics_detail.R as statisticsDetailR 49 57 50 58 @HiltAndroidTest 51 59 @RunWith(AndroidJUnit4::class) ··· 63 71 // Untracked is not shown 64 72 NavUtils.openRecordsScreen() 65 73 checkViewDoesNotExist( 66 - allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed()) 74 + allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed()) 67 75 ) 68 76 69 77 // Change setting 70 78 NavUtils.openSettingsScreen() 71 79 NavUtils.openSettingsDisplay() 72 - onView(withId(R.id.checkboxSettingsShowUntracked)).perform(nestedScrollTo()) 73 - onView(withId(R.id.checkboxSettingsShowUntracked)).check(matches(isNotChecked())) 74 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowUntracked)) 75 - onView(withId(R.id.checkboxSettingsShowUntracked)).check(matches(isChecked())) 80 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).perform(nestedScrollTo()) 81 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).check(matches(isNotChecked())) 82 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowUntracked)) 83 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).check(matches(isChecked())) 76 84 77 85 // Untracked is shown 78 86 NavUtils.openRecordsScreen() 79 - checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 87 + checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 80 88 81 89 // Add record 82 90 NavUtils.addRecord(name) 83 - checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 91 + checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 84 92 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 85 93 86 94 // Change setting 87 95 NavUtils.openSettingsScreen() 88 - onView(withId(R.id.checkboxSettingsShowUntracked)).perform(nestedScrollTo()) 89 - onView(withId(R.id.checkboxSettingsShowUntracked)).check(matches(isChecked())) 90 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowUntracked)) 91 - onView(withId(R.id.checkboxSettingsShowUntracked)).check(matches(isNotChecked())) 96 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).perform(nestedScrollTo()) 97 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).check(matches(isChecked())) 98 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowUntracked)) 99 + onView(withId(settingsR.id.checkboxSettingsShowUntracked)).check(matches(isNotChecked())) 92 100 93 101 // Untracked is not shown 94 102 NavUtils.openRecordsScreen() 95 103 checkViewDoesNotExist( 96 - allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed()) 104 + allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed()) 97 105 ) 98 106 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 99 107 } ··· 114 122 // Start timers 115 123 tryAction { clickOnViewWithText(name2) } 116 124 clickOnViewWithText(name3) 117 - tryAction { checkViewIsDisplayed(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)))) } 118 - checkViewIsDisplayed(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name3)))) 125 + tryAction { 126 + checkViewIsDisplayed(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name2)))) 127 + } 128 + checkViewIsDisplayed(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name3)))) 119 129 120 130 // Click on already running 121 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 131 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 122 132 NavUtils.openRecordsScreen() 123 133 checkViewDoesNotExist( 124 - allOf(withText(name1), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 134 + allOf(withText(name1), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 125 135 ) 126 136 checkViewDoesNotExist( 127 - allOf(withText(name2), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 137 + allOf(withText(name2), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 128 138 ) 129 139 checkViewDoesNotExist( 130 - allOf(withText(name3), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 140 + allOf(withText(name3), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 131 141 ) 132 142 133 143 // Change setting 134 144 NavUtils.openSettingsScreen() 135 - onView(withId(R.id.checkboxSettingsAllowMultitasking)).perform(nestedScrollTo()) 136 - tryAction { onView(withId(R.id.checkboxSettingsAllowMultitasking)).check(matches(isChecked())) } 137 - unconstrainedClickOnView(withId(R.id.checkboxSettingsAllowMultitasking)) 138 - onView(withId(R.id.checkboxSettingsAllowMultitasking)).check(matches(isNotChecked())) 145 + onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).perform(nestedScrollTo()) 146 + tryAction { onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).check(matches(isChecked())) } 147 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsAllowMultitasking)) 148 + onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).check(matches(isNotChecked())) 139 149 140 150 // Click on one not running 141 151 NavUtils.openRunningRecordsScreen() 142 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 152 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 143 153 tryAction { 144 154 checkViewIsDisplayed( 145 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name1)), isCompletelyDisplayed()) 155 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name1)), isCompletelyDisplayed()) 146 156 ) 147 157 } 148 158 checkViewDoesNotExist( 149 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 159 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 150 160 ) 151 161 checkViewDoesNotExist( 152 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name3)), isCompletelyDisplayed()) 162 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name3)), isCompletelyDisplayed()) 153 163 ) 154 164 155 165 // Records added 156 166 NavUtils.openRecordsScreen() 157 167 checkViewIsDisplayed( 158 - allOf(withText(name2), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 168 + allOf(withText(name2), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 159 169 ) 160 170 checkViewIsDisplayed( 161 - allOf(withText(name3), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 171 + allOf(withText(name3), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 162 172 ) 163 173 164 174 // Click another 165 175 NavUtils.openRunningRecordsScreen() 166 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 176 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 167 177 tryAction { 168 178 checkViewIsDisplayed( 169 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 179 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 170 180 ) 171 181 } 172 182 checkViewDoesNotExist( 173 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name1)), isCompletelyDisplayed()) 183 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name1)), isCompletelyDisplayed()) 174 184 ) 175 185 176 186 // Record added 177 187 NavUtils.openRecordsScreen() 178 188 checkViewIsDisplayed( 179 - allOf(withText(name1), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 189 + allOf(withText(name1), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 180 190 ) 181 191 182 192 // Change setting back 183 193 NavUtils.openSettingsScreen() 184 - onView(withId(R.id.checkboxSettingsAllowMultitasking)).perform(nestedScrollTo()) 185 - onView(withId(R.id.checkboxSettingsAllowMultitasking)).check(matches(isNotChecked())) 186 - unconstrainedClickOnView(withId(R.id.checkboxSettingsAllowMultitasking)) 187 - onView(withId(R.id.checkboxSettingsAllowMultitasking)).check(matches(isChecked())) 194 + onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).perform(nestedScrollTo()) 195 + onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).check(matches(isNotChecked())) 196 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsAllowMultitasking)) 197 + onView(withId(settingsR.id.checkboxSettingsAllowMultitasking)).check(matches(isChecked())) 188 198 189 199 // Start another timer 190 200 NavUtils.openRunningRecordsScreen() 191 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name3))) 201 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name3))) 192 202 tryAction { 193 203 checkViewIsDisplayed( 194 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 204 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name2)), isCompletelyDisplayed()) 195 205 ) 196 206 } 197 207 checkViewIsDisplayed( 198 - allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name3)), isCompletelyDisplayed()) 208 + allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name3)), isCompletelyDisplayed()) 199 209 ) 200 210 201 211 // No new records added 202 212 NavUtils.openRecordsScreen() 203 213 checkViewIsDisplayed( 204 - allOf(withText(name1), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 214 + allOf(withText(name1), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 205 215 ) 206 216 checkViewIsDisplayed( 207 - allOf(withText(name2), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 217 + allOf(withText(name2), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 208 218 ) 209 219 checkViewIsDisplayed( 210 - allOf(withText(name3), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed()) 220 + allOf(withText(name3), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed()) 211 221 ) 212 222 } 213 223 ··· 226 236 // Change settings 227 237 NavUtils.openSettingsScreen() 228 238 NavUtils.openSettingsNotifications() 229 - onView(withId(R.id.checkboxSettingsShowNotifications)).perform(nestedScrollTo()) 230 - onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 231 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowNotifications)) 232 - onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 239 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).perform(nestedScrollTo()) 240 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 241 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowNotifications)) 242 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 233 243 234 244 // Stop first timer 235 245 NavUtils.openRunningRecordsScreen() 236 - clickOnView(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name1)))) 246 + clickOnView(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name1)))) 237 247 238 248 // Start another timer 239 249 clickOnViewWithText(name2) 240 250 241 251 // Change settings 242 252 NavUtils.openSettingsScreen() 243 - onView(withId(R.id.checkboxSettingsShowNotifications)).perform(nestedScrollTo()) 244 - onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 245 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowNotifications)) 246 - onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 253 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).perform(nestedScrollTo()) 254 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 255 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowNotifications)) 256 + onView(withId(settingsR.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 247 257 } 248 258 249 259 @Test ··· 264 274 265 275 // Change settings 266 276 NavUtils.openSettingsScreen() 267 - onView(withId(R.id.checkboxSettingsDarkMode)).perform(nestedScrollTo()) 268 - onView(withId(R.id.checkboxSettingsDarkMode)).check(matches(isNotChecked())) 269 - unconstrainedClickOnView(withId(R.id.checkboxSettingsDarkMode)) 270 - onView(withId(R.id.checkboxSettingsDarkMode)).check(matches(isChecked())) 277 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).perform(nestedScrollTo()) 278 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).check(matches(isNotChecked())) 279 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsDarkMode)) 280 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).check(matches(isChecked())) 271 281 272 282 // Check screens 273 283 NavUtils.openRunningRecordsScreen() ··· 276 286 277 287 // Change settings 278 288 NavUtils.openSettingsScreen() 279 - onView(withId(R.id.checkboxSettingsDarkMode)).perform(nestedScrollTo()) 280 - onView(withId(R.id.checkboxSettingsDarkMode)).check(matches(isChecked())) 281 - unconstrainedClickOnView(withId(R.id.checkboxSettingsDarkMode)) 282 - onView(withId(R.id.checkboxSettingsDarkMode)).check(matches(isNotChecked())) 289 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).perform(nestedScrollTo()) 290 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).check(matches(isChecked())) 291 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsDarkMode)) 292 + onView(withId(settingsR.id.checkboxSettingsDarkMode)).check(matches(isNotChecked())) 283 293 284 294 // Check screens 285 295 NavUtils.openRunningRecordsScreen() ··· 293 303 // Change settings 294 304 NavUtils.openSettingsScreen() 295 305 NavUtils.openSettingsNotifications() 296 - onView(withId(R.id.groupSettingsInactivityReminder)).perform(nestedScrollTo()) 306 + onView(withId(settingsR.id.groupSettingsInactivityReminder)).perform(nestedScrollTo()) 297 307 checkViewIsDisplayed( 298 308 allOf( 299 - withId(R.id.tvSettingsInactivityReminderTime), 300 - withText(R.string.settings_inactivity_reminder_disabled) 309 + withId(settingsR.id.tvSettingsInactivityReminderTime), 310 + withText(coreR.string.settings_inactivity_reminder_disabled) 301 311 ) 302 312 ) 303 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 313 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 304 314 305 315 // 1s 306 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 307 - clickOnViewWithId(R.id.tvNumberKeyboard1) 308 - clickOnViewWithText(R.string.duration_dialog_save) 316 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 317 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 318 + clickOnViewWithText(coreR.string.duration_dialog_save) 309 319 checkViewIsDisplayed(withText("1$secondString")) 310 320 311 321 // Check recurrent 312 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 313 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 314 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).check(matches(isNotChecked())) 315 - unconstrainedClickOnView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 316 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).check(matches(isChecked())) 322 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 323 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 324 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).check(matches(isNotChecked())) 325 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 326 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).check(matches(isChecked())) 317 327 318 328 // 1m 319 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 320 - clickOnViewWithId(R.id.tvNumberKeyboard0) 321 - clickOnViewWithId(R.id.tvNumberKeyboard0) 322 - clickOnViewWithText(R.string.duration_dialog_save) 329 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 330 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 331 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 332 + clickOnViewWithText(coreR.string.duration_dialog_save) 323 333 checkViewIsDisplayed(withText("1$minuteString")) 324 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 325 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 334 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 335 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 326 336 327 337 // 1h 328 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 329 - clickOnViewWithId(R.id.tvNumberKeyboard0) 330 - clickOnViewWithId(R.id.tvNumberKeyboard0) 331 - clickOnViewWithText(R.string.duration_dialog_save) 338 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 339 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 340 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 341 + clickOnViewWithText(coreR.string.duration_dialog_save) 332 342 checkViewIsDisplayed(withText("1$hourString")) 333 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 334 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 343 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 344 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 335 345 336 346 // 1m 1s 337 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 338 - clickOnViewWithId(R.id.ivDurationPickerDelete) 339 - clickOnViewWithId(R.id.ivDurationPickerDelete) 340 - clickOnViewWithId(R.id.ivDurationPickerDelete) 341 - clickOnViewWithId(R.id.tvNumberKeyboard1) 342 - clickOnViewWithText(R.string.duration_dialog_save) 347 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 348 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 349 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 350 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 351 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 352 + clickOnViewWithText(coreR.string.duration_dialog_save) 343 353 checkViewIsDisplayed(withText("1$minuteString 01$secondString")) 344 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 345 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 354 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 355 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 346 356 347 357 // 1h 1m 1s 348 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 349 - clickOnViewWithId(R.id.tvNumberKeyboard0) 350 - clickOnViewWithId(R.id.tvNumberKeyboard1) 351 - clickOnViewWithText(R.string.duration_dialog_save) 358 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 359 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 360 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 361 + clickOnViewWithText(coreR.string.duration_dialog_save) 352 362 checkViewIsDisplayed(withText("1$hourString 01$minuteString 01$secondString")) 353 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 354 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 363 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 364 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 355 365 356 366 // 1h 30m 357 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 367 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 358 368 clearDuration() 359 - clickOnViewWithId(R.id.tvNumberKeyboard9) 360 - clickOnViewWithId(R.id.tvNumberKeyboard0) 361 - clickOnViewWithId(R.id.tvNumberKeyboard0) 362 - clickOnViewWithId(R.id.tvNumberKeyboard0) 363 - clickOnViewWithText(R.string.duration_dialog_save) 369 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard9) 370 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 371 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 372 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 373 + clickOnViewWithText(coreR.string.duration_dialog_save) 364 374 checkViewIsDisplayed(withText("1$hourString 30$minuteString")) 365 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 366 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 375 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 376 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 367 377 368 378 // 99h 99m 99s 369 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 370 - repeat(10) { clickOnViewWithId(R.id.ivDurationPickerDelete) } 371 - repeat(6) { clickOnViewWithId(R.id.tvNumberKeyboard9) } 372 - clickOnViewWithText(R.string.duration_dialog_save) 379 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 380 + repeat(10) { clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) } 381 + repeat(6) { clickOnViewWithId(dialogsR.id.tvNumberKeyboard9) } 382 + clickOnViewWithText(coreR.string.duration_dialog_save) 373 383 checkViewIsDisplayed(withText("100$hourString 40$minuteString 39$secondString")) 374 - onView(withId(R.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 375 - checkViewIsDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 384 + onView(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)).perform(nestedScrollTo()) 385 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 376 386 377 387 // Disable 378 - clickOnViewWithId(R.id.groupSettingsInactivityReminder) 379 - clickOnViewWithText(R.string.duration_dialog_disable) 388 + clickOnViewWithId(settingsR.id.groupSettingsInactivityReminder) 389 + clickOnViewWithText(coreR.string.duration_dialog_disable) 380 390 checkViewIsDisplayed( 381 391 allOf( 382 - withId(R.id.tvSettingsInactivityReminderTime), 383 - withText(R.string.settings_inactivity_reminder_disabled) 392 + withId(settingsR.id.tvSettingsInactivityReminderTime), 393 + withText(coreR.string.settings_inactivity_reminder_disabled) 384 394 ) 385 395 ) 386 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsInactivityReminderRecurrent)) 396 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsInactivityReminderRecurrent)) 387 397 } 388 398 389 399 @Test ··· 391 401 // Change settings 392 402 NavUtils.openSettingsScreen() 393 403 NavUtils.openSettingsNotifications() 394 - onView(withId(R.id.groupSettingsActivityReminder)).perform(nestedScrollTo()) 404 + onView(withId(settingsR.id.groupSettingsActivityReminder)).perform(nestedScrollTo()) 395 405 checkViewIsDisplayed( 396 406 allOf( 397 - withId(R.id.tvSettingsActivityReminderTime), 398 - withText(R.string.settings_inactivity_reminder_disabled) 407 + withId(settingsR.id.tvSettingsActivityReminderTime), 408 + withText(coreR.string.settings_inactivity_reminder_disabled) 399 409 ) 400 410 ) 401 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 411 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 402 412 403 413 // 1s 404 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 405 - clickOnViewWithId(R.id.tvNumberKeyboard1) 406 - clickOnViewWithText(R.string.duration_dialog_save) 414 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 415 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 416 + clickOnViewWithText(coreR.string.duration_dialog_save) 407 417 checkViewIsDisplayed(withText("1$secondString")) 408 418 409 419 // Check recurrent 410 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 411 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 412 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).check(matches(isNotChecked())) 413 - unconstrainedClickOnView(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 414 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).check(matches(isChecked())) 420 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 421 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 422 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).check(matches(isNotChecked())) 423 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 424 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).check(matches(isChecked())) 415 425 416 426 // 1m 417 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 418 - clickOnViewWithId(R.id.tvNumberKeyboard0) 419 - clickOnViewWithId(R.id.tvNumberKeyboard0) 420 - clickOnViewWithText(R.string.duration_dialog_save) 427 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 428 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 429 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 430 + clickOnViewWithText(coreR.string.duration_dialog_save) 421 431 checkViewIsDisplayed(withText("1$minuteString")) 422 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 423 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 432 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 433 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 424 434 425 435 // 1h 426 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 427 - clickOnViewWithId(R.id.tvNumberKeyboard0) 428 - clickOnViewWithId(R.id.tvNumberKeyboard0) 429 - clickOnViewWithText(R.string.duration_dialog_save) 436 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 437 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 438 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 439 + clickOnViewWithText(coreR.string.duration_dialog_save) 430 440 checkViewIsDisplayed(withText("1$hourString")) 431 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 432 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 441 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 442 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 433 443 434 444 // 1m 1s 435 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 436 - clickOnViewWithId(R.id.ivDurationPickerDelete) 437 - clickOnViewWithId(R.id.ivDurationPickerDelete) 438 - clickOnViewWithId(R.id.ivDurationPickerDelete) 439 - clickOnViewWithId(R.id.tvNumberKeyboard1) 440 - clickOnViewWithText(R.string.duration_dialog_save) 445 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 446 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 447 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 448 + clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) 449 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 450 + clickOnViewWithText(coreR.string.duration_dialog_save) 441 451 checkViewIsDisplayed(withText("1$minuteString 01$secondString")) 442 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 443 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 452 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 453 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 444 454 445 455 // 1h 1m 1s 446 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 447 - clickOnViewWithId(R.id.tvNumberKeyboard0) 448 - clickOnViewWithId(R.id.tvNumberKeyboard1) 449 - clickOnViewWithText(R.string.duration_dialog_save) 456 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 457 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 458 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard1) 459 + clickOnViewWithText(coreR.string.duration_dialog_save) 450 460 checkViewIsDisplayed(withText("1$hourString 01$minuteString 01$secondString")) 451 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 452 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 461 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 462 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 453 463 454 464 // 1h 30m 455 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 465 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 456 466 clearDuration() 457 - clickOnViewWithId(R.id.tvNumberKeyboard9) 458 - clickOnViewWithId(R.id.tvNumberKeyboard0) 459 - clickOnViewWithId(R.id.tvNumberKeyboard0) 460 - clickOnViewWithId(R.id.tvNumberKeyboard0) 461 - clickOnViewWithText(R.string.duration_dialog_save) 467 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard9) 468 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 469 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 470 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard0) 471 + clickOnViewWithText(coreR.string.duration_dialog_save) 462 472 checkViewIsDisplayed(withText("1$hourString 30$minuteString")) 463 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 464 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 473 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 474 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 465 475 466 476 // 99h 99m 99s 467 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 468 - repeat(10) { clickOnViewWithId(R.id.ivDurationPickerDelete) } 469 - repeat(6) { clickOnViewWithId(R.id.tvNumberKeyboard9) } 470 - clickOnViewWithText(R.string.duration_dialog_save) 477 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 478 + repeat(10) { clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) } 479 + repeat(6) { clickOnViewWithId(dialogsR.id.tvNumberKeyboard9) } 480 + clickOnViewWithText(coreR.string.duration_dialog_save) 471 481 checkViewIsDisplayed(withText("100$hourString 40$minuteString 39$secondString")) 472 - onView(withId(R.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 473 - checkViewIsDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 482 + onView(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)).perform(nestedScrollTo()) 483 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 474 484 475 485 // Disable 476 - clickOnViewWithId(R.id.groupSettingsActivityReminder) 477 - clickOnViewWithText(R.string.duration_dialog_disable) 486 + clickOnViewWithId(settingsR.id.groupSettingsActivityReminder) 487 + clickOnViewWithText(coreR.string.duration_dialog_disable) 478 488 checkViewIsDisplayed( 479 489 allOf( 480 - withId(R.id.tvSettingsActivityReminderTime), 481 - withText(R.string.settings_inactivity_reminder_disabled) 490 + withId(settingsR.id.tvSettingsActivityReminderTime), 491 + withText(coreR.string.settings_inactivity_reminder_disabled) 482 492 ) 483 493 ) 484 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsActivityReminderRecurrent)) 494 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsActivityReminderRecurrent)) 485 495 } 486 496 487 497 @Test ··· 494 504 // Change settings 495 505 NavUtils.openSettingsScreen() 496 506 NavUtils.openSettingsAdditional() 497 - onView(withId(R.id.groupSettingsIgnoreShortRecords)).perform(nestedScrollTo()) 507 + onView(withId(settingsR.id.groupSettingsIgnoreShortRecords)).perform(nestedScrollTo()) 498 508 checkViewIsDisplayed( 499 509 allOf( 500 - withId(R.id.tvSettingsIgnoreShortRecordsTime), 501 - withText(R.string.settings_inactivity_reminder_disabled) 510 + withId(settingsR.id.tvSettingsIgnoreShortRecordsTime), 511 + withText(coreR.string.settings_inactivity_reminder_disabled) 502 512 ) 503 513 ) 504 514 505 - clickOnViewWithId(R.id.groupSettingsIgnoreShortRecords) 506 - clickOnViewWithId(R.id.tvNumberKeyboard3) 507 - clickOnViewWithText(R.string.duration_dialog_save) 515 + clickOnViewWithId(settingsR.id.groupSettingsIgnoreShortRecords) 516 + clickOnViewWithId(dialogsR.id.tvNumberKeyboard3) 517 + clickOnViewWithText(coreR.string.duration_dialog_save) 508 518 checkViewIsDisplayed(withText("3$secondString")) 509 519 510 520 // Check record ignored 511 521 NavUtils.openRunningRecordsScreen() 512 522 clickOnViewWithText(name) 513 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 523 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 514 524 NavUtils.openRecordsScreen() 515 525 checkViewDoesNotExist(allOf(withText(name), isCompletelyDisplayed())) 516 526 517 527 // Disable 518 528 NavUtils.openSettingsScreen() 519 - onView(withId(R.id.groupSettingsIgnoreShortRecords)).perform(nestedScrollTo()) 520 - clickOnViewWithId(R.id.groupSettingsIgnoreShortRecords) 521 - clickOnViewWithText(R.string.duration_dialog_disable) 529 + onView(withId(settingsR.id.groupSettingsIgnoreShortRecords)).perform(nestedScrollTo()) 530 + clickOnViewWithId(settingsR.id.groupSettingsIgnoreShortRecords) 531 + clickOnViewWithText(coreR.string.duration_dialog_disable) 522 532 checkViewIsDisplayed( 523 533 allOf( 524 - withId(R.id.tvSettingsIgnoreShortRecordsTime), 525 - withText(R.string.settings_inactivity_reminder_disabled) 534 + withId(settingsR.id.tvSettingsIgnoreShortRecordsTime), 535 + withText(coreR.string.settings_inactivity_reminder_disabled) 526 536 ) 527 537 ) 528 538 529 539 // Check record not ignored 530 540 NavUtils.openRunningRecordsScreen() 531 541 clickOnViewWithText(name) 532 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 542 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 533 543 NavUtils.openRecordsScreen() 534 544 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 535 545 } ··· 539 549 // Check settings 540 550 NavUtils.openSettingsScreen() 541 551 NavUtils.openSettingsDisplay() 542 - onView(withId(R.id.tvSettingsUseMilitaryTimeHint)).perform(nestedScrollTo()) 543 - onView(withId(R.id.checkboxSettingsUseMilitaryTime)).check(matches(isChecked())) 544 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsUseMilitaryTimeHint), withText("13:00"))) 552 + onView(withId(settingsR.id.tvSettingsUseMilitaryTimeHint)).perform(nestedScrollTo()) 553 + onView(withId(settingsR.id.checkboxSettingsUseMilitaryTime)).check(matches(isChecked())) 554 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsUseMilitaryTimeHint), withText("13:00"))) 545 555 546 556 // Change settings 547 - clickOnViewWithId(R.id.checkboxSettingsUseMilitaryTime) 548 - onView(withId(R.id.checkboxSettingsUseMilitaryTime)).check(matches(isNotChecked())) 549 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsUseMilitaryTimeHint), withSubstring("1:00"))) 557 + clickOnViewWithId(settingsR.id.checkboxSettingsUseMilitaryTime) 558 + onView(withId(settingsR.id.checkboxSettingsUseMilitaryTime)).check(matches(isNotChecked())) 559 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsUseMilitaryTimeHint), withSubstring("1:00"))) 550 560 551 561 // Change settings 552 - clickOnViewWithId(R.id.checkboxSettingsUseMilitaryTime) 553 - onView(withId(R.id.checkboxSettingsUseMilitaryTime)).check(matches(isChecked())) 554 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsUseMilitaryTimeHint), withText("13:00"))) 562 + clickOnViewWithId(settingsR.id.checkboxSettingsUseMilitaryTime) 563 + onView(withId(settingsR.id.checkboxSettingsUseMilitaryTime)).check(matches(isChecked())) 564 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsUseMilitaryTimeHint), withText("13:00"))) 555 565 } 556 566 557 567 @Test ··· 564 574 565 575 fun checkFormat(timeString: String) { 566 576 NavUtils.openRecordsScreen() 567 - checkView(R.id.viewRecordItem, timeString) 577 + checkView(baseR.id.viewRecordItem, timeString) 568 578 NavUtils.openStatisticsScreen() 569 - checkView(R.id.viewStatisticsItem, timeString) 579 + checkView(baseR.id.viewStatisticsItem, timeString) 570 580 tryAction { clickOnView(allOf(withText(name), isCompletelyDisplayed())) } 571 - checkView(R.id.cardStatisticsDetailTotal, timeString) 581 + checkView(statisticsDetailR.id.cardStatisticsDetailTotal, timeString) 572 582 pressBack() 573 583 } 574 584 ··· 586 596 // Check settings 587 597 NavUtils.openSettingsScreen() 588 598 NavUtils.openSettingsDisplay() 589 - onView(withId(R.id.tvSettingsUseProportionalMinutesHint)).perform(nestedScrollTo()) 590 - onView(withId(R.id.checkboxSettingsUseProportionalMinutes)).check(matches(isNotChecked())) 599 + onView(withId(settingsR.id.tvSettingsUseProportionalMinutesHint)).perform(nestedScrollTo()) 600 + onView(withId(settingsR.id.checkboxSettingsUseProportionalMinutes)).check(matches(isNotChecked())) 591 601 checkViewIsDisplayed( 592 - allOf(withId(R.id.tvSettingsUseProportionalMinutesHint), withText(timeFormat1)) 602 + allOf(withId(settingsR.id.tvSettingsUseProportionalMinutesHint), withText(timeFormat1)) 593 603 ) 594 604 595 605 // Change settings 596 - clickOnViewWithId(R.id.checkboxSettingsUseProportionalMinutes) 597 - onView(withId(R.id.checkboxSettingsUseProportionalMinutes)).check(matches(isChecked())) 606 + clickOnViewWithId(settingsR.id.checkboxSettingsUseProportionalMinutes) 607 + onView(withId(settingsR.id.checkboxSettingsUseProportionalMinutes)).check(matches(isChecked())) 598 608 checkViewIsDisplayed( 599 - allOf(withId(R.id.tvSettingsUseProportionalMinutesHint), withSubstring(timeFormat2)) 609 + allOf(withId(settingsR.id.tvSettingsUseProportionalMinutesHint), withSubstring(timeFormat2)) 600 610 ) 601 611 602 612 // Check format after setting change ··· 604 614 605 615 // Change settings back 606 616 NavUtils.openSettingsScreen() 607 - onView(withId(R.id.tvSettingsUseProportionalMinutesHint)).perform(nestedScrollTo()) 608 - clickOnViewWithId(R.id.checkboxSettingsUseProportionalMinutes) 609 - onView(withId(R.id.checkboxSettingsUseProportionalMinutes)).check(matches(isNotChecked())) 617 + onView(withId(settingsR.id.tvSettingsUseProportionalMinutesHint)).perform(nestedScrollTo()) 618 + clickOnViewWithId(settingsR.id.checkboxSettingsUseProportionalMinutes) 619 + onView(withId(settingsR.id.checkboxSettingsUseProportionalMinutes)).check(matches(isNotChecked())) 610 620 checkViewIsDisplayed( 611 - allOf(withId(R.id.tvSettingsUseProportionalMinutesHint), withText(timeFormat1)) 621 + allOf(withId(settingsR.id.tvSettingsUseProportionalMinutesHint), withText(timeFormat1)) 612 622 ) 613 623 614 624 // Check format again ··· 620 630 // Check settings 621 631 NavUtils.openSettingsScreen() 622 632 NavUtils.openSettingsDisplay() 623 - onView(withId(R.id.tvSettingsKeepScreenOn)).perform(nestedScrollTo()) 624 - onView(withId(R.id.checkboxSettingsKeepScreenOn)).check(matches(isNotChecked())) 633 + onView(withId(settingsR.id.tvSettingsKeepScreenOn)).perform(nestedScrollTo()) 634 + onView(withId(settingsR.id.checkboxSettingsKeepScreenOn)).check(matches(isNotChecked())) 625 635 626 636 // Change settings 627 - clickOnViewWithId(R.id.checkboxSettingsKeepScreenOn) 628 - onView(withId(R.id.checkboxSettingsKeepScreenOn)).check(matches(isChecked())) 637 + clickOnViewWithId(settingsR.id.checkboxSettingsKeepScreenOn) 638 + onView(withId(settingsR.id.checkboxSettingsKeepScreenOn)).check(matches(isChecked())) 629 639 630 640 // Change settings 631 - clickOnViewWithId(R.id.checkboxSettingsKeepScreenOn) 632 - onView(withId(R.id.checkboxSettingsKeepScreenOn)).check(matches(isNotChecked())) 641 + clickOnViewWithId(settingsR.id.checkboxSettingsKeepScreenOn) 642 + onView(withId(settingsR.id.checkboxSettingsKeepScreenOn)).check(matches(isNotChecked())) 633 643 } 634 644 635 645 @Test ··· 664 674 // Change setting 665 675 NavUtils.openSettingsScreen() 666 676 NavUtils.openSettingsAdditional() 667 - clickOnSpinnerWithId(R.id.spinnerSettingsFirstDayOfWeek) 677 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsFirstDayOfWeek) 668 678 if (isTodaySunday) { 669 - clickOnViewWithText(R.string.day_of_week_monday) 679 + clickOnViewWithText(coreR.string.day_of_week_monday) 670 680 } else { 671 - clickOnViewWithText(R.string.day_of_week_sunday) 681 + clickOnViewWithText(coreR.string.day_of_week_sunday) 672 682 } 673 683 674 684 // Check statistics 675 685 NavUtils.openStatisticsScreen() 676 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 677 - clickOnViewWithText(R.string.range_week) 686 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 687 + clickOnViewWithText(coreR.string.range_week) 678 688 clickOnView( 679 689 allOf( 680 - withId(R.id.viewStatisticsItem), 690 + withId(baseR.id.viewStatisticsItem), 681 691 hasDescendant(withText(name)), 682 692 isCompletelyDisplayed() 683 693 ) 684 694 ) 685 695 686 696 // Check detailed statistics 687 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 688 - clickOnViewWithText(R.string.range_week) 697 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 698 + clickOnViewWithText(coreR.string.range_week) 689 699 checkViewIsDisplayed( 690 700 allOf( 691 - withPluralText(R.plurals.statistics_detail_times_tracked, 1), 701 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 1), 692 702 hasSibling(withText("1")), 693 703 isCompletelyDisplayed() 694 704 ) ··· 700 710 startOfDayShift = 0, 701 711 firstDayOfWeek = if (isTodaySunday) DayOfWeek.MONDAY else DayOfWeek.SUNDAY 702 712 ) 703 - longClickOnViewWithId(R.id.btnStatisticsDetailToday) 704 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 713 + longClickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 714 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 705 715 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 706 716 pressBack() 707 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 708 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 717 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 718 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 709 719 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 710 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 720 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 711 721 712 722 // Change setting 713 723 NavUtils.openSettingsScreen() 714 - clickOnSpinnerWithId(R.id.spinnerSettingsFirstDayOfWeek) 724 + clickOnSpinnerWithId(settingsR.id.spinnerSettingsFirstDayOfWeek) 715 725 if (isTodaySunday) { 716 - clickOnViewWithText(R.string.day_of_week_sunday) 726 + clickOnViewWithText(coreR.string.day_of_week_sunday) 717 727 } else { 718 - clickOnViewWithText(R.string.day_of_week_monday) 728 + clickOnViewWithText(coreR.string.day_of_week_monday) 719 729 } 720 730 721 731 // Check statistics 722 732 NavUtils.openStatisticsScreen() 723 733 checkViewDoesNotExist( 724 734 allOf( 725 - withId(R.id.viewStatisticsItem), 735 + withId(baseR.id.viewStatisticsItem), 726 736 hasDescendant(withText(name)), 727 737 isCompletelyDisplayed() 728 738 ) 729 739 ) 730 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 740 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 731 741 clickOnView( 732 742 allOf( 733 - withId(R.id.viewStatisticsItem), 743 + withId(baseR.id.viewStatisticsItem), 734 744 hasDescendant(withText(name)), 735 745 isCompletelyDisplayed() 736 746 ) 737 747 ) 738 748 739 749 // Check detailed statistics 740 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 741 - clickOnViewWithText(R.string.range_week) 750 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 751 + clickOnViewWithText(coreR.string.range_week) 742 752 checkViewIsDisplayed( 743 753 allOf( 744 - withPluralText(R.plurals.statistics_detail_times_tracked, 0), 754 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 0), 745 755 hasSibling(withText("0")), 746 756 isCompletelyDisplayed() 747 757 ) 748 758 ) 749 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 759 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 750 760 checkViewIsDisplayed( 751 761 allOf( 752 - withPluralText(R.plurals.statistics_detail_times_tracked, 1), 762 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 1), 753 763 hasSibling(withText("1")), 754 764 isCompletelyDisplayed() 755 765 ) ··· 761 771 startOfDayShift = 0, 762 772 firstDayOfWeek = if (isTodaySunday) DayOfWeek.SUNDAY else DayOfWeek.MONDAY 763 773 ) 764 - longClickOnViewWithId(R.id.btnStatisticsDetailToday) 765 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 774 + longClickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 775 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 766 776 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 767 777 pressBack() 768 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 769 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 778 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 779 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 770 780 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 771 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 781 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 772 782 } 773 783 774 784 @Test ··· 798 808 799 809 // Check records 800 810 NavUtils.openRecordsScreen() 801 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 802 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 803 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 811 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 812 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 813 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 804 814 checkRecord( 805 - nameResId = R.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 815 + nameResId = coreR.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 806 816 ) 807 - clickOnViewWithId(R.id.btnRecordsContainerNext) 817 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 808 818 checkRecord(name = name, timeStart = timeStartedPreview, timeEnd = startOfDayPreview) 809 - clickOnViewWithId(R.id.btnRecordsContainerNext) 819 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 810 820 checkRecord(name = name, timeStart = startOfDayPreview, timeEnd = timeEndedPreview) 811 821 812 822 // Check statistics 813 823 NavUtils.openStatisticsScreen() 814 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 815 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 816 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 22) 824 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 825 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 826 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 22) 817 827 checkStatisticsItem(name = name, hours = 2) 818 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 819 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 22) 828 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 829 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 22) 820 830 checkStatisticsItem(name = name, hours = 2) 821 831 822 832 // Check detailed statistics 823 833 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 824 - clickOnView(allOf(withId(R.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 825 - clickOnViewWithText(R.string.range_day) 834 + clickOnView(allOf(withId(statisticsDetailR.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 835 + clickOnViewWithText(coreR.string.range_day) 826 836 checkStatisticsDetailRecords(0) 827 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 837 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 828 838 checkStatisticsDetailRecords(1) 829 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 839 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 830 840 checkStatisticsDetailRecords(1) 831 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 841 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 832 842 checkStatisticsDetailRecords(0) 833 843 pressBack() 834 844 835 845 // Check setting 836 846 NavUtils.openSettingsScreen() 837 847 NavUtils.openSettingsAdditional() 838 - onView(withId(R.id.tvSettingsStartOfDayTime)).perform(nestedScrollTo()) 839 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 840 - checkViewIsNotDisplayed(withId(R.id.btnSettingsStartOfDaySign)) 848 + onView(withId(settingsR.id.tvSettingsStartOfDayTime)).perform(nestedScrollTo()) 849 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 850 + checkViewIsNotDisplayed(withId(settingsR.id.btnSettingsStartOfDaySign)) 841 851 842 852 // Change setting to +1 843 - clickOnView(withId(R.id.groupSettingsStartOfDay)) 853 + clickOnView(withId(settingsR.id.groupSettingsStartOfDay)) 844 854 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(1, 0)) 845 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 855 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 846 856 startOfDayTimeStamp = calendar.timeInMillis + TimeUnit.HOURS.toMillis(1) 847 857 startOfDayPreview = startOfDayTimeStamp.toTimePreview() 848 858 849 859 // Check new setting 850 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 860 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 851 861 checkViewIsDisplayed( 852 - allOf(withId(R.id.btnSettingsStartOfDaySign), hasDescendant(withText(R.string.plus_sign))) 862 + allOf(withId(settingsR.id.btnSettingsStartOfDaySign), hasDescendant(withText(coreR.string.plus_sign))) 853 863 ) 854 864 855 865 // Check records 856 866 NavUtils.openRecordsScreen() 857 - longClickOnViewWithId(R.id.btnRecordsContainerToday) 858 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 859 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 860 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 867 + longClickOnViewWithId(recordsR.id.btnRecordsContainerToday) 868 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 869 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 870 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 861 871 checkRecord( 862 - nameResId = R.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 872 + nameResId = coreR.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 863 873 ) 864 - clickOnViewWithId(R.id.btnRecordsContainerNext) 874 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 865 875 checkRecord(name = name, timeStart = timeStartedPreview, timeEnd = startOfDayPreview) 866 - clickOnViewWithId(R.id.btnRecordsContainerNext) 876 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 867 877 checkRecord(name = name, timeStart = startOfDayPreview, timeEnd = timeEndedPreview) 868 878 869 879 // Check statistics 870 880 NavUtils.openStatisticsScreen() 871 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 872 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 873 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 874 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 21) 881 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 882 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 883 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 884 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 21) 875 885 checkStatisticsItem(name = name, hours = 3) 876 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 877 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 23) 886 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 887 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 23) 878 888 checkStatisticsItem(name = name, hours = 1) 879 889 880 890 // Check detailed statistics 881 891 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 882 - clickOnView(allOf(withId(R.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 883 - clickOnViewWithText(R.string.range_day) 892 + clickOnView(allOf(withId(statisticsDetailR.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 893 + clickOnViewWithText(coreR.string.range_day) 884 894 checkStatisticsDetailRecords(0) 885 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 895 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 886 896 checkStatisticsDetailRecords(1) 887 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 897 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 888 898 checkStatisticsDetailRecords(1) 889 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 899 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 890 900 checkStatisticsDetailRecords(0) 891 901 pressBack() 892 902 893 903 // Change setting to -1 894 904 NavUtils.openSettingsScreen() 895 - onView(withId(R.id.btnSettingsStartOfDaySign)).perform(nestedScrollTo(), click()) 905 + onView(withId(settingsR.id.btnSettingsStartOfDaySign)).perform(nestedScrollTo(), click()) 896 906 897 907 // Check new setting 898 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 908 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 899 909 checkViewIsDisplayed( 900 - allOf(withId(R.id.btnSettingsStartOfDaySign), hasDescendant(withText(R.string.minus_sign))) 910 + allOf(withId(settingsR.id.btnSettingsStartOfDaySign), hasDescendant(withText(coreR.string.minus_sign))) 901 911 ) 902 912 903 913 startOfDayTimeStamp = calendar.timeInMillis - TimeUnit.HOURS.toMillis(1) ··· 905 915 906 916 // Check records 907 917 NavUtils.openRecordsScreen() 908 - longClickOnViewWithId(R.id.btnRecordsContainerToday) 909 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 910 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 911 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 918 + longClickOnViewWithId(recordsR.id.btnRecordsContainerToday) 919 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 920 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 921 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 912 922 checkRecord( 913 - nameResId = R.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 923 + nameResId = coreR.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 914 924 ) 915 - clickOnViewWithId(R.id.btnRecordsContainerNext) 925 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 916 926 checkRecord(name = name, timeStart = timeStartedPreview, timeEnd = startOfDayPreview) 917 - clickOnViewWithId(R.id.btnRecordsContainerNext) 927 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 918 928 checkRecord(name = name, timeStart = startOfDayPreview, timeEnd = timeEndedPreview) 919 929 920 930 // Check statistics 921 931 NavUtils.openStatisticsScreen() 922 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 923 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 924 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 925 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 23) 932 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 933 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 934 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 935 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 23) 926 936 checkStatisticsItem(name = name, hours = 1) 927 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 928 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 21) 937 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 938 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 21) 929 939 checkStatisticsItem(name = name, hours = 3) 930 940 931 941 // Check detailed statistics 932 942 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 933 - clickOnView(allOf(withId(R.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 934 - clickOnViewWithText(R.string.range_day) 943 + clickOnView(allOf(withId(statisticsDetailR.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 944 + clickOnViewWithText(coreR.string.range_day) 935 945 checkStatisticsDetailRecords(0) 936 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 946 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 937 947 checkStatisticsDetailRecords(1) 938 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 948 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 939 949 checkStatisticsDetailRecords(1) 940 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 950 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 941 951 checkStatisticsDetailRecords(0) 942 952 pressBack() 943 953 ··· 946 956 startOfDayPreview = startOfDayTimeStamp.toTimePreview() 947 957 948 958 NavUtils.openSettingsScreen() 949 - onView(withId(R.id.groupSettingsStartOfDay)).perform(nestedScrollTo(), click()) 959 + onView(withId(settingsR.id.groupSettingsStartOfDay)).perform(nestedScrollTo(), click()) 950 960 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(2, 0)) 951 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 952 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 961 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 962 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 953 963 checkViewIsDisplayed( 954 - allOf(withId(R.id.btnSettingsStartOfDaySign), hasDescendant(withText(R.string.minus_sign))) 964 + allOf(withId(settingsR.id.btnSettingsStartOfDaySign), hasDescendant(withText(coreR.string.minus_sign))) 955 965 ) 956 - onView(withId(R.id.btnSettingsStartOfDaySign)).perform(nestedScrollTo(), click()) 957 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 966 + onView(withId(settingsR.id.btnSettingsStartOfDaySign)).perform(nestedScrollTo(), click()) 967 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 958 968 959 969 // Check records 960 970 NavUtils.openRecordsScreen() 961 - longClickOnViewWithId(R.id.btnRecordsContainerToday) 962 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 963 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 964 - clickOnViewWithId(R.id.btnRecordsContainerPrevious) 971 + longClickOnViewWithId(recordsR.id.btnRecordsContainerToday) 972 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 973 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 974 + clickOnViewWithId(recordsR.id.btnRecordsContainerPrevious) 965 975 checkRecord( 966 - nameResId = R.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 976 + nameResId = coreR.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 967 977 ) 968 - clickOnViewWithId(R.id.btnRecordsContainerNext) 978 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 969 979 checkRecord(name = name, timeStart = timeStartedPreview, timeEnd = timeEndedPreview) 970 - clickOnViewWithId(R.id.btnRecordsContainerNext) 980 + clickOnViewWithId(recordsR.id.btnRecordsContainerNext) 971 981 checkRecord( 972 - nameResId = R.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 982 + nameResId = coreR.string.untracked_time_name, timeStart = startOfDayPreview, timeEnd = startOfDayPreview, 973 983 ) 974 984 // Check statistics 975 985 NavUtils.openStatisticsScreen() 976 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 977 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 978 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 979 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 20) 986 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 987 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 988 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 989 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 20) 980 990 checkStatisticsItem(name = name, hours = 4) 981 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 982 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 24) 991 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 992 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 24) 983 993 984 994 // Check detailed statistics 985 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 995 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 986 996 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 987 - clickOnView(allOf(withId(R.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 988 - clickOnViewWithText(R.string.range_day) 997 + clickOnView(allOf(withId(statisticsDetailR.id.btnStatisticsDetailToday), isCompletelyDisplayed())) 998 + clickOnViewWithText(coreR.string.range_day) 989 999 checkStatisticsDetailRecords(0) 990 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 1000 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 991 1001 checkStatisticsDetailRecords(0) 992 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 1002 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 993 1003 checkStatisticsDetailRecords(1) 994 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 1004 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 995 1005 checkStatisticsDetailRecords(0) 996 1006 pressBack() 997 1007 ··· 1000 1010 startOfDayPreview = startOfDayTimeStamp.toTimePreview() 1001 1011 1002 1012 NavUtils.openSettingsScreen() 1003 - onView(withId(R.id.groupSettingsStartOfDay)).perform(nestedScrollTo(), click()) 1013 + onView(withId(settingsR.id.groupSettingsStartOfDay)).perform(nestedScrollTo(), click()) 1004 1014 onView(withClassName(equalTo(CustomTimePicker::class.java.name))).perform(setTime(0, 0)) 1005 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 1006 - checkViewIsDisplayed(allOf(withId(R.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 1007 - checkViewIsNotDisplayed(withId(R.id.btnSettingsStartOfDaySign)) 1015 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 1016 + checkViewIsDisplayed(allOf(withId(settingsR.id.tvSettingsStartOfDayTime), withText(startOfDayPreview))) 1017 + checkViewIsNotDisplayed(withId(settingsR.id.btnSettingsStartOfDaySign)) 1008 1018 } 1009 1019 1010 1020 @Test ··· 1018 1028 testUtils.addActivity(name) 1019 1029 Thread.sleep(1000) 1020 1030 tryAction { clickOnViewWithText(name) } 1021 - tryAction { clickOnView(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name)))) } 1031 + tryAction { clickOnView(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name)))) } 1022 1032 1023 1033 // Change setting 1024 1034 NavUtils.openSettingsScreen() 1025 1035 NavUtils.openSettingsAdditional() 1026 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1027 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).check(matches(isNotChecked())) 1028 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 1029 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).check(matches(isChecked())) 1036 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1037 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).check(matches(isNotChecked())) 1038 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 1039 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).check(matches(isChecked())) 1030 1040 1031 1041 // No tags - started right away 1032 1042 NavUtils.openRunningRecordsScreen() 1033 1043 clickOnViewWithText(name) 1034 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1044 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1035 1045 1036 1046 // Add tag 1037 1047 testUtils.addRecordTag(tag, name) ··· 1039 1049 1040 1050 // Has a tag - show dialog 1041 1051 clickOnViewWithText(name) 1042 - tryAction { checkViewIsDisplayed(withText(R.string.change_record_untagged)) } 1052 + tryAction { checkViewIsDisplayed(withText(coreR.string.change_record_untagged)) } 1043 1053 checkViewIsDisplayed(withText(tag)) 1044 1054 pressBack() 1045 1055 1046 1056 // Start untagged 1047 1057 clickOnViewWithText(name) 1048 1058 tryAction { clickOnView(withText(tag)) } 1049 - clickOnView(withText(R.string.change_record_untagged)) 1050 - clickOnViewWithText(R.string.duration_dialog_save) 1051 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1059 + clickOnView(withText(coreR.string.change_record_untagged)) 1060 + clickOnViewWithText(coreR.string.duration_dialog_save) 1061 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1052 1062 1053 1063 // Start tagged 1054 1064 clickOnViewWithText(name) 1055 1065 tryAction { clickOnView(withText(tag)) } 1056 - clickOnViewWithText(R.string.duration_dialog_save) 1057 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(fullName))) } 1066 + clickOnViewWithText(coreR.string.duration_dialog_save) 1067 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(fullName))) } 1058 1068 1059 1069 // Change setting 1060 1070 NavUtils.openSettingsScreen() 1061 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1062 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).check(matches(isChecked())) 1063 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 1064 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).check(matches(isNotChecked())) 1071 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1072 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).check(matches(isChecked())) 1073 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 1074 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).check(matches(isNotChecked())) 1065 1075 1066 1076 // Start with tags - no dialog 1067 1077 NavUtils.openRunningRecordsScreen() 1068 1078 clickOnViewWithText(name) 1069 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1079 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1070 1080 } 1071 1081 1072 1082 @Test ··· 1081 1091 testUtils.addActivity(name) 1082 1092 Thread.sleep(1000) 1083 1093 tryAction { clickOnViewWithText(name) } 1084 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1094 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1085 1095 1086 1096 // Change setting 1087 1097 NavUtils.openSettingsScreen() 1088 1098 NavUtils.openSettingsAdditional() 1089 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1090 - checkViewIsNotDisplayed(withText(R.string.settings_show_record_tag_close_hint)) 1091 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsRecordTagSelectionClose)) 1099 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1100 + checkViewIsNotDisplayed(withText(coreR.string.settings_show_record_tag_close_hint)) 1101 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)) 1092 1102 1093 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 1094 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).perform(nestedScrollTo()) 1095 - checkViewIsDisplayed(withText(R.string.settings_show_record_tag_close_hint)) 1096 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isNotChecked())) 1097 - unconstrainedClickOnView(withId(R.id.checkboxSettingsRecordTagSelectionClose)) 1098 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isChecked())) 1103 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 1104 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).perform(nestedScrollTo()) 1105 + checkViewIsDisplayed(withText(coreR.string.settings_show_record_tag_close_hint)) 1106 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isNotChecked())) 1107 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)) 1108 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isChecked())) 1099 1109 1100 1110 // No tags - started right away 1101 1111 NavUtils.openRunningRecordsScreen() 1102 1112 clickOnViewWithText(name) 1103 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1113 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1104 1114 1105 1115 // Add tag 1106 1116 testUtils.addRecordTag(tag, name) ··· 1109 1119 // Start after one tag selected 1110 1120 clickOnViewWithText(name) 1111 1121 clickOnView(withText(tag)) 1112 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(fullName))) } 1122 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(fullName))) } 1113 1123 1114 1124 // Change setting 1115 1125 NavUtils.openSettingsScreen() 1116 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).perform(nestedScrollTo()) 1117 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isChecked())) 1118 - unconstrainedClickOnView(withId(R.id.checkboxSettingsRecordTagSelectionClose)) 1119 - onView(withId(R.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isNotChecked())) 1126 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).perform(nestedScrollTo()) 1127 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isChecked())) 1128 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)) 1129 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)).check(matches(isNotChecked())) 1120 1130 1121 1131 // Start with several tags 1122 1132 NavUtils.openRunningRecordsScreen() 1123 1133 clickOnViewWithText(name) 1124 1134 clickOnView(withText(tag)) 1125 1135 clickOnView(withText(tagGeneral)) 1126 - clickOnViewWithText(R.string.duration_dialog_save) 1127 - tryAction { clickOnView(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(fullName2)))) } 1136 + clickOnViewWithText(coreR.string.duration_dialog_save) 1137 + tryAction { clickOnView(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(fullName2)))) } 1128 1138 1129 1139 // Change setting 1130 1140 NavUtils.openSettingsScreen() 1131 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1132 - checkViewIsDisplayed(withText(R.string.settings_show_record_tag_close_hint)) 1133 - checkViewIsDisplayed(withId(R.id.checkboxSettingsRecordTagSelectionClose)) 1141 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1142 + checkViewIsDisplayed(withText(coreR.string.settings_show_record_tag_close_hint)) 1143 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)) 1134 1144 1135 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 1136 - checkViewIsNotDisplayed(withText(R.string.settings_show_record_tag_close_hint)) 1137 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsRecordTagSelectionClose)) 1145 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 1146 + checkViewIsNotDisplayed(withText(coreR.string.settings_show_record_tag_close_hint)) 1147 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsRecordTagSelectionClose)) 1138 1148 } 1139 1149 1140 1150 @Test ··· 1146 1156 testUtils.addActivity(name) 1147 1157 Thread.sleep(1000) 1148 1158 tryAction { clickOnViewWithText(name) } 1149 - tryAction { clickOnView(allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name)))) } 1159 + tryAction { clickOnView(allOf(withId(baseR.id.viewRunningRecordItem), hasDescendant(withText(name)))) } 1150 1160 1151 1161 // Change setting 1152 1162 NavUtils.openSettingsScreen() 1153 1163 NavUtils.openSettingsAdditional() 1154 - onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1155 - checkViewIsNotDisplayed(withText(R.string.settings_show_record_tag_general_hint)) 1156 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)) 1164 + onView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo()) 1165 + checkViewIsNotDisplayed(withText(coreR.string.settings_show_record_tag_general_hint)) 1166 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)) 1157 1167 1158 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection)) 1159 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).perform(nestedScrollTo()) 1160 - checkViewIsDisplayed(withText(R.string.settings_show_record_tag_general_hint)) 1161 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isNotChecked())) 1162 - unconstrainedClickOnView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)) 1163 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isChecked())) 1168 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordTagSelection)) 1169 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).perform(nestedScrollTo()) 1170 + checkViewIsDisplayed(withText(coreR.string.settings_show_record_tag_general_hint)) 1171 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isNotChecked())) 1172 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)) 1173 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isChecked())) 1164 1174 1165 1175 // No tags - started right away 1166 1176 NavUtils.openRunningRecordsScreen() 1167 1177 clickOnViewWithText(name) 1168 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1178 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1169 1179 1170 1180 // Add tag 1171 1181 testUtils.addRecordTag(tagGeneral) 1172 1182 1173 1183 // Has a tag - show dialog 1174 1184 clickOnViewWithText(name) 1175 - tryAction { checkViewIsDisplayed(withText(R.string.change_record_untagged)) } 1185 + tryAction { checkViewIsDisplayed(withText(coreR.string.change_record_untagged)) } 1176 1186 checkViewIsDisplayed(withText(tagGeneral)) 1177 1187 pressBack() 1178 1188 1179 1189 // Change setting 1180 1190 NavUtils.openSettingsScreen() 1181 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).perform(nestedScrollTo()) 1182 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isChecked())) 1183 - unconstrainedClickOnView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)) 1184 - onView(withId(R.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isNotChecked())) 1191 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).perform(nestedScrollTo()) 1192 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isChecked())) 1193 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)) 1194 + onView(withId(settingsR.id.checkboxSettingsRecordTagSelectionGeneral)).check(matches(isNotChecked())) 1185 1195 1186 1196 // Start with tags - no dialog 1187 1197 NavUtils.openRunningRecordsScreen() 1188 1198 clickOnViewWithText(name) 1189 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1199 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1190 1200 } 1191 1201 1192 1202 @Test 1193 1203 fun csvExportSettings() { 1194 1204 NavUtils.openSettingsScreen() 1195 - onView(withId(R.id.layoutSettingsExportCsv)).perform(nestedScrollTo(), click()) 1205 + onView(withId(settingsR.id.layoutSettingsExportCsv)).perform(nestedScrollTo(), click()) 1196 1206 1197 1207 // View is set up 1198 1208 val currentTime = System.currentTimeMillis() ··· 1202 1212 var timeEnded = timeMapper.formatDateTime( 1203 1213 time = currentTime, useMilitaryTime = true, showSeconds = false 1204 1214 ) 1205 - checkViewIsDisplayed(allOf(withId(R.id.tvCsvExportSettingsTimeStarted), withText(timeStarted))) 1206 - checkViewIsDisplayed(allOf(withId(R.id.tvCsvExportSettingsTimeEnded), withText(timeEnded))) 1215 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCsvExportSettingsTimeStarted), withText(timeStarted))) 1216 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCsvExportSettingsTimeEnded), withText(timeEnded))) 1207 1217 1208 1218 val calendar = Calendar.getInstance().apply { 1209 1219 add(Calendar.DATE, -1) ··· 1217 1227 val day = calendar.get(Calendar.DAY_OF_MONTH) 1218 1228 1219 1229 // Set time started 1220 - clickOnViewWithId(R.id.tvCsvExportSettingsTimeStarted) 1230 + clickOnViewWithId(dialogsR.id.tvCsvExportSettingsTimeStarted) 1221 1231 onView(withClassName(equalTo(DatePicker::class.java.name))) 1222 1232 .perform(setDate(year, month + 1, day)) 1223 - clickOnView(allOf(isDescendantOfA(withId(R.id.tabsDateTimeDialog)), withText(R.string.date_time_dialog_time))) 1233 + clickOnView( 1234 + allOf( 1235 + isDescendantOfA(withId(dialogsR.id.tabsDateTimeDialog)), withText(coreR.string.date_time_dialog_time) 1236 + ) 1237 + ) 1224 1238 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 1225 1239 .perform(setTime(hourStarted, minutesStarted)) 1226 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 1240 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 1227 1241 1228 1242 // Check time set 1229 1243 val timeStartedTimestamp = Calendar.getInstance().run { ··· 1237 1251 timeStarted = timeStartedTimestamp 1238 1252 .let { timeMapper.formatDateTime(time = it, useMilitaryTime = true, showSeconds = false) } 1239 1253 1240 - checkViewIsDisplayed(allOf(withId(R.id.tvCsvExportSettingsTimeStarted), withText(timeStarted))) 1254 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCsvExportSettingsTimeStarted), withText(timeStarted))) 1241 1255 1242 1256 // Set time ended 1243 - clickOnViewWithId(R.id.tvCsvExportSettingsTimeEnded) 1257 + clickOnViewWithId(dialogsR.id.tvCsvExportSettingsTimeEnded) 1244 1258 onView(withClassName(equalTo(DatePicker::class.java.name))) 1245 1259 .perform(setDate(year, month + 1, day)) 1246 - clickOnView(allOf(isDescendantOfA(withId(R.id.tabsDateTimeDialog)), withText(R.string.date_time_dialog_time))) 1260 + clickOnView( 1261 + allOf( 1262 + isDescendantOfA(withId(dialogsR.id.tabsDateTimeDialog)), withText(coreR.string.date_time_dialog_time) 1263 + ) 1264 + ) 1247 1265 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 1248 1266 .perform(setTime(hourEnded, minutesEnded)) 1249 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 1267 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 1250 1268 1251 1269 // Check time set 1252 1270 val timeEndedTimestamp = Calendar.getInstance().run { ··· 1260 1278 timeEnded = timeEndedTimestamp 1261 1279 .let { timeMapper.formatDateTime(time = it, useMilitaryTime = true, showSeconds = false) } 1262 1280 1263 - checkViewIsDisplayed(allOf(withId(R.id.tvCsvExportSettingsTimeEnded), withText(timeEnded))) 1281 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCsvExportSettingsTimeEnded), withText(timeEnded))) 1264 1282 } 1265 1283 1266 1284 @Test ··· 1273 1291 1274 1292 // Record is shown 1275 1293 NavUtils.openRecordsScreen() 1276 - checkViewDoesNotExist(allOf(withId(R.id.viewRecordsCalendar), isCompletelyDisplayed())) 1277 - checkViewDoesNotExist(allOf(withId(R.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1278 - checkViewIsDisplayed(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())) 1294 + checkViewDoesNotExist(allOf(withId(recordsR.id.viewRecordsCalendar), isCompletelyDisplayed())) 1295 + checkViewDoesNotExist(allOf(withId(recordsR.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1296 + checkViewIsDisplayed(allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())) 1279 1297 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 1280 1298 1281 1299 // Change setting 1282 1300 NavUtils.openSettingsScreen() 1283 1301 NavUtils.openSettingsDisplay() 1284 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo()) 1285 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked())) 1286 - checkViewIsNotDisplayed(withText(R.string.settings_reverse_order_in_calendar)) 1287 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsReverseOrderInCalendar)) 1288 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordsCalendar)) 1289 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked())) 1302 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo()) 1303 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked())) 1304 + checkViewIsNotDisplayed(withText(coreR.string.settings_reverse_order_in_calendar)) 1305 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)) 1306 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)) 1307 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked())) 1290 1308 1291 1309 // Record is not shown 1292 1310 NavUtils.openRecordsScreen() 1293 - checkViewIsDisplayed(allOf(withId(R.id.viewRecordsCalendar), isCompletelyDisplayed())) 1294 - checkViewIsDisplayed(allOf(withId(R.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1295 - checkViewDoesNotExist(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())) 1311 + checkViewIsDisplayed(allOf(withId(recordsR.id.viewRecordsCalendar), isCompletelyDisplayed())) 1312 + checkViewIsDisplayed(allOf(withId(recordsR.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1313 + checkViewDoesNotExist(allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())) 1296 1314 checkViewDoesNotExist(allOf(withText(name), isCompletelyDisplayed())) 1297 1315 1298 1316 // Check reverse order 1299 1317 NavUtils.openSettingsScreen() 1300 - onView(withId(R.id.checkboxSettingsReverseOrderInCalendar)).perform(nestedScrollTo()) 1301 - checkViewIsDisplayed(withText(R.string.settings_reverse_order_in_calendar)) 1302 - checkViewIsDisplayed(withId(R.id.checkboxSettingsReverseOrderInCalendar)) 1303 - onView(withId(R.id.checkboxSettingsReverseOrderInCalendar)).check(matches(isNotChecked())) 1304 - unconstrainedClickOnView(withId(R.id.checkboxSettingsReverseOrderInCalendar)) 1305 - onView(withId(R.id.checkboxSettingsReverseOrderInCalendar)).check(matches(isChecked())) 1318 + onView(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)).perform(nestedScrollTo()) 1319 + checkViewIsDisplayed(withText(coreR.string.settings_reverse_order_in_calendar)) 1320 + checkViewIsDisplayed(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)) 1321 + onView(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)).check(matches(isNotChecked())) 1322 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)) 1323 + onView(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)).check(matches(isChecked())) 1306 1324 NavUtils.openRecordsScreen() 1307 1325 1308 1326 // Change setting 1309 1327 NavUtils.openSettingsScreen() 1310 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo()) 1311 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked())) 1312 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordsCalendar)) 1313 - onView(withId(R.id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked())) 1314 - checkViewIsNotDisplayed(withText(R.string.settings_reverse_order_in_calendar)) 1315 - checkViewIsNotDisplayed(withId(R.id.checkboxSettingsReverseOrderInCalendar)) 1328 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).perform(nestedScrollTo()) 1329 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).check(matches(isChecked())) 1330 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)) 1331 + onView(withId(settingsR.id.checkboxSettingsShowRecordsCalendar)).check(matches(isNotChecked())) 1332 + checkViewIsNotDisplayed(withText(coreR.string.settings_reverse_order_in_calendar)) 1333 + checkViewIsNotDisplayed(withId(settingsR.id.checkboxSettingsReverseOrderInCalendar)) 1316 1334 1317 1335 // Record is shown 1318 1336 NavUtils.openRecordsScreen() 1319 - checkViewDoesNotExist(allOf(withId(R.id.viewRecordsCalendar), isCompletelyDisplayed())) 1320 - checkViewDoesNotExist(allOf(withId(R.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1321 - checkViewIsDisplayed(allOf(withId(R.id.rvRecordsList), isCompletelyDisplayed())) 1337 + checkViewDoesNotExist(allOf(withId(recordsR.id.viewRecordsCalendar), isCompletelyDisplayed())) 1338 + checkViewDoesNotExist(allOf(withId(recordsR.id.tvRecordsCalendarHint), isCompletelyDisplayed())) 1339 + checkViewIsDisplayed(allOf(withId(recordsR.id.rvRecordsList), isCompletelyDisplayed())) 1322 1340 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 1323 1341 } 1324 1342 ··· 1332 1350 1333 1351 // Check range not transferred 1334 1352 NavUtils.openStatisticsScreen() 1335 - clickOnViewWithIdOnPager(R.id.btnStatisticsContainerToday) 1336 - clickOnViewWithText(R.string.range_week) 1337 - checkViewIsDisplayed(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 1353 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsContainerToday) 1354 + clickOnViewWithText(coreR.string.range_week) 1355 + checkViewIsDisplayed(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 1338 1356 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 1339 - checkViewIsDisplayed(allOf(withText(R.string.title_today), isCompletelyDisplayed())) 1357 + checkViewIsDisplayed(allOf(withText(coreR.string.title_today), isCompletelyDisplayed())) 1340 1358 pressBack() 1341 1359 1342 1360 // Change setting 1343 1361 NavUtils.openSettingsScreen() 1344 1362 NavUtils.openSettingsAdditional() 1345 - onView(withId(R.id.checkboxSettingsKeepStatisticsRange)).perform(nestedScrollTo()) 1346 - onView(withId(R.id.checkboxSettingsKeepStatisticsRange)).check(matches(isNotChecked())) 1347 - unconstrainedClickOnView(withId(R.id.checkboxSettingsKeepStatisticsRange)) 1348 - onView(withId(R.id.checkboxSettingsKeepStatisticsRange)).check(matches(isChecked())) 1363 + onView(withId(settingsR.id.checkboxSettingsKeepStatisticsRange)).perform(nestedScrollTo()) 1364 + onView(withId(settingsR.id.checkboxSettingsKeepStatisticsRange)).check(matches(isNotChecked())) 1365 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsKeepStatisticsRange)) 1366 + onView(withId(settingsR.id.checkboxSettingsKeepStatisticsRange)).check(matches(isChecked())) 1349 1367 1350 1368 // Check range transfer 1351 1369 NavUtils.openStatisticsScreen() 1352 - checkViewIsDisplayed(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 1370 + checkViewIsDisplayed(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 1353 1371 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 1354 - checkViewIsDisplayed(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 1372 + checkViewIsDisplayed(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 1355 1373 pressBack() 1356 1374 } 1357 1375 ··· 1359 1377 fun automatedTracking() { 1360 1378 NavUtils.openSettingsScreen() 1361 1379 NavUtils.openSettingsAdditional() 1362 - onView(withId(R.id.btnSettingsAutomatedTracking)).perform(nestedScrollTo(), click()) 1380 + onView(withId(settingsR.id.btnSettingsAutomatedTracking)).perform(nestedScrollTo(), click()) 1363 1381 checkViewIsDisplayed( 1364 - allOf(withId(R.id.tvHelpDialogTitle), withText(R.string.settings_automated_tracking)) 1382 + allOf(withId(dialogsR.id.tvHelpDialogTitle), withText(coreR.string.settings_automated_tracking)) 1365 1383 ) 1366 1384 } 1367 1385 ··· 1375 1393 // Change setting 1376 1394 NavUtils.openSettingsScreen() 1377 1395 NavUtils.openSettingsAdditional() 1378 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).perform(nestedScrollTo()) 1379 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isNotChecked())) 1380 - unconstrainedClickOnView(withId(R.id.checkboxSettingsAutomatedTrackingSend)) 1381 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isChecked())) 1396 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).perform(nestedScrollTo()) 1397 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isNotChecked())) 1398 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)) 1399 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isChecked())) 1382 1400 1383 1401 // Start stop activity 1384 1402 NavUtils.openRunningRecordsScreen() 1385 1403 clickOnViewWithText(name) 1386 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1404 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1387 1405 1388 1406 // Change setting 1389 1407 NavUtils.openSettingsScreen() 1390 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).perform(nestedScrollTo()) 1391 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isChecked())) 1392 - unconstrainedClickOnView(withId(R.id.checkboxSettingsAutomatedTrackingSend)) 1393 - onView(withId(R.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isNotChecked())) 1408 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).perform(nestedScrollTo()) 1409 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isChecked())) 1410 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)) 1411 + onView(withId(settingsR.id.checkboxSettingsAutomatedTrackingSend)).check(matches(isNotChecked())) 1394 1412 1395 1413 // Start stop activity 1396 1414 NavUtils.openRunningRecordsScreen() 1397 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name))) 1398 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 1415 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name))) 1416 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 1399 1417 } 1400 1418 1401 1419 @Test ··· 1407 1425 1408 1426 // Filters not shown 1409 1427 tryAction { 1410 - checkViewIsDisplayed(withText(R.string.running_records_add_type)) 1411 - checkViewDoesNotExist(withText(R.string.running_records_add_filter)) 1428 + checkViewIsDisplayed(withText(coreR.string.running_records_add_type)) 1429 + checkViewDoesNotExist(withText(coreR.string.running_records_add_filter)) 1412 1430 checkViewDoesNotExist(withText(name)) 1413 1431 } 1414 1432 1415 1433 // Check settings 1416 1434 NavUtils.openSettingsScreen() 1417 1435 NavUtils.openSettingsDisplay() 1418 - onView(withId(R.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 1419 - onView(withId(R.id.checkboxSettingsShowActivityFilters)).check(matches(isNotChecked())) 1436 + onView(withId(settingsR.id.checkboxSettingsShowActivityFilters)).perform(nestedScrollTo()) 1437 + onView(withId(settingsR.id.checkboxSettingsShowActivityFilters)).check(matches(isNotChecked())) 1420 1438 1421 1439 // Change setting 1422 - unconstrainedClickOnView(withId(R.id.checkboxSettingsShowActivityFilters)) 1423 - onView(withId(R.id.checkboxSettingsShowActivityFilters)).check(matches(isChecked())) 1440 + unconstrainedClickOnView(withId(settingsR.id.checkboxSettingsShowActivityFilters)) 1441 + onView(withId(settingsR.id.checkboxSettingsShowActivityFilters)).check(matches(isChecked())) 1424 1442 1425 1443 // Filters shown 1426 1444 NavUtils.openRunningRecordsScreen() 1427 - checkViewIsDisplayed(withText(R.string.running_records_add_filter)) 1445 + checkViewIsDisplayed(withText(coreR.string.running_records_add_filter)) 1428 1446 checkViewIsDisplayed(withText(name)) 1429 1447 } 1430 1448 1431 1449 private fun clearDuration() { 1432 - repeat(6) { clickOnViewWithId(R.id.ivDurationPickerDelete) } 1450 + repeat(6) { clickOnViewWithId(dialogsR.id.ivDurationPickerDelete) } 1433 1451 } 1434 1452 1435 1453 private fun checkRecord( ··· 1440 1458 ) { 1441 1459 checkViewIsDisplayed( 1442 1460 allOf( 1443 - withId(R.id.viewRecordItem), 1461 + withId(baseR.id.viewRecordItem), 1444 1462 hasDescendant(if (nameResId != null) withText(nameResId) else withText(name)), 1445 - hasDescendant(allOf(withId(R.id.tvRecordItemTimeStarted), withText(timeStart))), 1446 - hasDescendant(allOf(withId(R.id.tvRecordItemTimeFinished), withText(timeEnd))), 1463 + hasDescendant(allOf(withId(changeRecordTypeR.id.tvRecordItemTimeStarted), withText(timeStart))), 1464 + hasDescendant(allOf(withId(changeRecordTypeR.id.tvRecordItemTimeFinished), withText(timeEnd))), 1447 1465 isCompletelyDisplayed() 1448 1466 ) 1449 1467 ) ··· 1456 1474 ) { 1457 1475 checkViewIsDisplayed( 1458 1476 allOf( 1459 - withId(R.id.viewStatisticsItem), 1477 + withId(baseR.id.viewStatisticsItem), 1460 1478 hasDescendant(if (nameResId != null) withText(nameResId) else withText(name)), 1461 1479 hasDescendant(withSubstring("$hours$hourString 0$minuteString")), 1462 1480 isCompletelyDisplayed() ··· 1467 1485 private fun checkStatisticsDetailRecords(count: Int) { 1468 1486 checkViewIsDisplayed( 1469 1487 allOf( 1470 - withPluralText(R.plurals.statistics_detail_times_tracked, count), 1488 + withPluralText(coreR.plurals.statistics_detail_times_tracked, count), 1471 1489 hasSibling(withText(count.toString())), 1472 1490 isCompletelyDisplayed() 1473 1491 )
+33 -30
app/src/androidTest/java/com/example/util/simpletimetracker/StartRecordTest.kt
··· 20 20 import com.example.util.simpletimetracker.utils.withCardColor 21 21 import com.example.util.simpletimetracker.utils.withTag 22 22 import dagger.hilt.android.testing.HiltAndroidTest 23 + import java.util.concurrent.TimeUnit 23 24 import org.hamcrest.CoreMatchers.allOf 24 25 import org.junit.Test 25 26 import org.junit.runner.RunWith 26 - import java.util.concurrent.TimeUnit 27 + import com.example.util.simpletimetracker.core.R as coreR 28 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 29 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 27 30 28 31 @HiltAndroidTest 29 32 @RunWith(AndroidJUnit4::class) ··· 45 48 46 49 var currentTime = System.currentTimeMillis() 47 50 var timeStarted = timeMapper.formatTime(time = currentTime, useMilitaryTime = true, showSeconds = false) 48 - val goalString = getString(R.string.change_record_type_session_goal_time).lowercase() + " 9$minuteString" 51 + val goalString = getString(coreR.string.change_record_type_session_goal_time).lowercase() + " 9$minuteString" 49 52 checkViewIsDisplayed( 50 53 allOf( 51 - withId(R.id.viewRunningRecordItem), 54 + withId(baseR.id.viewRunningRecordItem), 52 55 withCardColor(firstColor), 53 56 hasDescendant(withText(name)), 54 57 hasDescendant(withTag(firstIcon)), ··· 63 66 timeStarted = timeMapper.formatTime(time = currentTime, useMilitaryTime = true, showSeconds = false) 64 67 checkViewIsDisplayed( 65 68 allOf( 66 - withId(R.id.viewRunningRecordItem), 69 + withId(baseR.id.viewRunningRecordItem), 67 70 withCardColor(lastColor), 68 71 hasDescendant(withText(newName)), 69 72 hasDescendant(withTag(lastIcon)), ··· 72 75 ) 73 76 checkViewDoesNotExist( 74 77 allOf( 75 - withId(R.id.viewRunningRecordItem), 78 + withId(baseR.id.viewRunningRecordItem), 76 79 hasDescendant(withText(newName)), 77 - hasDescendant(withSubstring(getString(R.string.change_record_type_session_goal_time))) 80 + hasDescendant(withSubstring(getString(coreR.string.change_record_type_session_goal_time))) 78 81 ) 79 82 ) 80 83 ··· 82 85 NavUtils.openRunningRecordsScreen() 83 86 clickOnView( 84 87 allOf( 85 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name), isCompletelyDisplayed() 88 + isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name), isCompletelyDisplayed() 86 89 ) 87 90 ) 88 91 checkViewDoesNotExist( 89 92 allOf( 90 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name), isCompletelyDisplayed() 93 + isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name), isCompletelyDisplayed() 91 94 ) 92 95 ) 93 96 ··· 95 98 NavUtils.openRecordsScreen() 96 99 checkViewIsDisplayed( 97 100 allOf( 98 - withText(name), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed() 101 + withText(name), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed() 99 102 ) 100 103 ) 101 104 ··· 103 106 NavUtils.openRunningRecordsScreen() 104 107 clickOnView( 105 108 allOf( 106 - isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(newName), isCompletelyDisplayed() 109 + isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(newName), isCompletelyDisplayed() 107 110 ) 108 111 ) 109 112 checkViewDoesNotExist( 110 113 allOf( 111 - isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(newName), isCompletelyDisplayed() 114 + isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(newName), isCompletelyDisplayed() 112 115 ) 113 116 ) 114 117 ··· 116 119 NavUtils.openRecordsScreen() 117 120 checkViewIsDisplayed( 118 121 allOf( 119 - withText(newName), isDescendantOfA(withId(R.id.viewRecordItem)), isCompletelyDisplayed() 122 + withText(newName), isDescendantOfA(withId(baseR.id.viewRecordItem)), isCompletelyDisplayed() 120 123 ) 121 124 ) 122 125 } ··· 133 136 clickOnViewWithText(name) 134 137 135 138 // Add comment 136 - longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 137 - clickOnViewWithText(R.string.change_record_comment_field) 138 - typeTextIntoView(R.id.etChangeRecordComment, comment) 139 - clickOnViewWithText(R.string.change_record_comment_field) 140 - clickOnViewWithText(R.string.change_record_save) 139 + longClickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 140 + clickOnViewWithText(coreR.string.change_record_comment_field) 141 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, comment) 142 + clickOnViewWithText(coreR.string.change_record_comment_field) 143 + clickOnViewWithText(coreR.string.change_record_save) 141 144 142 145 // Stop timer 143 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) 146 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) 144 147 145 148 // Check record 146 149 NavUtils.openRecordsScreen() 147 150 checkViewIsDisplayed( 148 151 allOf( 149 - withId(R.id.viewRecordItem), 152 + withId(baseR.id.viewRecordItem), 150 153 hasDescendant(withText(name)), 151 154 hasDescendant(withText(comment)), 152 155 isCompletelyDisplayed() 153 156 ) 154 157 ) 155 158 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 156 - clickOnViewWithText(R.string.change_record_comment_field) 157 - checkViewIsDisplayed(allOf(withId(R.id.etChangeRecordComment), withText(comment))) 159 + clickOnViewWithText(coreR.string.change_record_comment_field) 160 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.etChangeRecordComment), withText(comment))) 158 161 } 159 162 160 163 @Test ··· 173 176 tryAction { clickOnViewWithText(name) } 174 177 175 178 // Add tag 176 - tryAction { longClickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name))) } 177 - clickOnViewWithText(R.string.change_record_tag_field) 178 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag1)) 179 - clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag2)) 180 - clickOnViewWithText(R.string.change_record_tag_field) 181 - clickOnViewWithText(R.string.change_record_save) 179 + tryAction { longClickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(name))) } 180 + clickOnViewWithText(coreR.string.change_record_tag_field) 181 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag1)) 182 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag2)) 183 + clickOnViewWithText(coreR.string.change_record_tag_field) 184 + clickOnViewWithText(coreR.string.change_record_save) 182 185 183 186 // Stop timer 184 - tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(fullName))) } 187 + tryAction { clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRunningRecordItem)), withText(fullName))) } 185 188 186 189 // Check record 187 190 NavUtils.openRecordsScreen() 188 191 checkViewIsDisplayed( 189 192 allOf( 190 - withId(R.id.viewRecordItem), 193 + withId(baseR.id.viewRecordItem), 191 194 hasDescendant(withText(fullName)), 192 195 isCompletelyDisplayed() 193 196 ) 194 197 ) 195 198 clickOnView(allOf(withText(fullName), isCompletelyDisplayed())) 196 - checkViewIsDisplayed(allOf(withId(R.id.previewChangeRecord), hasDescendant(withText(fullName)))) 199 + checkViewIsDisplayed(allOf(withId(changeRecordR.id.previewChangeRecord), hasDescendant(withText(fullName)))) 197 200 } 198 201 }
+424 -302
app/src/androidTest/java/com/example/util/simpletimetracker/StatisticsDetailTest.kt
··· 26 26 import com.example.util.simpletimetracker.utils.withPluralText 27 27 import com.example.util.simpletimetracker.utils.withTag 28 28 import dagger.hilt.android.testing.HiltAndroidTest 29 + import java.util.Calendar 30 + import java.util.concurrent.TimeUnit 29 31 import org.hamcrest.CoreMatchers.allOf 30 32 import org.junit.Test 31 33 import org.junit.runner.RunWith 32 - import java.util.Calendar 33 - import java.util.concurrent.TimeUnit 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_records_all.R as recordsAllR 37 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 38 + import com.example.util.simpletimetracker.feature_statistics_detail.R as statisticsDetailR 39 + import com.example.util.simpletimetracker.feature_views.R as viewsR 34 40 35 41 @Suppress("SameParameterValue") 36 42 @HiltAndroidTest ··· 93 99 94 100 // Check detailed statistics 95 101 NavUtils.openStatisticsScreen() 96 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 97 - clickOnViewWithText(R.string.range_overall) 102 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 103 + clickOnViewWithText(coreR.string.range_overall) 98 104 tryAction { clickOnView(allOf(withText(name), isCompletelyDisplayed())) } 99 105 100 106 // Check one day 101 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 102 - clickOnViewWithText(R.string.range_custom) 107 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 108 + clickOnViewWithText(coreR.string.range_custom) 103 109 NavUtils.setCustomRange( 104 110 yearStarted = calendarToday.get(Calendar.YEAR), 105 111 monthStarted = calendarToday.get(Calendar.MONTH), ··· 108 114 monthEnded = calendarToday.get(Calendar.MONTH), 109 115 dayEnded = calendarToday.get(Calendar.DAY_OF_MONTH), 110 116 ) 111 - checkViewDoesNotExist(allOf(withId(R.id.btnStatisticsDetailPrevious), isCompletelyDisplayed())) 112 - checkViewDoesNotExist(allOf(withId(R.id.btnStatisticsDetailNext), isCompletelyDisplayed())) 113 - checkViewDoesNotExist(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 114 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 115 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 116 - checkViewDoesNotExist(allOf(withId(R.id.cardStatisticsDetailRangeAverage), isCompletelyDisplayed())) 117 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 118 - checkCard(R.string.statistics_detail_total_duration, "1$hourString 0$minuteString") 119 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 117 + checkViewDoesNotExist( 118 + allOf(withId(statisticsDetailR.id.btnStatisticsDetailPrevious), isCompletelyDisplayed()) 119 + ) 120 + checkViewDoesNotExist( 121 + allOf(withId(statisticsDetailR.id.btnStatisticsDetailNext), isCompletelyDisplayed()) 122 + ) 123 + checkViewDoesNotExist( 124 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 125 + ) 126 + checkViewDoesNotExist( 127 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 128 + ) 129 + checkViewDoesNotExist( 130 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 131 + ) 132 + checkViewDoesNotExist( 133 + allOf(withId(statisticsDetailR.id.cardStatisticsDetailRangeAverage), isCompletelyDisplayed()) 134 + ) 135 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 136 + checkCard(coreR.string.statistics_detail_total_duration, "1$hourString 0$minuteString") 137 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 120 138 checkRecordsCard(1) 121 139 122 140 // Check two days 123 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 124 - clickOnViewWithText(R.string.range_custom) 141 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 142 + clickOnViewWithText(coreR.string.range_custom) 125 143 NavUtils.setCustomRange( 126 144 yearStarted = calendarYesterday.get(Calendar.YEAR), 127 145 monthStarted = calendarYesterday.get(Calendar.MONTH), ··· 130 148 monthEnded = calendarToday.get(Calendar.MONTH), 131 149 dayEnded = calendarToday.get(Calendar.DAY_OF_MONTH), 132 150 ) 133 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 134 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 135 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 151 + checkViewIsDisplayed( 152 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 153 + ) 154 + checkViewDoesNotExist( 155 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 156 + ) 157 + checkViewDoesNotExist( 158 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 159 + ) 136 160 checkRangeAverages( 137 - rangeId = R.string.statistics_detail_chart_daily, 161 + rangeId = coreR.string.statistics_detail_chart_daily, 138 162 average = "1$hourString 30$minuteString", 139 163 averageNonEmpty = "1$hourString 30$minuteString" 140 164 ) 141 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 142 - checkCard(R.string.statistics_detail_total_duration, "3$hourString 0$minuteString") 143 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 165 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 166 + checkCard(coreR.string.statistics_detail_total_duration, "3$hourString 0$minuteString") 167 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 144 168 checkRecordsCard(2) 145 169 146 170 // Check weeks 147 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 148 - clickOnViewWithText(R.string.range_custom) 171 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 172 + clickOnViewWithText(coreR.string.range_custom) 149 173 NavUtils.setCustomRange( 150 174 yearStarted = calendarPrevWeek.get(Calendar.YEAR), 151 175 monthStarted = calendarPrevWeek.get(Calendar.MONTH), ··· 154 178 monthEnded = calendarToday.get(Calendar.MONTH), 155 179 dayEnded = calendarToday.get(Calendar.DAY_OF_MONTH), 156 180 ) 157 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 158 - checkViewIsDisplayed(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 159 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 160 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 181 + checkViewIsDisplayed( 182 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 183 + ) 184 + checkViewIsDisplayed( 185 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 186 + ) 187 + checkViewDoesNotExist( 188 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 189 + ) 190 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 161 191 checkRangeAverages( 162 - rangeId = R.string.statistics_detail_chart_daily, 192 + rangeId = coreR.string.statistics_detail_chart_daily, 163 193 average = "45$minuteString", 164 194 averageNonEmpty = "2$hourString 0$minuteString" 165 195 ) 166 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 196 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 167 197 checkRangeAverages( 168 - rangeId = R.string.statistics_detail_chart_weekly, 198 + rangeId = coreR.string.statistics_detail_chart_weekly, 169 199 average = "3$hourString 0$minuteString", 170 200 averageNonEmpty = "3$hourString 0$minuteString" 171 201 ) 172 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 173 - checkCard(R.string.statistics_detail_total_duration, "6$hourString 0$minuteString") 174 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 202 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 203 + checkCard(coreR.string.statistics_detail_total_duration, "6$hourString 0$minuteString") 204 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 175 205 checkRecordsCard(3) 176 206 177 207 // Check months 178 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 179 - clickOnViewWithText(R.string.range_custom) 208 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 209 + clickOnViewWithText(coreR.string.range_custom) 180 210 NavUtils.setCustomRange( 181 211 yearStarted = calendarPrevMonth.get(Calendar.YEAR), 182 212 monthStarted = calendarPrevMonth.get(Calendar.MONTH), ··· 185 215 monthEnded = calendarToday.get(Calendar.MONTH), 186 216 dayEnded = calendarToday.get(Calendar.DAY_OF_MONTH), 187 217 ) 188 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 189 - checkViewIsDisplayed(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 190 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 191 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 218 + checkViewIsDisplayed( 219 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 220 + ) 221 + checkViewIsDisplayed( 222 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 223 + ) 224 + checkViewDoesNotExist( 225 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 226 + ) 227 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 192 228 checkRangeAverages( 193 - rangeId = R.string.statistics_detail_chart_daily, 229 + rangeId = coreR.string.statistics_detail_chart_daily, 194 230 average = "19$minuteString", 195 231 averageNonEmpty = "2$hourString 30$minuteString" 196 232 ) 197 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 233 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 198 234 checkRangeAverages( 199 - rangeId = R.string.statistics_detail_chart_weekly, 235 + rangeId = coreR.string.statistics_detail_chart_weekly, 200 236 average = "2$hourString 0$minuteString", 201 237 averageNonEmpty = "3$hourString 20$minuteString" 202 238 ) 203 - clickOnChartGrouping(R.string.statistics_detail_chart_monthly) 239 + clickOnChartGrouping(coreR.string.statistics_detail_chart_monthly) 204 240 checkRangeAverages( 205 - rangeId = R.string.statistics_detail_chart_monthly, 241 + rangeId = coreR.string.statistics_detail_chart_monthly, 206 242 average = "5$hourString 0$minuteString", 207 243 averageNonEmpty = "5$hourString 0$minuteString" 208 244 ) 209 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 210 - checkCard(R.string.statistics_detail_total_duration, "10$hourString 0$minuteString") 211 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 245 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 246 + checkCard(coreR.string.statistics_detail_total_duration, "10$hourString 0$minuteString") 247 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 212 248 checkRecordsCard(4) 213 249 214 250 // Check years 215 - clickOnViewWithId(R.id.btnStatisticsDetailToday) 216 - clickOnViewWithText(R.string.range_custom) 251 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailToday) 252 + clickOnViewWithText(coreR.string.range_custom) 217 253 NavUtils.setCustomRange( 218 254 yearStarted = calendarPrevYear.get(Calendar.YEAR), 219 255 monthStarted = calendarPrevYear.get(Calendar.MONTH), ··· 222 258 monthEnded = calendarToday.get(Calendar.MONTH), 223 259 dayEnded = calendarToday.get(Calendar.DAY_OF_MONTH), 224 260 ) 225 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 226 - checkViewIsDisplayed(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 227 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 228 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 261 + checkViewIsDisplayed( 262 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 263 + ) 264 + checkViewIsDisplayed( 265 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 266 + ) 267 + checkViewDoesNotExist( 268 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 269 + ) 270 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 229 271 checkRangeAverages( 230 - rangeId = R.string.statistics_detail_chart_daily, 272 + rangeId = coreR.string.statistics_detail_chart_daily, 231 273 average = "2$minuteString", 232 274 averageNonEmpty = "3$hourString 0$minuteString" 233 275 ) 234 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 276 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 235 277 checkRangeAverages( 236 - rangeId = R.string.statistics_detail_chart_weekly, 278 + rangeId = coreR.string.statistics_detail_chart_weekly, 237 279 average = "16$minuteString", 238 280 averageNonEmpty = "3$hourString 45$minuteString" 239 281 ) 240 - clickOnChartGrouping(R.string.statistics_detail_chart_monthly) 282 + clickOnChartGrouping(coreR.string.statistics_detail_chart_monthly) 241 283 checkRangeAverages( 242 - rangeId = R.string.statistics_detail_chart_monthly, 284 + rangeId = coreR.string.statistics_detail_chart_monthly, 243 285 average = "1$hourString 9$minuteString", 244 286 averageNonEmpty = "5$hourString 0$minuteString" 245 287 ) 246 - clickOnChartGrouping(R.string.statistics_detail_chart_yearly) 288 + clickOnChartGrouping(coreR.string.statistics_detail_chart_yearly) 247 289 checkRangeAverages( 248 - rangeId = R.string.statistics_detail_chart_yearly, 290 + rangeId = coreR.string.statistics_detail_chart_yearly, 249 291 average = "7$hourString 30$minuteString", 250 292 averageNonEmpty = "7$hourString 30$minuteString" 251 293 ) 252 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 253 - checkCard(R.string.statistics_detail_total_duration, "15$hourString 0$minuteString") 254 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 294 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 295 + checkCard(coreR.string.statistics_detail_total_duration, "15$hourString 0$minuteString") 296 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 255 297 checkRecordsCard(5) 256 298 } 257 299 ··· 290 332 checkPreview(color, icon, name) 291 333 292 334 // Switch range 293 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 294 - clickOnViewWithText(R.string.range_overall) 335 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 336 + clickOnViewWithText(coreR.string.range_overall) 295 337 296 338 // Check buttons 297 - checkViewDoesNotExist(allOf(withId(R.id.btnStatisticsDetailPrevious), isCompletelyDisplayed())) 298 - checkViewDoesNotExist(allOf(withId(R.id.btnStatisticsDetailNext), isCompletelyDisplayed())) 339 + checkViewDoesNotExist(allOf(withId(statisticsDetailR.id.btnStatisticsDetailPrevious), isCompletelyDisplayed())) 340 + checkViewDoesNotExist(allOf(withId(statisticsDetailR.id.btnStatisticsDetailNext), isCompletelyDisplayed())) 299 341 300 342 // Bar chart 301 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 343 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed())) 302 344 303 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 304 - clickOnViewWithText(R.string.statistics_detail_length_ten) 345 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 346 + clickOnViewWithText(coreR.string.statistics_detail_length_ten) 305 347 checkRangeAverages( 306 - rangeId = R.string.statistics_detail_chart_daily, 348 + rangeId = coreR.string.statistics_detail_chart_daily, 307 349 average = "6$minuteString", 308 350 averageNonEmpty = "1$hourString 0$minuteString" 309 351 ) 310 - clickOnViewWithText(R.string.statistics_detail_length_fifty) 352 + clickOnViewWithText(coreR.string.statistics_detail_length_fifty) 311 353 checkRangeAverages( 312 - rangeId = R.string.statistics_detail_chart_daily, 354 + rangeId = coreR.string.statistics_detail_chart_daily, 313 355 average = "1$minuteString", 314 356 averageNonEmpty = "1$hourString 0$minuteString" 315 357 ) 316 - clickOnViewWithText(R.string.statistics_detail_length_hundred) 358 + clickOnViewWithText(coreR.string.statistics_detail_length_hundred) 317 359 checkRangeAverages( 318 - rangeId = R.string.statistics_detail_chart_daily, 360 + rangeId = coreR.string.statistics_detail_chart_daily, 319 361 average = "36$secondString", 320 362 averageNonEmpty = "1$hourString 0$minuteString" 321 363 ) 322 364 323 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 324 - clickOnViewWithText(R.string.statistics_detail_length_ten) 365 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 366 + clickOnViewWithText(coreR.string.statistics_detail_length_ten) 325 367 checkRangeAverages( 326 - rangeId = R.string.statistics_detail_chart_weekly, 368 + rangeId = coreR.string.statistics_detail_chart_weekly, 327 369 average = "6$minuteString", 328 370 averageNonEmpty = "1$hourString 0$minuteString" 329 371 ) 330 - clickOnViewWithText(R.string.statistics_detail_length_fifty) 372 + clickOnViewWithText(coreR.string.statistics_detail_length_fifty) 331 373 checkRangeAverages( 332 - rangeId = R.string.statistics_detail_chart_weekly, 374 + rangeId = coreR.string.statistics_detail_chart_weekly, 333 375 average = "1$minuteString", 334 376 averageNonEmpty = "1$hourString 0$minuteString" 335 377 ) 336 - clickOnViewWithText(R.string.statistics_detail_length_hundred) 378 + clickOnViewWithText(coreR.string.statistics_detail_length_hundred) 337 379 checkRangeAverages( 338 - rangeId = R.string.statistics_detail_chart_weekly, 380 + rangeId = coreR.string.statistics_detail_chart_weekly, 339 381 average = "36$secondString", 340 382 averageNonEmpty = "1$hourString 0$minuteString" 341 383 ) 342 384 343 - clickOnChartGrouping(R.string.statistics_detail_chart_monthly) 344 - clickOnViewWithText(R.string.statistics_detail_length_ten) 385 + clickOnChartGrouping(coreR.string.statistics_detail_chart_monthly) 386 + clickOnViewWithText(coreR.string.statistics_detail_length_ten) 345 387 checkRangeAverages( 346 - rangeId = R.string.statistics_detail_chart_monthly, 388 + rangeId = coreR.string.statistics_detail_chart_monthly, 347 389 average = "6$minuteString", 348 390 averageNonEmpty = "1$hourString 0$minuteString" 349 391 ) 350 - clickOnViewWithText(R.string.statistics_detail_length_fifty) 392 + clickOnViewWithText(coreR.string.statistics_detail_length_fifty) 351 393 checkRangeAverages( 352 - rangeId = R.string.statistics_detail_chart_monthly, 394 + rangeId = coreR.string.statistics_detail_chart_monthly, 353 395 average = "1$minuteString", 354 396 averageNonEmpty = "1$hourString 0$minuteString" 355 397 ) 356 - clickOnViewWithText(R.string.statistics_detail_length_hundred) 398 + clickOnViewWithText(coreR.string.statistics_detail_length_hundred) 357 399 checkRangeAverages( 358 - rangeId = R.string.statistics_detail_chart_monthly, 400 + rangeId = coreR.string.statistics_detail_chart_monthly, 359 401 average = "36$secondString", 360 402 averageNonEmpty = "1$hourString 0$minuteString" 361 403 ) 362 404 363 - clickOnChartGrouping(R.string.statistics_detail_chart_yearly) 364 - clickOnViewWithText(R.string.statistics_detail_length_ten) 405 + clickOnChartGrouping(coreR.string.statistics_detail_chart_yearly) 406 + clickOnViewWithText(coreR.string.statistics_detail_length_ten) 365 407 checkRangeAverages( 366 - rangeId = R.string.statistics_detail_chart_yearly, 408 + rangeId = coreR.string.statistics_detail_chart_yearly, 367 409 average = "6$minuteString", 368 410 averageNonEmpty = "1$hourString 0$minuteString" 369 411 ) 370 - clickOnViewWithText(R.string.statistics_detail_length_fifty) 412 + clickOnViewWithText(coreR.string.statistics_detail_length_fifty) 371 413 checkRangeAverages( 372 - rangeId = R.string.statistics_detail_chart_yearly, 414 + rangeId = coreR.string.statistics_detail_chart_yearly, 373 415 average = "3$minuteString", 374 416 averageNonEmpty = "1$hourString 30$minuteString" 375 417 ) 376 - clickOnViewWithText(R.string.statistics_detail_length_hundred) 418 + clickOnViewWithText(coreR.string.statistics_detail_length_hundred) 377 419 checkRangeAverages( 378 - rangeId = R.string.statistics_detail_chart_yearly, 420 + rangeId = coreR.string.statistics_detail_chart_yearly, 379 421 average = "1$minuteString", 380 422 averageNonEmpty = "1$hourString 30$minuteString" 381 423 ) 382 - clickOnViewWithText(R.string.statistics_detail_length_ten) 424 + clickOnViewWithText(coreR.string.statistics_detail_length_ten) 383 425 384 426 // Cards 385 427 checkCards() 386 428 387 429 // Split chart 388 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 389 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 390 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 391 - onView(withId(R.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 392 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_hourly) 393 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_daily) 430 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 431 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 432 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 433 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 434 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_hourly) 435 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_daily) 394 436 395 437 // Duration chart 396 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 397 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 398 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 438 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 439 + checkViewIsDisplayed( 440 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 441 + ) 442 + checkViewIsDisplayed( 443 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 444 + ) 399 445 400 446 // Tag split 401 - onView(withId(R.id.rvStatisticsDetailTagSplit)).perform(nestedScrollTo()) 447 + onView(withId(statisticsDetailR.id.rvStatisticsDetailSplit)).perform(nestedScrollTo()) 402 448 checkTagItem(color, tag, "2$hourString 0$minuteString", "67%") 403 449 checkTagItem( 404 - R.color.colorUntracked, 405 - getString(R.string.change_record_untagged), 450 + viewsR.color.colorUntracked, 451 + getString(coreR.string.change_record_untagged), 406 452 "1$hourString 0$minuteString", 407 453 "33%" 408 454 ) ··· 451 497 checkPreview(color, icon, name) 452 498 453 499 // Switch range 454 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 455 - clickOnViewWithText(R.string.range_day) 500 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 501 + clickOnViewWithText(coreR.string.range_day) 456 502 457 503 // Bar chart 458 - checkViewDoesNotExist(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 459 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 460 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 461 - checkViewDoesNotExist(allOf(withId(R.id.cardStatisticsDetailRangeAverage), isCompletelyDisplayed())) 504 + checkViewDoesNotExist( 505 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 506 + ) 507 + checkViewDoesNotExist( 508 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 509 + ) 510 + checkViewDoesNotExist( 511 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 512 + ) 513 + checkViewDoesNotExist( 514 + allOf(withId(statisticsDetailR.id.cardStatisticsDetailRangeAverage), isCompletelyDisplayed()) 515 + ) 462 516 463 517 // Cards 464 518 checkCards() 465 519 466 520 // Split chart 467 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 468 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 469 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 470 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailSplitGrouping), isCompletelyDisplayed())) 521 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 522 + checkViewIsDisplayed( 523 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed()) 524 + ) 525 + checkViewIsDisplayed( 526 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed()) 527 + ) 528 + checkViewDoesNotExist( 529 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping), isCompletelyDisplayed()) 530 + ) 471 531 472 532 // Duration chart 473 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 474 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 475 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 533 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 534 + checkViewIsDisplayed( 535 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 536 + ) 537 + checkViewIsDisplayed( 538 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 539 + ) 476 540 477 541 // All records 478 542 checkAllRecords(3) 479 543 480 544 // Tag split 481 - onView(withId(R.id.rvStatisticsDetailTagSplit)).perform(nestedScrollTo()) 545 + onView(withId(statisticsDetailR.id.rvStatisticsDetailSplit)).perform(nestedScrollTo()) 482 546 checkNoTagItem(tag) 483 547 checkTagItem( 484 - R.color.colorUntracked, 485 - getString(R.string.change_record_untagged), 548 + viewsR.color.colorUntracked, 549 + getString(coreR.string.change_record_untagged), 486 550 "3$hourString 0$minuteString", 487 551 "100%" 488 552 ) 489 553 490 554 // Next day 491 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 555 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 492 556 checkEmptyStatistics() 493 557 } 494 558 ··· 533 597 checkPreview(color, icon, name) 534 598 535 599 // Switch range 536 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 537 - clickOnViewWithText(R.string.range_week) 600 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 601 + clickOnViewWithText(coreR.string.range_week) 538 602 539 603 // Bar chart 540 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 541 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 542 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 604 + checkViewIsDisplayed( 605 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 606 + ) 607 + checkViewDoesNotExist( 608 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 609 + ) 610 + checkViewDoesNotExist( 611 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 612 + ) 543 613 checkRangeAverages( 544 - rangeId = R.string.statistics_detail_chart_daily, 614 + rangeId = coreR.string.statistics_detail_chart_daily, 545 615 average = "25$minuteString", 546 616 averageNonEmpty = "3$hourString 0$minuteString" 547 617 ) 548 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 618 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 549 619 checkRangeAverages( 550 - rangeId = R.string.statistics_detail_chart_daily, 620 + rangeId = coreR.string.statistics_detail_chart_daily, 551 621 average = "8$minuteString", 552 622 averageNonEmpty = "1$hourString 0$minuteString" 553 623 ) 554 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 624 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 555 625 556 626 // Cards 557 627 checkCards() 558 628 559 629 // Split chart 560 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 561 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 562 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 563 - onView(withId(R.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 564 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_hourly) 565 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_daily) 630 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 631 + checkViewIsDisplayed( 632 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed()) 633 + ) 634 + checkViewIsDisplayed( 635 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed()) 636 + ) 637 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 638 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_hourly) 639 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_daily) 566 640 567 641 // Duration chart 568 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 569 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 570 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 642 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 643 + checkViewIsDisplayed( 644 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 645 + ) 646 + checkViewIsDisplayed( 647 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 648 + ) 571 649 572 650 // All records 573 651 checkAllRecords(3) 574 652 575 653 // Tag split 576 - onView(withId(R.id.rvStatisticsDetailTagSplit)).perform(nestedScrollTo()) 654 + onView(withId(statisticsDetailR.id.rvStatisticsDetailSplit)).perform(nestedScrollTo()) 577 655 checkTagItem(color, tag, "3$hourString 0$minuteString", "100%") 578 - checkNoTagItem(getString(R.string.change_record_untagged)) 656 + checkNoTagItem(getString(coreR.string.change_record_untagged)) 579 657 580 658 // Next week 581 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 659 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 582 660 checkEmptyStatistics() 583 661 } 584 662 ··· 625 703 checkPreview(color, icon, name) 626 704 627 705 // Switch range 628 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 629 - clickOnViewWithText(R.string.range_month) 706 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 707 + clickOnViewWithText(coreR.string.range_month) 630 708 631 709 // Bar chart 632 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 633 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 710 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed())) 711 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 634 712 checkRangeAverages( 635 - rangeId = R.string.statistics_detail_chart_daily, 713 + rangeId = coreR.string.statistics_detail_chart_daily, 636 714 checkAverage = false, 637 715 averageNonEmpty = "3$hourString 0$minuteString" 638 716 ) 639 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 717 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 640 718 checkRangeAverages( 641 - rangeId = R.string.statistics_detail_chart_weekly, 719 + rangeId = coreR.string.statistics_detail_chart_weekly, 642 720 checkAverage = false, 643 721 averageNonEmpty = "3$hourString 0$minuteString" 644 722 ) 645 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 646 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 723 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 724 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 647 725 checkRangeAverages( 648 - rangeId = R.string.statistics_detail_chart_daily, 726 + rangeId = coreR.string.statistics_detail_chart_daily, 649 727 checkAverage = false, 650 728 averageNonEmpty = "1$hourString 0$minuteString" 651 729 ) 652 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 730 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 653 731 checkRangeAverages( 654 - rangeId = R.string.statistics_detail_chart_weekly, 732 + rangeId = coreR.string.statistics_detail_chart_weekly, 655 733 checkAverage = false, 656 734 averageNonEmpty = "1$hourString 0$minuteString" 657 735 ) 658 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 659 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 660 - checkViewDoesNotExist(allOf(withText(R.string.statistics_detail_chart_monthly), isCompletelyDisplayed())) 661 - checkViewDoesNotExist(allOf(withText(R.string.statistics_detail_chart_yearly), isCompletelyDisplayed())) 662 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 736 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 737 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 738 + checkViewDoesNotExist( 739 + allOf(withText(coreR.string.statistics_detail_chart_monthly), isCompletelyDisplayed()) 740 + ) 741 + checkViewDoesNotExist( 742 + allOf(withText(coreR.string.statistics_detail_chart_yearly), isCompletelyDisplayed()) 743 + ) 744 + checkViewDoesNotExist( 745 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 746 + ) 663 747 664 748 // Cards 665 749 checkCards() 666 750 667 751 // Split chart 668 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 669 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 670 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 671 - onView(withId(R.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 672 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_hourly) 673 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_daily) 752 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 753 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 754 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 755 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 756 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_hourly) 757 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_daily) 674 758 675 759 // Duration chart 676 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 677 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 678 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 760 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 761 + checkViewIsDisplayed( 762 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 763 + ) 764 + checkViewIsDisplayed( 765 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 766 + ) 679 767 680 768 // All records 681 769 checkAllRecords(3) 682 770 683 771 // Tag split 684 - onView(withId(R.id.rvStatisticsDetailTagSplit)).perform(nestedScrollTo()) 772 + onView(withId(statisticsDetailR.id.rvStatisticsDetailSplit)).perform(nestedScrollTo()) 685 773 checkTagItem(color, tag1, "1$hourString 0$minuteString", "33%") 686 774 checkTagItem(color, tag2, "2$hourString 0$minuteString", "67%") 687 775 checkNoTagItem("Untagged") 688 776 689 777 // Next month 690 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 778 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 691 779 checkEmptyStatistics() 692 780 } 693 781 ··· 728 816 checkPreview(color, icon, name) 729 817 730 818 // Switch range 731 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 732 - clickOnViewWithText(R.string.range_year) 819 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 820 + clickOnViewWithText(coreR.string.range_year) 733 821 734 822 // Bar chart 735 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 736 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 823 + checkViewIsDisplayed(allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed())) 824 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 737 825 checkRangeAverages( 738 - rangeId = R.string.statistics_detail_chart_daily, 826 + rangeId = coreR.string.statistics_detail_chart_daily, 739 827 checkAverage = false, 740 828 averageNonEmpty = "3$hourString 0$minuteString" 741 829 ) 742 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 830 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 743 831 checkRangeAverages( 744 - rangeId = R.string.statistics_detail_chart_weekly, 832 + rangeId = coreR.string.statistics_detail_chart_weekly, 745 833 checkAverage = false, 746 834 averageNonEmpty = "3$hourString 0$minuteString" 747 835 ) 748 - clickOnChartGrouping(R.string.statistics_detail_chart_monthly) 836 + clickOnChartGrouping(coreR.string.statistics_detail_chart_monthly) 749 837 checkRangeAverages( 750 - rangeId = R.string.statistics_detail_chart_monthly, 838 + rangeId = coreR.string.statistics_detail_chart_monthly, 751 839 average = "15$minuteString", 752 840 averageNonEmpty = "3$hourString 0$minuteString" 753 841 ) 754 - clickOnViewWithId(R.id.btnStatisticsDetailPrevious) 755 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 842 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailPrevious) 843 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 756 844 checkRangeAverages( 757 - rangeId = R.string.statistics_detail_chart_daily, 845 + rangeId = coreR.string.statistics_detail_chart_daily, 758 846 checkAverage = false, 759 847 averageNonEmpty = "1$hourString 0$minuteString" 760 848 ) 761 - clickOnChartGrouping(R.string.statistics_detail_chart_weekly) 849 + clickOnChartGrouping(coreR.string.statistics_detail_chart_weekly) 762 850 checkRangeAverages( 763 - rangeId = R.string.statistics_detail_chart_weekly, 851 + rangeId = coreR.string.statistics_detail_chart_weekly, 764 852 checkAverage = false, 765 853 averageNonEmpty = "1$hourString 0$minuteString" 766 854 ) 767 - clickOnChartGrouping(R.string.statistics_detail_chart_monthly) 855 + clickOnChartGrouping(coreR.string.statistics_detail_chart_monthly) 768 856 checkRangeAverages( 769 - rangeId = R.string.statistics_detail_chart_monthly, 857 + rangeId = coreR.string.statistics_detail_chart_monthly, 770 858 average = "5$minuteString", 771 859 averageNonEmpty = "1$hourString 0$minuteString" 772 860 ) 773 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 774 - clickOnChartGrouping(R.string.statistics_detail_chart_daily) 775 - checkViewDoesNotExist(allOf(withText(R.string.statistics_detail_chart_yearly), isCompletelyDisplayed())) 776 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 861 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 862 + clickOnChartGrouping(coreR.string.statistics_detail_chart_daily) 863 + checkViewDoesNotExist( 864 + allOf(withText(coreR.string.statistics_detail_chart_yearly), isCompletelyDisplayed()) 865 + ) 866 + checkViewDoesNotExist( 867 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 868 + ) 777 869 778 870 // Cards 779 871 checkCards() 780 872 781 873 // Split chart 782 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 783 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 784 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 785 - onView(withId(R.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 786 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_hourly) 787 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_daily) 874 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 875 + checkViewIsDisplayed( 876 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed()) 877 + ) 878 + checkViewIsDisplayed( 879 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed()) 880 + ) 881 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 882 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_hourly) 883 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_daily) 788 884 789 885 // Duration chart 790 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 791 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 792 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 886 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 887 + checkViewIsDisplayed( 888 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 889 + ) 890 + checkViewIsDisplayed( 891 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 892 + ) 793 893 794 894 // All records 795 895 checkAllRecords(3) 796 896 797 897 // Next year 798 - clickOnViewWithId(R.id.btnStatisticsDetailNext) 898 + clickOnViewWithId(statisticsDetailR.id.btnStatisticsDetailNext) 799 899 checkEmptyStatistics() 800 900 } 801 901 ··· 842 942 checkPreview(color, icon, name) 843 943 844 944 // Switch range 845 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 846 - clickOnViewWithText(R.string.range_last) 945 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 946 + clickOnViewWithText(coreR.string.range_last) 847 947 848 948 // Bar chart 849 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetail), isCompletelyDisplayed())) 850 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed())) 851 - checkViewDoesNotExist(allOf(withId(R.id.buttonsStatisticsDetailLength), isCompletelyDisplayed())) 949 + checkViewIsDisplayed( 950 + allOf(withId(statisticsDetailR.id.chartStatisticsDetail), isCompletelyDisplayed()) 951 + ) 952 + checkViewDoesNotExist( 953 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping), isCompletelyDisplayed()) 954 + ) 955 + checkViewDoesNotExist( 956 + allOf(withId(statisticsDetailR.id.buttonsStatisticsDetailLength), isCompletelyDisplayed()) 957 + ) 852 958 checkRangeAverages( 853 - rangeId = R.string.statistics_detail_chart_daily, 959 + rangeId = coreR.string.statistics_detail_chart_daily, 854 960 average = "25$minuteString", 855 961 averageNonEmpty = "1$hourString 30$minuteString" 856 962 ) ··· 859 965 checkCards() 860 966 861 967 // Split chart 862 - onView(withId(R.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 863 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailSplit), isCompletelyDisplayed())) 864 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed())) 865 - onView(withId(R.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 866 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_hourly) 867 - clickOnSplitChartGrouping(R.string.statistics_detail_chart_daily) 968 + onView(withId(statisticsDetailR.id.chartStatisticsDetailSplit)).perform(nestedScrollTo()) 969 + checkViewIsDisplayed( 970 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailSplit), isCompletelyDisplayed()) 971 + ) 972 + checkViewIsDisplayed( 973 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailSplitHint), isCompletelyDisplayed()) 974 + ) 975 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)).perform(nestedScrollTo()) 976 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_hourly) 977 + clickOnSplitChartGrouping(coreR.string.statistics_detail_chart_daily) 868 978 869 979 // Duration chart 870 - onView(withId(R.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 871 - checkViewIsDisplayed(allOf(withId(R.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed())) 872 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed())) 980 + onView(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit)).perform(nestedScrollTo()) 981 + checkViewIsDisplayed( 982 + allOf(withId(statisticsDetailR.id.chartStatisticsDetailDurationSplit), isCompletelyDisplayed()) 983 + ) 984 + checkViewIsDisplayed( 985 + allOf(withId(statisticsDetailR.id.tvStatisticsDetailDurationSplitHint), isCompletelyDisplayed()) 986 + ) 873 987 874 988 // All records 875 989 checkAllRecords(4) 876 990 877 991 // Tag split 878 - onView(withId(R.id.rvStatisticsDetailTagSplit)).perform(nestedScrollTo()) 992 + onView(withId(statisticsDetailR.id.rvStatisticsDetailSplit)).perform(nestedScrollTo()) 879 993 checkTagItem(color, tag, "3$hourString 0$minuteString", "100%") 880 - checkNoTagItem(getString(R.string.change_record_untagged)) 994 + checkNoTagItem(getString(coreR.string.change_record_untagged)) 881 995 } 882 996 883 997 @Test ··· 896 1010 // Check detailed statistics 897 1011 NavUtils.openStatisticsScreen() 898 1012 tryAction { clickOnView(allOf(withText(name1), isCompletelyDisplayed())) } 899 - checkViewIsDisplayed(allOf(withId(R.id.viewStatisticsDetailItem), hasDescendant(withText(name1)))) 1013 + checkViewIsDisplayed( 1014 + allOf(withId(statisticsDetailR.id.viewStatisticsDetailItem), hasDescendant(withText(name1))) 1015 + ) 900 1016 checkRecordsCard(1) 901 1017 902 1018 // Change filter 903 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 904 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 1019 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1020 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 905 1021 pressBack() 906 1022 907 1023 // Check detailed statistics 908 1024 checkRecordsCard(2) 909 1025 910 1026 // Change filter 911 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 912 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 913 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 1027 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1028 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 1029 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 914 1030 pressBack() 915 1031 916 1032 // Check detailed statistics ··· 942 1058 943 1059 // Check detailed statistics 944 1060 NavUtils.openStatisticsScreen() 945 - tryAction { clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) } 946 - clickOnViewWithText(R.string.category_hint) 1061 + tryAction { clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) } 1062 + clickOnViewWithText(coreR.string.category_hint) 947 1063 pressBack() 948 1064 tryAction { clickOnView(allOf(withText(categoryName1), isCompletelyDisplayed())) } 949 - checkViewIsDisplayed(allOf(withId(R.id.viewStatisticsDetailItem), hasDescendant(withText(categoryName1)))) 1065 + checkViewIsDisplayed( 1066 + allOf(withId(statisticsDetailR.id.viewStatisticsDetailItem), hasDescendant(withText(categoryName1))) 1067 + ) 950 1068 checkRecordsCard(2) 951 1069 952 1070 // Change filter 953 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 954 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(categoryName2))) 1071 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1072 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(categoryName2))) 955 1073 pressBack() 956 1074 957 1075 // Check detailed statistics 958 1076 checkRecordsCard(3) 959 1077 960 1078 // Change filter 961 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 962 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(categoryName1))) 963 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(categoryName2))) 1079 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1080 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(categoryName1))) 1081 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(categoryName2))) 964 1082 pressBack() 965 1083 966 1084 // Check detailed statistics ··· 992 1110 // Check detailed statistics 993 1111 NavUtils.openStatisticsScreen() 994 1112 tryAction { clickOnView(allOf(withText(name1), isCompletelyDisplayed())) } 995 - checkViewIsDisplayed(allOf(withId(R.id.viewStatisticsDetailItem), hasDescendant(withText(name1)))) 1113 + checkViewIsDisplayed( 1114 + allOf(withId(statisticsDetailR.id.viewStatisticsDetailItem), hasDescendant(withText(name1))) 1115 + ) 996 1116 checkRecordsCard(7) 997 1117 998 1118 // Filter untagged records 999 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1000 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(R.string.change_record_untagged))) 1119 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1120 + clickOnView( 1121 + allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(coreR.string.change_record_untagged)) 1122 + ) 1001 1123 pressBack() 1002 1124 checkRecordsCard(6) 1003 1125 1004 1126 // Change filter 1005 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1006 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag1))) 1127 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1128 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag1))) 1007 1129 pressBack() 1008 1130 checkRecordsCard(2) 1009 1131 1010 1132 // Change filter 1011 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1012 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag2))) 1133 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1134 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag2))) 1013 1135 pressBack() 1014 1136 checkRecordsCard(1) 1015 1137 1016 1138 // Change filter 1017 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1018 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag3))) 1139 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1140 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag3))) 1019 1141 pressBack() 1020 1142 checkRecordsCard(0) 1021 1143 1022 1144 // Change filter 1023 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1024 - clickOnViewWithText(R.string.types_filter_show_all) 1025 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag3))) 1145 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1146 + clickOnViewWithText(coreR.string.types_filter_show_all) 1147 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag3))) 1026 1148 pressBack() 1027 1149 checkRecordsCard(4) 1028 1150 1029 1151 // Change filter 1030 - clickOnViewWithId(R.id.cardStatisticsDetailFilter) 1031 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag1))) 1152 + clickOnViewWithId(statisticsDetailR.id.cardStatisticsDetailFilter) 1153 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag1))) 1032 1154 pressBack() 1033 1155 checkRecordsCard(2) 1034 1156 } ··· 1044 1166 // Open stat detail 1045 1167 NavUtils.openStatisticsScreen() 1046 1168 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 1047 - checkViewIsDisplayed(allOf(withText(R.string.title_today), isCompletelyDisplayed())) 1169 + checkViewIsDisplayed(allOf(withText(coreR.string.title_today), isCompletelyDisplayed())) 1048 1170 1049 1171 // Change range 1050 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 1051 - clickOnViewWithText(R.string.range_week) 1052 - checkViewIsDisplayed(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 1172 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 1173 + clickOnViewWithText(coreR.string.range_week) 1174 + checkViewIsDisplayed(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 1053 1175 pressBack() 1054 1176 1055 1177 // Range saved 1056 1178 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 1057 - checkViewIsDisplayed(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 1179 + checkViewIsDisplayed(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 1058 1180 } 1059 1181 1060 1182 @Test ··· 1090 1212 // Check detailed statistics 1091 1213 NavUtils.openStatisticsScreen() 1092 1214 tryAction { clickOnView(allOf(withText(name), isCompletelyDisplayed())) } 1093 - clickOnViewWithIdOnPager(R.id.btnStatisticsDetailToday) 1094 - clickOnViewWithText(R.string.range_overall) 1215 + clickOnViewWithIdOnPager(statisticsDetailR.id.btnStatisticsDetailToday) 1216 + clickOnViewWithText(coreR.string.range_overall) 1095 1217 1096 - onView(withId(R.id.cardStatisticsDetailStreaks)).perform(nestedScrollTo()) 1097 - checkCard(R.string.statistics_detail_streaks_longest, "5") 1098 - checkCard(R.string.statistics_detail_streaks_current, "3") 1218 + onView(withId(statisticsDetailR.id.cardStatisticsDetailStreaks)).perform(nestedScrollTo()) 1219 + checkCard(coreR.string.statistics_detail_streaks_longest, "5") 1220 + checkCard(coreR.string.statistics_detail_streaks_current, "3") 1099 1221 1100 1222 // Streak type 1101 - onView(withId(R.id.buttonsStatisticsDetailStreaksType)).perform(nestedScrollTo()) 1223 + onView(withId(statisticsDetailR.id.buttonsStatisticsDetailStreaksType)).perform(nestedScrollTo()) 1102 1224 clickOnView( 1103 1225 allOf( 1104 - withText(R.string.statistics_detail_streaks_longest), 1105 - isDescendantOfA(withId(R.id.buttonsStatisticsDetailStreaksType)) 1226 + withText(coreR.string.statistics_detail_streaks_longest), 1227 + isDescendantOfA(withId(statisticsDetailR.id.buttonsStatisticsDetailStreaksType)) 1106 1228 ) 1107 1229 ) 1108 1230 clickOnView( 1109 1231 allOf( 1110 - withText(R.string.statistics_detail_streaks_latest), 1111 - isDescendantOfA(withId(R.id.buttonsStatisticsDetailStreaksType)) 1232 + withText(coreR.string.statistics_detail_streaks_latest), 1233 + isDescendantOfA(withId(statisticsDetailR.id.buttonsStatisticsDetailStreaksType)) 1112 1234 ) 1113 1235 ) 1114 1236 } ··· 1116 1238 private fun checkPreview(color: Int, icon: Int, name: String) { 1117 1239 checkViewIsDisplayed( 1118 1240 allOf( 1119 - withId(R.id.viewStatisticsDetailItem), 1241 + withId(statisticsDetailR.id.viewStatisticsDetailItem), 1120 1242 withCardColor(color), 1121 1243 hasDescendant(withTag(icon)), 1122 1244 hasDescendant(withText(name)), ··· 1128 1250 private fun clickOnChartGrouping(withTextId: Int) { 1129 1251 clickOnView( 1130 1252 allOf( 1131 - isDescendantOfA(withId(R.id.buttonsStatisticsDetailGrouping)), 1253 + isDescendantOfA(withId(statisticsDetailR.id.buttonsStatisticsDetailGrouping)), 1132 1254 withText(withTextId) 1133 1255 ) 1134 1256 ) ··· 1137 1259 private fun clickOnSplitChartGrouping(withTextId: Int) { 1138 1260 clickOnView( 1139 1261 allOf( 1140 - isDescendantOfA(withId(R.id.buttonsStatisticsDetailSplitGrouping)), 1262 + isDescendantOfA(withId(statisticsDetailR.id.buttonsStatisticsDetailSplitGrouping)), 1141 1263 withText(withTextId) 1142 1264 ) 1143 1265 ) ··· 1156 1278 private fun checkRecordsCard(count: Int) { 1157 1279 checkViewIsDisplayed( 1158 1280 allOf( 1159 - withPluralText(R.plurals.statistics_detail_times_tracked, count), 1281 + withPluralText(coreR.plurals.statistics_detail_times_tracked, count), 1160 1282 hasSibling(withText(count.toString())), 1161 1283 isCompletelyDisplayed() 1162 1284 ) ··· 1164 1286 } 1165 1287 1166 1288 private fun checkCards() { 1167 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 1168 - checkCard(R.string.statistics_detail_total_duration, "3$hourString 0$minuteString") 1289 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 1290 + checkCard(coreR.string.statistics_detail_total_duration, "3$hourString 0$minuteString") 1169 1291 1170 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 1292 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 1171 1293 checkRecordsCard(2) 1172 1294 1173 - onView(withId(R.id.cardStatisticsDetailAverage)).perform(nestedScrollTo()) 1174 - checkCard(R.string.statistics_detail_shortest_record, "1$hourString 0$minuteString") 1175 - checkCard(R.string.statistics_detail_average_record, "1$hourString 30$minuteString") 1176 - checkCard(R.string.statistics_detail_longest_record, "2$hourString 0$minuteString") 1295 + onView(withId(statisticsDetailR.id.cardStatisticsDetailAverage)).perform(nestedScrollTo()) 1296 + checkCard(coreR.string.statistics_detail_shortest_record, "1$hourString 0$minuteString") 1297 + checkCard(coreR.string.statistics_detail_average_record, "1$hourString 30$minuteString") 1298 + checkCard(coreR.string.statistics_detail_longest_record, "2$hourString 0$minuteString") 1177 1299 1178 - onView(withId(R.id.cardStatisticsDetailDates)).perform(nestedScrollTo()) 1179 - checkViewIsDisplayed(withText(R.string.statistics_detail_first_record)) 1180 - checkViewIsDisplayed(withText(R.string.statistics_detail_last_record)) 1300 + onView(withId(statisticsDetailR.id.cardStatisticsDetailDates)).perform(nestedScrollTo()) 1301 + checkViewIsDisplayed(withText(coreR.string.statistics_detail_first_record)) 1302 + checkViewIsDisplayed(withText(coreR.string.statistics_detail_last_record)) 1181 1303 } 1182 1304 1183 1305 private fun checkRangeAverages( ··· 1187 1309 averageNonEmpty: String, 1188 1310 ) { 1189 1311 val range = getString(rangeId) 1190 - val title = getString(R.string.statistics_detail_range_averages_title, range) 1312 + val title = getString(coreR.string.statistics_detail_range_averages_title, range) 1191 1313 1192 1314 checkViewIsDisplayed( 1193 1315 allOf( 1194 - withId(R.id.cardStatisticsDetailRangeAverage), 1316 + withId(statisticsDetailR.id.cardStatisticsDetailRangeAverage), 1195 1317 hasDescendant(withText(title)), 1196 1318 if (checkAverage) { 1197 1319 hasDescendant( 1198 1320 allOf( 1199 - withText(R.string.statistics_detail_range_averages), 1321 + withText(coreR.string.statistics_detail_range_averages), 1200 1322 hasSibling(withText(average)), 1201 1323 ) 1202 1324 ) ··· 1205 1327 }, 1206 1328 hasDescendant( 1207 1329 allOf( 1208 - withText(R.string.statistics_detail_range_averages_non_empty), 1330 + withText(coreR.string.statistics_detail_range_averages_non_empty), 1209 1331 hasSibling(withText(averageNonEmpty)), 1210 1332 ) 1211 1333 ), ··· 1215 1337 } 1216 1338 1217 1339 private fun checkEmptyStatistics() { 1218 - onView(withId(R.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 1219 - checkCard(R.string.statistics_detail_total_duration, "0$secondString") 1340 + onView(withId(statisticsDetailR.id.cardStatisticsDetailTotal)).perform(nestedScrollTo()) 1341 + checkCard(coreR.string.statistics_detail_total_duration, "0$secondString") 1220 1342 1221 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 1343 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 1222 1344 checkRecordsCard(0) 1223 1345 1224 - onView(withId(R.id.cardStatisticsDetailAverage)).perform(nestedScrollTo()) 1225 - checkCard(R.string.statistics_detail_shortest_record, "-") 1226 - checkCard(R.string.statistics_detail_average_record, "-") 1346 + onView(withId(statisticsDetailR.id.cardStatisticsDetailAverage)).perform(nestedScrollTo()) 1347 + checkCard(coreR.string.statistics_detail_shortest_record, "-") 1348 + checkCard(coreR.string.statistics_detail_average_record, "-") 1227 1349 checkViewIsDisplayed( 1228 1350 allOf( 1229 - isDescendantOfA(withId(R.id.cardStatisticsDetailAverage)), 1230 - withText(R.string.statistics_detail_longest_record), 1351 + isDescendantOfA(withId(statisticsDetailR.id.cardStatisticsDetailAverage)), 1352 + withText(coreR.string.statistics_detail_longest_record), 1231 1353 hasSibling(withText("-")), 1232 1354 isCompletelyDisplayed() 1233 1355 ) 1234 1356 ) 1235 1357 1236 - onView(withId(R.id.cardStatisticsDetailDates)).perform(nestedScrollTo()) 1237 - checkCard(R.string.statistics_detail_first_record, "-") 1238 - checkCard(R.string.statistics_detail_last_record, "-") 1358 + onView(withId(statisticsDetailR.id.cardStatisticsDetailDates)).perform(nestedScrollTo()) 1359 + checkCard(coreR.string.statistics_detail_first_record, "-") 1360 + checkCard(coreR.string.statistics_detail_last_record, "-") 1239 1361 1240 - checkViewIsNotDisplayed(withId(R.id.rvStatisticsDetailTagSplit)) 1362 + checkViewIsNotDisplayed(withId(statisticsDetailR.id.rvStatisticsDetailSplit)) 1241 1363 } 1242 1364 1243 1365 private fun checkAllRecords(count: Int) { 1244 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 1245 - tryAction { onView(withId(R.id.rvRecordsAllList)).check(recyclerItemCount(count)) } 1366 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 1367 + tryAction { onView(withId(recordsAllR.id.rvRecordsAllList)).check(recyclerItemCount(count)) } 1246 1368 pressBack() 1247 1369 } 1248 1370 1249 1371 private fun checkTagItem(color: Int, name: String, duration: String, percentage: String) { 1250 1372 checkViewIsDisplayed( 1251 1373 allOf( 1252 - withId(R.id.viewStatisticsTagItem), 1374 + withId(baseR.id.viewStatisticsTagItem), 1253 1375 withCardColor(color), 1254 1376 hasDescendant(withText(name)), 1255 1377 hasDescendant(withText(duration)), ··· 1261 1383 private fun checkNoTagItem(name: String) { 1262 1384 checkViewDoesNotExist( 1263 1385 allOf( 1264 - withId(R.id.viewStatisticsTagItem), 1386 + withId(baseR.id.viewStatisticsTagItem), 1265 1387 hasDescendant(withText(name)) 1266 1388 ) 1267 1389 )
+65 -44
app/src/androidTest/java/com/example/util/simpletimetracker/StatisticsFilterTest.kt
··· 18 18 import org.hamcrest.CoreMatchers.allOf 19 19 import org.junit.Test 20 20 import org.junit.runner.RunWith 21 + import com.example.util.simpletimetracker.core.R as coreR 22 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 23 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 21 24 22 25 @HiltAndroidTest 23 26 @RunWith(AndroidJUnit4::class) ··· 40 43 NavUtils.openStatisticsScreen() 41 44 42 45 // All records displayed 43 - checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 46 + checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 44 47 checkViewIsDisplayed(allOf(withText(name1), isCompletelyDisplayed())) 45 48 checkViewIsDisplayed(allOf(withText(name2), isCompletelyDisplayed())) 46 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 49 + checkViewIsDisplayed( 50 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 51 + ) 47 52 48 53 // Filter untracked 49 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 50 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(R.string.untracked_time_name))) 54 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 55 + clickOnView( 56 + allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(coreR.string.untracked_time_name)) 57 + ) 51 58 pressBack() 52 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 59 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 53 60 checkViewIsDisplayed(allOf(withText(name1), isCompletelyDisplayed())) 54 61 checkViewIsDisplayed(allOf(withText(name2), isCompletelyDisplayed())) 55 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 62 + checkViewIsDisplayed( 63 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 64 + ) 56 65 57 66 // Filter activity 58 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 59 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))) 67 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 68 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name1))) 60 69 pressBack() 61 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 70 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 62 71 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 63 72 checkViewIsDisplayed(allOf(withText(name2), isCompletelyDisplayed())) 64 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("1$hourString 0$minuteString"))) 73 + checkViewIsDisplayed( 74 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("1$hourString 0$minuteString")) 75 + ) 65 76 66 77 // Filter all 67 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 68 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name2))) 78 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 79 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), withText(name2))) 69 80 pressBack() 70 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 81 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 71 82 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 72 83 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 73 - checkViewDoesNotExist(allOf(withId(R.id.tvStatisticsInfoText), isCompletelyDisplayed())) 74 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 84 + checkViewDoesNotExist(allOf(withId(statisticsR.id.tvStatisticsInfoText), isCompletelyDisplayed())) 85 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 75 86 76 87 // Show all 77 - clickOnViewWithIdOnPager(R.id.btnStatisticsEmptyFilter) 78 - clickOnViewWithText(R.string.types_filter_show_all) 88 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsEmptyFilter) 89 + clickOnViewWithText(coreR.string.types_filter_show_all) 79 90 pressBack() 80 - tryAction { checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 91 + tryAction { checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 81 92 checkViewIsDisplayed(allOf(withText(name1), isCompletelyDisplayed())) 82 93 checkViewIsDisplayed(allOf(withText(name2), isCompletelyDisplayed())) 83 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 94 + checkViewIsDisplayed( 95 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 96 + ) 84 97 85 98 // Hide all 86 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 87 - clickOnViewWithText(R.string.types_filter_hide_all) 99 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 100 + clickOnViewWithText(coreR.string.types_filter_hide_all) 88 101 pressBack() 89 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 102 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 90 103 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 91 104 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 92 - checkViewDoesNotExist(allOf(withId(R.id.tvStatisticsInfoText), isCompletelyDisplayed())) 93 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 105 + checkViewDoesNotExist(allOf(withId(statisticsR.id.tvStatisticsInfoText), isCompletelyDisplayed())) 106 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 94 107 } 95 108 96 109 @Test ··· 114 127 NavUtils.openStatisticsScreen() 115 128 116 129 // All records displayed 117 - checkViewIsDisplayed(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) 130 + checkViewIsDisplayed(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) 118 131 checkViewIsDisplayed(allOf(withText(name1), isCompletelyDisplayed())) 119 132 checkViewIsDisplayed(allOf(withText(name2), isCompletelyDisplayed())) 120 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 133 + checkViewIsDisplayed( 134 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 135 + ) 121 136 122 137 // Switch filter 123 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 124 - clickOnViewWithText(R.string.category_hint) 138 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 139 + clickOnViewWithText(coreR.string.category_hint) 125 140 pressBack() 126 141 127 142 // All tags displayed 128 - tryAction { checkViewDoesNotExist(allOf(withText(R.string.untracked_time_name), isCompletelyDisplayed())) } 143 + tryAction { checkViewDoesNotExist(allOf(withText(coreR.string.untracked_time_name), isCompletelyDisplayed())) } 129 144 checkViewIsDisplayed(allOf(withText(tag1), isCompletelyDisplayed())) 130 145 checkViewIsDisplayed(allOf(withText(tag2), isCompletelyDisplayed())) 131 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 146 + checkViewIsDisplayed( 147 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 148 + ) 132 149 133 150 // Filter tag 134 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 135 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag1))) 151 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 152 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag1))) 136 153 pressBack() 137 154 tryAction { checkViewDoesNotExist(allOf(withText(tag1), isCompletelyDisplayed())) } 138 155 checkViewIsDisplayed(allOf(withText(tag2), isCompletelyDisplayed())) 139 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("1$hourString 0$minuteString"))) 156 + checkViewIsDisplayed( 157 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("1$hourString 0$minuteString")) 158 + ) 140 159 141 160 // Filter all 142 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 143 - clickOnView(allOf(isDescendantOfA(withId(R.id.viewCategoryItem)), withText(tag2))) 161 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 162 + clickOnView(allOf(isDescendantOfA(withId(baseR.id.viewCategoryItem)), withText(tag2))) 144 163 pressBack() 145 164 tryAction { checkViewDoesNotExist(allOf(withText(tag1), isCompletelyDisplayed())) } 146 165 checkViewDoesNotExist(allOf(withText(tag2), isCompletelyDisplayed())) 147 - checkViewDoesNotExist(allOf(withId(R.id.tvStatisticsInfoText), isCompletelyDisplayed())) 148 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 166 + checkViewDoesNotExist(allOf(withId(statisticsR.id.tvStatisticsInfoText), isCompletelyDisplayed())) 167 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 149 168 150 169 // Show all 151 - clickOnViewWithIdOnPager(R.id.btnStatisticsEmptyFilter) 152 - clickOnViewWithText(R.string.types_filter_show_all) 170 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsEmptyFilter) 171 + clickOnViewWithText(coreR.string.types_filter_show_all) 153 172 pressBack() 154 173 tryAction { checkViewIsDisplayed(allOf(withText(tag1), isCompletelyDisplayed())) } 155 174 checkViewIsDisplayed(allOf(withText(tag2), isCompletelyDisplayed())) 156 - checkViewIsDisplayed(allOf(withId(R.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString"))) 175 + checkViewIsDisplayed( 176 + allOf(withId(statisticsR.id.tvStatisticsInfoText), withText("2$hourString 0$minuteString")) 177 + ) 157 178 158 179 // Hide all 159 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 160 - clickOnViewWithText(R.string.types_filter_hide_all) 180 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 181 + clickOnViewWithText(coreR.string.types_filter_hide_all) 161 182 pressBack() 162 183 tryAction { checkViewDoesNotExist(allOf(withText(tag1), isCompletelyDisplayed())) } 163 184 checkViewDoesNotExist(allOf(withText(tag2), isCompletelyDisplayed())) 164 - checkViewDoesNotExist(allOf(withId(R.id.tvStatisticsInfoText), isCompletelyDisplayed())) 165 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 185 + checkViewDoesNotExist(allOf(withId(statisticsR.id.tvStatisticsInfoText), isCompletelyDisplayed())) 186 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 166 187 } 167 188 }
+195 -185
app/src/androidTest/java/com/example/util/simpletimetracker/StatisticsRangesTest.kt
··· 23 23 import com.example.util.simpletimetracker.utils.longClickOnViewWithId 24 24 import com.example.util.simpletimetracker.utils.tryAction 25 25 import dagger.hilt.android.testing.HiltAndroidTest 26 - import org.hamcrest.CoreMatchers.allOf 27 - import org.hamcrest.CoreMatchers.equalTo 28 - import org.junit.Test 29 - import org.junit.runner.RunWith 30 26 import java.text.SimpleDateFormat 31 27 import java.util.Calendar 32 28 import java.util.Locale 33 29 import java.util.concurrent.TimeUnit 30 + import org.hamcrest.CoreMatchers.allOf 31 + import org.hamcrest.CoreMatchers.equalTo 32 + import org.junit.Test 33 + import org.junit.runner.RunWith 34 + import com.example.util.simpletimetracker.core.R as coreR 35 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 36 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 37 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 34 38 35 39 @HiltAndroidTest 36 40 @RunWith(AndroidJUnit4::class) ··· 51 55 52 56 // Statistics day range 53 57 NavUtils.openStatisticsScreen() 54 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 55 - clickOnViewWithText(R.string.range_day) 58 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 59 + clickOnViewWithText(coreR.string.range_day) 56 60 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 57 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 58 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 59 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 60 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 61 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 62 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 63 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 61 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 62 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 63 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 64 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 65 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 66 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 67 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 64 68 65 69 // Switch to week range 66 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 67 - checkViewIsDisplayed(withText(R.string.range_select_day)) 68 - clickOnViewWithText(R.string.range_week) 70 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 71 + checkViewIsDisplayed(withText(coreR.string.range_select_day)) 72 + clickOnViewWithText(coreR.string.range_week) 69 73 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 70 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 71 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 72 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 73 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 74 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 75 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 76 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 74 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 75 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 76 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 77 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 78 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 79 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 80 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 77 81 78 82 // Switch to month range 79 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 80 - checkViewIsDisplayed(withText(R.string.range_select_week)) 81 - clickOnViewWithText(R.string.range_month) 83 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 84 + checkViewIsDisplayed(withText(coreR.string.range_select_week)) 85 + clickOnViewWithText(coreR.string.range_month) 82 86 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 83 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 84 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 85 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 86 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 87 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 88 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 89 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 87 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 88 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 89 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 90 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 91 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 92 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 93 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 90 94 91 95 // Switch to year range 92 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 93 - checkViewIsDisplayed(withText(R.string.range_select_month)) 94 - clickOnViewWithText(R.string.range_year) 96 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 97 + checkViewIsDisplayed(withText(coreR.string.range_select_month)) 98 + clickOnViewWithText(coreR.string.range_year) 95 99 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 96 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 97 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 98 - longClickOnViewWithId(R.id.btnStatisticsContainerToday) 99 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 100 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 101 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 102 - checkViewIsDisplayed(allOf(withText(R.string.statistics_empty), isCompletelyDisplayed())) 100 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 101 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 102 + longClickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 103 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 104 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 105 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 106 + checkViewIsDisplayed(allOf(withText(coreR.string.statistics_empty), isCompletelyDisplayed())) 103 107 104 108 // Switch to overall range 105 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 106 - checkViewIsDisplayed(withText(R.string.range_select_year)) 107 - clickOnViewWithText(R.string.range_overall) 109 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 110 + checkViewIsDisplayed(withText(coreR.string.range_select_year)) 111 + clickOnViewWithText(coreR.string.range_overall) 108 112 Thread.sleep(1000) 109 113 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 110 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerPrevious)) 111 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerNext)) 114 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerPrevious)) 115 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerNext)) 112 116 113 117 // Switch to custom range 114 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 115 - checkViewDoesNotExist(withText(R.string.range_select_day)) 116 - checkViewDoesNotExist(withText(R.string.range_select_week)) 117 - checkViewDoesNotExist(withText(R.string.range_select_month)) 118 - checkViewDoesNotExist(withText(R.string.range_select_year)) 119 - clickOnViewWithText(R.string.range_custom) 120 - tryAction { clickOnViewWithId(R.id.btnCustomRangeSelection) } 118 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 119 + checkViewDoesNotExist(withText(coreR.string.range_select_day)) 120 + checkViewDoesNotExist(withText(coreR.string.range_select_week)) 121 + checkViewDoesNotExist(withText(coreR.string.range_select_month)) 122 + checkViewDoesNotExist(withText(coreR.string.range_select_year)) 123 + clickOnViewWithText(coreR.string.range_custom) 124 + tryAction { clickOnViewWithId(dialogsR.id.btnCustomRangeSelection) } 121 125 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 122 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerPrevious)) 123 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerNext)) 126 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerPrevious)) 127 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerNext)) 124 128 125 129 // Switch to last days range 126 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 127 - checkViewDoesNotExist(withText(R.string.range_select_day)) 128 - checkViewDoesNotExist(withText(R.string.range_select_week)) 129 - checkViewDoesNotExist(withText(R.string.range_select_month)) 130 - checkViewDoesNotExist(withText(R.string.range_select_year)) 131 - clickOnViewWithText(R.string.range_last) 130 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 131 + checkViewDoesNotExist(withText(coreR.string.range_select_day)) 132 + checkViewDoesNotExist(withText(coreR.string.range_select_week)) 133 + checkViewDoesNotExist(withText(coreR.string.range_select_month)) 134 + checkViewDoesNotExist(withText(coreR.string.range_select_year)) 135 + clickOnViewWithText(coreR.string.range_last) 132 136 checkViewIsDisplayed(allOf(withText(name), isCompletelyDisplayed())) 133 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerPrevious)) 134 - checkViewIsNotDisplayed(withId(R.id.btnStatisticsContainerNext)) 137 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerPrevious)) 138 + checkViewIsNotDisplayed(withId(statisticsR.id.btnStatisticsContainerNext)) 135 139 136 140 // Switch back to day 137 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 138 - checkViewDoesNotExist(withText(R.string.range_select_day)) 139 - checkViewDoesNotExist(withText(R.string.range_select_week)) 140 - checkViewDoesNotExist(withText(R.string.range_select_month)) 141 - checkViewDoesNotExist(withText(R.string.range_select_year)) 142 - clickOnViewWithText(R.string.range_day) 143 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 144 - checkViewIsDisplayed(withText(R.string.range_select_day)) 141 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 142 + checkViewDoesNotExist(withText(coreR.string.range_select_day)) 143 + checkViewDoesNotExist(withText(coreR.string.range_select_week)) 144 + checkViewDoesNotExist(withText(coreR.string.range_select_month)) 145 + checkViewDoesNotExist(withText(coreR.string.range_select_year)) 146 + clickOnViewWithText(coreR.string.range_day) 147 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 148 + checkViewIsDisplayed(withText(coreR.string.range_select_day)) 145 149 } 146 150 147 151 @Test ··· 156 160 } 157 161 158 162 // Check yesterday 159 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 160 - clickOnViewWithText(R.string.range_day) 161 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 162 - clickOnViewWithText(R.string.range_select_day) 163 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 164 + clickOnViewWithText(coreR.string.range_day) 165 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 166 + clickOnViewWithText(coreR.string.range_select_day) 163 167 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 164 168 setDate( 165 169 calendarPrev.get(Calendar.YEAR), ··· 167 171 calendarPrev.get(Calendar.DAY_OF_MONTH) 168 172 ) 169 173 ) 170 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 174 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 171 175 172 - checkViewIsDisplayed(allOf(withText(R.string.title_yesterday), isCompletelyDisplayed())) 176 + checkViewIsDisplayed(allOf(withText(coreR.string.title_yesterday), isCompletelyDisplayed())) 173 177 174 178 // Check tomorrow 175 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 176 - clickOnViewWithText(R.string.range_select_day) 179 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 180 + clickOnViewWithText(coreR.string.range_select_day) 177 181 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 178 182 setDate( 179 183 calendarNext.get(Calendar.YEAR), ··· 181 185 calendarNext.get(Calendar.DAY_OF_MONTH) 182 186 ) 183 187 ) 184 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 188 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 185 189 186 - checkViewIsDisplayed(allOf(withText(R.string.title_tomorrow), isCompletelyDisplayed())) 190 + checkViewIsDisplayed(allOf(withText(coreR.string.title_tomorrow), isCompletelyDisplayed())) 187 191 } 188 192 189 193 @Test ··· 204 208 val titleNext = dayTitleFormat.format(calendarNext.timeInMillis) 205 209 206 210 // Check prev date 207 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 208 - clickOnViewWithText(R.string.range_day) 209 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 210 - clickOnViewWithText(R.string.range_select_day) 211 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 212 + clickOnViewWithText(coreR.string.range_day) 213 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 214 + clickOnViewWithText(coreR.string.range_select_day) 211 215 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 212 216 setDate( 213 217 calendarPrev.get(Calendar.YEAR), ··· 215 219 calendarPrev.get(Calendar.DAY_OF_MONTH) 216 220 ) 217 221 ) 218 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 222 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 219 223 220 224 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 221 225 222 226 // Check next date 223 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 224 - clickOnViewWithText(R.string.range_select_day) 227 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 228 + clickOnViewWithText(coreR.string.range_select_day) 225 229 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 226 230 setDate( 227 231 calendarNext.get(Calendar.YEAR), ··· 229 233 calendarNext.get(Calendar.DAY_OF_MONTH) 230 234 ) 231 235 ) 232 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 236 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 233 237 234 238 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 235 239 } ··· 249 253 val titleNext = timeMapper.toWeekTitle(1, 0, DayOfWeek.SUNDAY) 250 254 251 255 // Check prev week 252 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 253 - clickOnViewWithText(R.string.range_week) 254 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 255 - clickOnViewWithText(R.string.range_select_week) 256 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 257 + clickOnViewWithText(coreR.string.range_week) 258 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 259 + clickOnViewWithText(coreR.string.range_select_week) 256 260 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 257 261 setDate( 258 262 calendarPrev.get(Calendar.YEAR), ··· 260 264 calendarPrev.get(Calendar.DAY_OF_MONTH) 261 265 ) 262 266 ) 263 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 267 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 264 268 265 269 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 266 270 267 271 // Check next week 268 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 269 - clickOnViewWithText(R.string.range_select_week) 272 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 273 + clickOnViewWithText(coreR.string.range_select_week) 270 274 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 271 275 setDate( 272 276 calendarNext.get(Calendar.YEAR), ··· 274 278 calendarNext.get(Calendar.DAY_OF_MONTH) 275 279 ) 276 280 ) 277 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 281 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 278 282 279 283 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 280 284 } ··· 294 298 val titleNext = timeMapper.toWeekTitle(2500, 0, DayOfWeek.SUNDAY) 295 299 296 300 // Check prev date 297 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 298 - clickOnViewWithText(R.string.range_week) 299 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 300 - clickOnViewWithText(R.string.range_select_week) 301 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 302 + clickOnViewWithText(coreR.string.range_week) 303 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 304 + clickOnViewWithText(coreR.string.range_select_week) 301 305 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 302 306 setDate( 303 307 calendarPrev.get(Calendar.YEAR), ··· 305 309 calendarPrev.get(Calendar.DAY_OF_MONTH) 306 310 ) 307 311 ) 308 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 312 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 309 313 310 314 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 311 315 312 316 // Check next date 313 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 314 - clickOnViewWithText(R.string.range_select_week) 317 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 318 + clickOnViewWithText(coreR.string.range_select_week) 315 319 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 316 320 setDate( 317 321 calendarNext.get(Calendar.YEAR), ··· 319 323 calendarNext.get(Calendar.DAY_OF_MONTH) 320 324 ) 321 325 ) 322 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 326 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 323 327 324 328 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 325 329 } ··· 342 346 val titleNext = toWeekDateTitle(calendarNext.timeInMillis) 343 347 344 348 // Check prev date 345 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 346 - clickOnViewWithText(R.string.range_week) 347 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 348 - clickOnViewWithText(R.string.range_select_week) 349 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 350 + clickOnViewWithText(coreR.string.range_week) 351 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 352 + clickOnViewWithText(coreR.string.range_select_week) 349 353 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 350 354 setDate( 351 355 calendarPrev.get(Calendar.YEAR), ··· 353 357 calendarPrev.get(Calendar.DAY_OF_MONTH) 354 358 ) 355 359 ) 356 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 360 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 357 361 358 362 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 359 363 360 364 // Check next date 361 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 362 - clickOnViewWithText(R.string.range_select_week) 365 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 366 + clickOnViewWithText(coreR.string.range_select_week) 363 367 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 364 368 setDate( 365 369 calendarNext.get(Calendar.YEAR), ··· 367 371 calendarNext.get(Calendar.DAY_OF_MONTH) 368 372 ) 369 373 ) 370 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 374 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 371 375 372 376 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 373 377 } ··· 390 394 val titleNext = toWeekDateTitle(calendarNext.timeInMillis) 391 395 392 396 // Check prev date 393 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 394 - clickOnViewWithText(R.string.range_week) 395 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 396 - clickOnViewWithText(R.string.range_select_week) 397 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 398 + clickOnViewWithText(coreR.string.range_week) 399 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 400 + clickOnViewWithText(coreR.string.range_select_week) 397 401 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 398 402 setDate( 399 403 calendarPrev.get(Calendar.YEAR), ··· 401 405 calendarPrev.get(Calendar.DAY_OF_MONTH) 402 406 ) 403 407 ) 404 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 408 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 405 409 406 410 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 407 411 408 412 // Check next date 409 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 410 - clickOnViewWithText(R.string.range_select_week) 413 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 414 + clickOnViewWithText(coreR.string.range_select_week) 411 415 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 412 416 setDate( 413 417 calendarNext.get(Calendar.YEAR), ··· 415 419 calendarNext.get(Calendar.DAY_OF_MONTH) 416 420 ) 417 421 ) 418 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 422 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 419 423 420 424 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 421 425 } ··· 434 438 val titleNext = monthTitleFormat.format(calendarNext.timeInMillis) 435 439 436 440 // Check prev months 437 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 438 - clickOnViewWithText(R.string.range_month) 439 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 440 - clickOnViewWithText(R.string.range_select_month) 441 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 442 + clickOnViewWithText(coreR.string.range_month) 443 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 444 + clickOnViewWithText(coreR.string.range_select_month) 441 445 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 442 446 setDate( 443 447 calendarPrev.get(Calendar.YEAR), ··· 445 449 calendarPrev.get(Calendar.DAY_OF_MONTH) 446 450 ) 447 451 ) 448 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 452 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 449 453 450 454 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 451 455 452 456 // Check next month 453 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 454 - clickOnViewWithText(R.string.range_select_month) 457 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 458 + clickOnViewWithText(coreR.string.range_select_month) 455 459 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 456 460 setDate( 457 461 calendarNext.get(Calendar.YEAR), ··· 459 463 calendarNext.get(Calendar.DAY_OF_MONTH) 460 464 ) 461 465 ) 462 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 466 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 463 467 464 468 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 465 469 } ··· 482 486 val titleNext = monthTitleFormat.format(calendarNext.timeInMillis) 483 487 484 488 // Check prev date 485 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 486 - clickOnViewWithText(R.string.range_month) 487 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 488 - clickOnViewWithText(R.string.range_select_month) 489 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 490 + clickOnViewWithText(coreR.string.range_month) 491 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 492 + clickOnViewWithText(coreR.string.range_select_month) 489 493 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 490 494 setDate( 491 495 calendarPrev.get(Calendar.YEAR), ··· 493 497 calendarPrev.get(Calendar.DAY_OF_MONTH) 494 498 ) 495 499 ) 496 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 500 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 497 501 498 502 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 499 503 500 504 // Check next date 501 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 502 - clickOnViewWithText(R.string.range_select_month) 505 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 506 + clickOnViewWithText(coreR.string.range_select_month) 503 507 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 504 508 setDate( 505 509 calendarNext.get(Calendar.YEAR), ··· 507 511 calendarNext.get(Calendar.DAY_OF_MONTH) 508 512 ) 509 513 ) 510 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 514 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 511 515 512 516 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 513 517 } ··· 526 530 val titleNext = yearTitleFormat.format(calendarNext.timeInMillis) 527 531 528 532 // Check prev months 529 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 530 - clickOnViewWithText(R.string.range_year) 531 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 532 - clickOnViewWithText(R.string.range_select_year) 533 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 534 + clickOnViewWithText(coreR.string.range_year) 535 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 536 + clickOnViewWithText(coreR.string.range_select_year) 533 537 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 534 538 setDate( 535 539 calendarPrev.get(Calendar.YEAR), ··· 537 541 calendarPrev.get(Calendar.DAY_OF_MONTH) 538 542 ) 539 543 ) 540 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 544 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 541 545 542 546 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 543 547 544 548 // Check next month 545 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 546 - clickOnViewWithText(R.string.range_select_year) 549 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 550 + clickOnViewWithText(coreR.string.range_select_year) 547 551 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 548 552 setDate( 549 553 calendarNext.get(Calendar.YEAR), ··· 551 555 calendarNext.get(Calendar.DAY_OF_MONTH) 552 556 ) 553 557 ) 554 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 558 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 555 559 556 560 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 557 561 } ··· 574 578 val titleNext = yearTitleFormat.format(calendarNext.timeInMillis) 575 579 576 580 // Check prev date 577 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 578 - clickOnViewWithText(R.string.range_year) 579 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 580 - clickOnViewWithText(R.string.range_select_year) 581 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 582 + clickOnViewWithText(coreR.string.range_year) 583 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 584 + clickOnViewWithText(coreR.string.range_select_year) 581 585 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 582 586 setDate( 583 587 calendarPrev.get(Calendar.YEAR), ··· 585 589 calendarPrev.get(Calendar.DAY_OF_MONTH) 586 590 ) 587 591 ) 588 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 592 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 589 593 590 594 checkViewIsDisplayed(allOf(withText(titlePrev), isCompletelyDisplayed())) 591 595 592 596 // Check next date 593 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 594 - clickOnViewWithText(R.string.range_select_year) 597 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 598 + clickOnViewWithText(coreR.string.range_select_year) 595 599 onView(withClassName(equalTo(DatePicker::class.java.name))).perform( 596 600 setDate( 597 601 calendarNext.get(Calendar.YEAR), ··· 599 603 calendarNext.get(Calendar.DAY_OF_MONTH) 600 604 ) 601 605 ) 602 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 606 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 603 607 604 608 checkViewIsDisplayed(allOf(withText(titleNext), isCompletelyDisplayed())) 605 609 } ··· 635 639 NavUtils.openStatisticsScreen() 636 640 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 637 641 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 638 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 639 - clickOnViewWithText(R.string.range_day) 640 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 641 - clickOnViewWithText(R.string.range_custom) 642 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 643 + clickOnViewWithText(coreR.string.range_day) 644 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 645 + clickOnViewWithText(coreR.string.range_custom) 642 646 pressBack() 643 647 tryAction { 644 - checkViewIsDisplayed(allOf(withId(R.id.btnStatisticsContainerToday), withText(R.string.title_today))) 648 + checkViewIsDisplayed( 649 + allOf(withId(statisticsR.id.btnStatisticsContainerToday), withText(coreR.string.title_today)) 650 + ) 645 651 } 646 652 647 653 // Select custom range default 648 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 649 - clickOnViewWithText(R.string.range_custom) 650 - clickOnViewWithId(R.id.btnCustomRangeSelection) 651 - checkViewIsDisplayed(allOf(withId(R.id.btnStatisticsContainerToday), withText(R.string.range_custom))) 654 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 655 + clickOnViewWithText(coreR.string.range_custom) 656 + clickOnViewWithId(dialogsR.id.btnCustomRangeSelection) 657 + checkViewIsDisplayed( 658 + allOf(withId(statisticsR.id.btnStatisticsContainerToday), withText(coreR.string.range_custom)) 659 + ) 652 660 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 653 661 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 654 662 655 663 // Select custom range yesterday 656 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 657 - clickOnViewWithText(R.string.range_custom) 664 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 665 + clickOnViewWithText(coreR.string.range_custom) 658 666 calendar = Calendar.getInstance().apply { 659 667 add(Calendar.DATE, -1) 660 668 } ··· 668 676 ) 669 677 670 678 // Check statistics 671 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 23) 679 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 23) 672 680 checkStatisticsItem(name = name1, hours = 1) 673 681 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 674 682 675 683 // Check time set 676 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 677 - clickOnViewWithText(R.string.range_custom) 684 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 685 + clickOnViewWithText(coreR.string.range_custom) 678 686 var timeStarted = calendar.timeInMillis.let(timeMapper::formatDateYear) 679 687 var timeEnded = timeStarted 680 688 681 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 682 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 689 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 690 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 683 691 684 692 // Select custom range three days 685 693 var calendarStart = Calendar.getInstance().apply { ··· 694 702 dayEnded = calendar.get(Calendar.DAY_OF_MONTH), 695 703 ) 696 704 697 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 69) 705 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 69) 698 706 checkStatisticsItem(name = name1, hours = 1) 699 707 checkStatisticsItem(name = name2, hours = 2) 700 708 701 709 // Check time set 702 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 703 - clickOnViewWithText(R.string.range_custom) 710 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 711 + clickOnViewWithText(coreR.string.range_custom) 704 712 timeStarted = calendarStart.timeInMillis.let(timeMapper::formatDateYear) 705 713 timeEnded = calendar.timeInMillis.let(timeMapper::formatDateYear) 706 714 707 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 708 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 715 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 716 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 709 717 710 718 // Select custom range long time ago 711 719 calendar = Calendar.getInstance().apply { ··· 723 731 dayEnded = calendar.get(Calendar.DAY_OF_MONTH), 724 732 ) 725 733 726 - checkStatisticsItem(nameResId = R.string.untracked_time_name, hours = 240) 734 + checkStatisticsItem(nameResId = coreR.string.untracked_time_name, hours = 240) 727 735 checkViewDoesNotExist(allOf(withText(name1), isCompletelyDisplayed())) 728 736 checkViewDoesNotExist(allOf(withText(name2), isCompletelyDisplayed())) 729 737 730 738 // Check time set 731 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 732 - clickOnViewWithText(R.string.range_custom) 739 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 740 + clickOnViewWithText(coreR.string.range_custom) 733 741 timeStarted = calendarStart.timeInMillis.let(timeMapper::formatDateYear) 734 742 timeEnded = calendar.timeInMillis.let(timeMapper::formatDateYear) 735 743 736 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 737 - checkViewIsDisplayed(allOf(withId(R.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 744 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeStarted), withText(timeStarted))) 745 + checkViewIsDisplayed(allOf(withId(dialogsR.id.tvCustomRangeSelectionTimeEnded), withText(timeEnded))) 738 746 } 739 747 740 748 @Test ··· 772 780 773 781 // Select range 774 782 NavUtils.openStatisticsScreen() 775 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 776 - clickOnViewWithText(R.string.range_last) 777 - checkViewIsDisplayed(allOf(withId(R.id.btnStatisticsContainerToday), withText(R.string.range_last))) 783 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 784 + clickOnViewWithText(coreR.string.range_last) 785 + checkViewIsDisplayed( 786 + allOf(withId(statisticsR.id.btnStatisticsContainerToday), withText(coreR.string.range_last)) 787 + ) 778 788 checkStatisticsItem(name = name1, hours = 2) 779 789 } 780 790 ··· 785 795 ) { 786 796 checkViewIsDisplayed( 787 797 allOf( 788 - withId(R.id.viewStatisticsItem), 798 + withId(baseR.id.viewStatisticsItem), 789 799 hasDescendant(if (nameResId != null) withText(nameResId) else withText(name)), 790 800 hasDescendant(withSubstring("$hours$hourString 0$minuteString")), 791 801 isCompletelyDisplayed()
+59 -56
app/src/androidTest/java/com/example/util/simpletimetracker/StatisticsTest.kt
··· 21 21 import org.hamcrest.CoreMatchers.allOf 22 22 import org.junit.Test 23 23 import org.junit.runner.RunWith 24 + import com.example.util.simpletimetracker.core.R as coreR 25 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 26 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 24 27 25 28 @HiltAndroidTest 26 29 @RunWith(AndroidJUnit4::class) ··· 46 49 checkRecordsRange(firstColor, lastColor, firstIcon, lastIcon, name, newName) 47 50 48 51 // Switch to week range 49 - clickOnView(allOf(withText(R.string.title_today), isCompletelyDisplayed())) 50 - clickOnViewWithText(R.string.range_week) 52 + clickOnView(allOf(withText(coreR.string.title_today), isCompletelyDisplayed())) 53 + clickOnViewWithText(coreR.string.range_week) 51 54 checkRecordsRange(firstColor, lastColor, firstIcon, lastIcon, name, newName) 52 55 53 56 // Switch to month range 54 - clickOnView(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 55 - clickOnViewWithText(R.string.range_month) 57 + clickOnView(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 58 + clickOnViewWithText(coreR.string.range_month) 56 59 checkRecordsRange(firstColor, lastColor, firstIcon, lastIcon, name, newName) 57 60 58 61 // Switch to year range 59 - clickOnView(allOf(withText(R.string.title_this_month), isCompletelyDisplayed())) 60 - clickOnViewWithText(R.string.range_year) 62 + clickOnView(allOf(withText(coreR.string.title_this_month), isCompletelyDisplayed())) 63 + clickOnViewWithText(coreR.string.range_year) 61 64 checkRecordsRange(firstColor, lastColor, firstIcon, lastIcon, name, newName) 62 65 63 66 // Switch to last days range 64 - clickOnView(allOf(withText(R.string.title_this_year), isCompletelyDisplayed())) 65 - clickOnViewWithText(R.string.range_last) 67 + clickOnView(allOf(withText(coreR.string.title_this_year), isCompletelyDisplayed())) 68 + clickOnViewWithText(coreR.string.range_last) 66 69 checkRecordsRange(firstColor, lastColor, firstIcon, lastIcon, name, newName, checkPrevious = false) 67 70 68 71 // Switch to overall range 69 - clickOnView(allOf(withText(R.string.range_last), isCompletelyDisplayed())) 70 - clickOnViewWithText(R.string.range_overall) 72 + clickOnView(allOf(withText(coreR.string.range_last), isCompletelyDisplayed())) 73 + clickOnViewWithText(coreR.string.range_overall) 71 74 Thread.sleep(1000) 72 75 73 76 checkViewDoesNotExist( 74 77 allOf( 75 - withText(R.string.untracked_time_name), 78 + withText(coreR.string.untracked_time_name), 76 79 isCompletelyDisplayed() 77 80 ) 78 81 ) 79 82 checkViewDoesNotExist(allOf(withText("1$hourString 0m"), isCompletelyDisplayed())) 80 83 checkViewIsDisplayed( 81 84 allOf( 82 - withId(R.id.viewStatisticsItem), 85 + withId(baseR.id.viewStatisticsItem), 83 86 withCardColor(firstColor), 84 87 hasDescendant(withTag(firstIcon)), 85 88 hasDescendant(withText(name)), ··· 89 92 ) 90 93 checkViewIsDisplayed( 91 94 allOf( 92 - withId(R.id.viewStatisticsItem), 95 + withId(baseR.id.viewStatisticsItem), 93 96 withCardColor(lastColor), 94 97 hasDescendant(withTag(lastIcon)), 95 98 hasDescendant(withText(newName)), ··· 99 102 ) 100 103 checkViewIsDisplayed( 101 104 allOf( 102 - withId(R.id.tvStatisticsInfoText), 105 + withId(statisticsR.id.tvStatisticsInfoText), 103 106 withText("2$hourString 0$minuteString") 104 107 ) 105 108 ) 106 109 checkViewIsDisplayed( 107 110 allOf( 108 - withText(R.string.statistics_hint), 111 + withText(coreR.string.statistics_hint), 109 112 isCompletelyDisplayed() 110 113 ) 111 114 ) ··· 144 147 testUtils.addRecord(typeName4) 145 148 146 149 NavUtils.openStatisticsScreen() 147 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 148 - clickOnViewWithText(R.string.category_hint) 150 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 151 + clickOnViewWithText(coreR.string.category_hint) 149 152 pressBack() 150 153 151 154 // Check day range 152 - clickOnViewWithId(R.id.btnStatisticsContainerToday) 153 - clickOnViewWithText(R.string.range_day) 155 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerToday) 156 + clickOnViewWithText(coreR.string.range_day) 154 157 checkCategoryRange(firstColor, lastColor, categoryName1, categoryName2, categoryName3) 155 158 156 159 // Switch to week range 157 - clickOnView(allOf(withText(R.string.title_today), isCompletelyDisplayed())) 158 - clickOnViewWithText(R.string.range_week) 160 + clickOnView(allOf(withText(coreR.string.title_today), isCompletelyDisplayed())) 161 + clickOnViewWithText(coreR.string.range_week) 159 162 checkCategoryRange(firstColor, lastColor, categoryName1, categoryName2, categoryName3) 160 163 161 164 // Switch to month range 162 - clickOnView(allOf(withText(R.string.title_this_week), isCompletelyDisplayed())) 163 - clickOnViewWithText(R.string.range_month) 165 + clickOnView(allOf(withText(coreR.string.title_this_week), isCompletelyDisplayed())) 166 + clickOnViewWithText(coreR.string.range_month) 164 167 checkCategoryRange(firstColor, lastColor, categoryName1, categoryName2, categoryName3) 165 168 166 169 // Switch to year range 167 - clickOnView(allOf(withText(R.string.title_this_month), isCompletelyDisplayed())) 168 - clickOnViewWithText(R.string.range_year) 170 + clickOnView(allOf(withText(coreR.string.title_this_month), isCompletelyDisplayed())) 171 + clickOnViewWithText(coreR.string.range_year) 169 172 checkCategoryRange(firstColor, lastColor, categoryName1, categoryName2, categoryName3) 170 173 171 174 // Switch to last days range 172 - clickOnView(allOf(withText(R.string.title_this_year), isCompletelyDisplayed())) 173 - clickOnViewWithText(R.string.range_last) 175 + clickOnView(allOf(withText(coreR.string.title_this_year), isCompletelyDisplayed())) 176 + clickOnViewWithText(coreR.string.range_last) 174 177 checkCategoryRange(firstColor, lastColor, categoryName1, categoryName2, categoryName3, checkPrevious = false) 175 178 176 179 // Switch to overall range 177 - clickOnView(allOf(withText(R.string.range_last), isCompletelyDisplayed())) 178 - clickOnViewWithText(R.string.range_overall) 180 + clickOnView(allOf(withText(coreR.string.range_last), isCompletelyDisplayed())) 181 + clickOnViewWithText(coreR.string.range_overall) 179 182 Thread.sleep(1000) 180 183 181 184 checkViewDoesNotExist(allOf(withText("3$hourString 0$minuteString"), isCompletelyDisplayed())) 182 185 checkViewIsDisplayed( 183 186 allOf( 184 - withId(R.id.viewStatisticsItem), 187 + withId(baseR.id.viewStatisticsItem), 185 188 withCardColor(firstColor), 186 189 hasDescendant(withText(categoryName1)), 187 190 hasDescendant(withSubstring("60%")), ··· 190 193 ) 191 194 checkViewIsDisplayed( 192 195 allOf( 193 - withId(R.id.viewStatisticsItem), 196 + withId(baseR.id.viewStatisticsItem), 194 197 withCardColor(lastColor), 195 198 hasDescendant(withText(categoryName2)), 196 199 hasDescendant(withSubstring("40%")), ··· 199 202 ) 200 203 checkViewIsDisplayed( 201 204 allOf( 202 - withId(R.id.tvStatisticsInfoText), 205 + withId(statisticsR.id.tvStatisticsInfoText), 203 206 withText("5$hourString 0$minuteString") 204 207 ) 205 208 ) 206 209 checkViewIsDisplayed( 207 210 allOf( 208 - withText(R.string.statistics_hint), 211 + withText(coreR.string.statistics_hint), 209 212 isCompletelyDisplayed() 210 213 ) 211 214 ) 212 215 checkViewDoesNotExist( 213 216 allOf( 214 - withId(R.id.viewStatisticsItem), 217 + withId(baseR.id.viewStatisticsItem), 215 218 hasDescendant(withText(categoryName3)) 216 219 ) 217 220 ) ··· 228 231 ) { 229 232 checkViewIsDisplayed( 230 233 allOf( 231 - withId(R.id.viewStatisticsItem), 232 - hasDescendant(withText(R.string.untracked_time_name)), 234 + withId(baseR.id.viewStatisticsItem), 235 + hasDescendant(withText(coreR.string.untracked_time_name)), 233 236 hasDescendant(withSubstring("%")), 234 237 isCompletelyDisplayed() 235 238 ) 236 239 ) 237 240 checkViewIsDisplayed( 238 241 allOf( 239 - withId(R.id.viewStatisticsItem), 242 + withId(baseR.id.viewStatisticsItem), 240 243 withCardColor(firstColor), 241 244 hasDescendant(withTag(firstIcon)), 242 245 hasDescendant(withText(name)), ··· 247 250 ) 248 251 checkViewIsDisplayed( 249 252 allOf( 250 - withId(R.id.viewStatisticsItem), 253 + withId(baseR.id.viewStatisticsItem), 251 254 withCardColor(lastColor), 252 255 hasDescendant(withTag(lastIcon)), 253 256 hasDescendant(withText(newName)), ··· 258 261 ) 259 262 checkViewIsDisplayed( 260 263 allOf( 261 - withId(R.id.layoutStatisticsInfoItem), 262 - hasDescendant(withText(R.string.statistics_total_tracked)), 264 + withId(statisticsR.id.layoutStatisticsInfoItem), 265 + hasDescendant(withText(coreR.string.statistics_total_tracked)), 263 266 hasDescendant(withText("2$hourString 0$minuteString")), 264 267 isCompletelyDisplayed() 265 268 ) 266 269 ) 267 270 checkViewIsDisplayed( 268 271 allOf( 269 - withText(R.string.statistics_hint), 272 + withText(coreR.string.statistics_hint), 270 273 isCompletelyDisplayed() 271 274 ) 272 275 ) 273 276 if (!checkPrevious) return 274 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 277 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 275 278 checkViewIsDisplayed( 276 279 allOf( 277 - withId(R.id.viewStatisticsItem), 278 - hasDescendant(withText(R.string.untracked_time_name)), 280 + withId(baseR.id.viewStatisticsItem), 281 + hasDescendant(withText(coreR.string.untracked_time_name)), 279 282 hasDescendant(withText("100%")), 280 283 hasDescendant(withSubstring("$hourString 0$minuteString")), 281 284 isCompletelyDisplayed() ··· 283 286 ) 284 287 checkViewIsDisplayed( 285 288 allOf( 286 - withId(R.id.layoutStatisticsInfoItem), 287 - hasDescendant(withText(R.string.statistics_total_tracked)), 289 + withId(statisticsR.id.layoutStatisticsInfoItem), 290 + hasDescendant(withText(coreR.string.statistics_total_tracked)), 288 291 hasDescendant(withText("0$secondString")), 289 292 isCompletelyDisplayed() 290 293 ) 291 294 ) 292 295 checkViewDoesNotExist( 293 296 allOf( 294 - withText(R.string.statistics_hint), 297 + withText(coreR.string.statistics_hint), 295 298 isCompletelyDisplayed() 296 299 ) 297 300 ) 298 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 301 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 299 302 } 300 303 301 304 private fun checkCategoryRange( ··· 308 311 ) { 309 312 checkViewIsDisplayed( 310 313 allOf( 311 - withId(R.id.viewStatisticsItem), 314 + withId(baseR.id.viewStatisticsItem), 312 315 withCardColor(firstColor), 313 316 hasDescendant(withText(categoryName1)), 314 317 hasDescendant(withText("3$hourString 0$minuteString")), ··· 318 321 ) 319 322 checkViewIsDisplayed( 320 323 allOf( 321 - withId(R.id.viewStatisticsItem), 324 + withId(baseR.id.viewStatisticsItem), 322 325 withCardColor(lastColor), 323 326 hasDescendant(withText(categoryName2)), 324 327 hasDescendant(withText("2$hourString 0$minuteString")), ··· 328 331 ) 329 332 checkViewIsDisplayed( 330 333 allOf( 331 - withId(R.id.tvStatisticsInfoText), 334 + withId(statisticsR.id.tvStatisticsInfoText), 332 335 withText("5$hourString 0$minuteString") 333 336 ) 334 337 ) 335 338 checkViewDoesNotExist( 336 339 allOf( 337 - withId(R.id.viewStatisticsItem), 340 + withId(baseR.id.viewStatisticsItem), 338 341 hasDescendant(withText(categoryName3)) 339 342 ) 340 343 ) 341 344 checkViewIsDisplayed( 342 345 allOf( 343 - withText(R.string.statistics_hint), 346 + withText(coreR.string.statistics_hint), 344 347 isCompletelyDisplayed() 345 348 ) 346 349 ) 347 350 if (!checkPrevious) return 348 - clickOnViewWithId(R.id.btnStatisticsContainerPrevious) 351 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerPrevious) 349 352 checkViewIsDisplayed( 350 353 allOf( 351 - withText(R.string.statistics_empty), 354 + withText(coreR.string.statistics_empty), 352 355 isCompletelyDisplayed() 353 356 ) 354 357 ) 355 - clickOnViewWithId(R.id.btnStatisticsContainerNext) 358 + clickOnViewWithId(statisticsR.id.btnStatisticsContainerNext) 356 359 } 357 360 }
+2 -1
app/src/androidTest/java/com/example/util/simpletimetracker/Widget.kt
··· 15 15 import org.hamcrest.CoreMatchers.allOf 16 16 import org.junit.Test 17 17 import org.junit.runner.RunWith 18 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 18 19 19 20 @HiltAndroidTest 20 21 @Widget ··· 49 50 private fun checkType(color: Int, name: String) { 50 51 checkViewIsDisplayed( 51 52 allOf( 52 - withId(R.id.viewRecordTypeItem), 53 + withId(baseR.id.viewRecordTypeItem), 53 54 withCardColor(color), 54 55 hasDescendant(withText(name)) 55 56 )
+16 -13
app/src/androidTest/java/com/example/util/simpletimetracker/WidgetUniversal.kt
··· 19 19 import org.hamcrest.CoreMatchers.allOf 20 20 import org.junit.Test 21 21 import org.junit.runner.RunWith 22 + import com.example.util.simpletimetracker.core.R as coreR 23 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 24 + import com.example.util.simpletimetracker.feature_views.R as viewsR 22 25 23 26 @HiltAndroidTest 24 27 @Widget ··· 51 54 checkType(lastColor, name2) 52 55 checkViewDoesNotExist(withText(name3)) 53 56 checkViewDoesNotExist(withText(filter)) 54 - checkViewDoesNotExist(withText(R.string.running_records_add_filter)) 57 + checkViewDoesNotExist(withText(coreR.string.running_records_add_filter)) 55 58 56 59 // Start activity 57 60 clickOnViewWithText(name1) 58 - checkType(R.color.colorFiltered, name1) 61 + checkType(viewsR.color.colorFiltered, name1) 59 62 60 63 // Stop activity 61 64 clickOnViewWithText(name1) ··· 75 78 76 79 // Start timer 77 80 clickOnViewWithText(name1) 78 - checkType(R.color.colorFiltered, name1) 79 - checkType(R.color.colorFiltered, name2) 81 + checkType(viewsR.color.colorFiltered, name1) 82 + checkType(viewsR.color.colorFiltered, name2) 80 83 } 81 84 82 85 @Test ··· 94 97 // Start another 95 98 clickOnViewWithText(name2) 96 99 checkType(firstColor, name1) 97 - checkType(R.color.colorFiltered, name2) 100 + checkType(viewsR.color.colorFiltered, name2) 98 101 } 99 102 100 103 @Test ··· 111 114 112 115 // Start timer 113 116 tryAction { clickOnViewWithText(name1) } 114 - checkType(R.color.colorFiltered, name1) 117 + checkType(viewsR.color.colorFiltered, name1) 115 118 } 116 119 117 120 @Test ··· 129 132 130 133 // Start timer 131 134 clickOnViewWithText(name1) 132 - tryAction { checkViewIsDisplayed(withText(R.string.change_record_untagged)) } 135 + tryAction { checkViewIsDisplayed(withText(coreR.string.change_record_untagged)) } 133 136 checkViewIsDisplayed(withText(tag1)) 134 137 checkViewDoesNotExist(withText(tag2)) 135 138 clickOnViewWithText(tag1) 136 - clickOnViewWithText(R.string.duration_dialog_save) 137 - checkType(R.color.colorFiltered, name1) 139 + clickOnViewWithText(coreR.string.duration_dialog_save) 140 + checkType(viewsR.color.colorFiltered, name1) 138 141 } 139 142 140 143 @Test ··· 158 161 // Check filters 159 162 tryAction { checkViewIsDisplayed(withText(name1)) } 160 163 checkViewIsDisplayed(withText(name2)) 161 - checkViewIsDisplayed(allOf(withCardColor(R.color.colorFiltered), hasDescendant(withText(filter)))) 162 - checkViewDoesNotExist(withText(R.string.running_records_add_filter)) 164 + checkViewIsDisplayed(allOf(withCardColor(viewsR.color.colorFiltered), hasDescendant(withText(filter)))) 165 + checkViewDoesNotExist(withText(coreR.string.running_records_add_filter)) 163 166 164 167 clickOnViewWithText(filter) 165 168 checkViewIsDisplayed(withText(name1)) ··· 169 172 clickOnViewWithText(filter) 170 173 checkViewIsDisplayed(withText(name1)) 171 174 checkViewIsDisplayed(withText(name2)) 172 - checkViewIsDisplayed(allOf(withCardColor(R.color.colorFiltered), hasDescendant(withText(filter)))) 175 + checkViewIsDisplayed(allOf(withCardColor(viewsR.color.colorFiltered), hasDescendant(withText(filter)))) 173 176 } 174 177 175 178 private fun checkType(color: Int, name: String) { 176 179 checkViewIsDisplayed( 177 180 allOf( 178 - withId(R.id.viewRecordTypeItem), 181 + withId(baseR.id.viewRecordTypeItem), 179 182 withCardColor(color), 180 183 hasDescendant(withText(name)) 181 184 )
+11 -7
app/src/androidTest/java/com/example/util/simpletimetracker/ZeroDurationRecordTest.kt
··· 21 21 import org.hamcrest.CoreMatchers.allOf 22 22 import org.junit.Test 23 23 import org.junit.runner.RunWith 24 + import com.example.util.simpletimetracker.core.R as coreR 25 + import com.example.util.simpletimetracker.feature_base_adapter.R as baseR 26 + import com.example.util.simpletimetracker.feature_statistics.R as statisticsR 27 + import com.example.util.simpletimetracker.feature_statistics_detail.R as statisticsDetailR 24 28 25 29 @HiltAndroidTest 26 30 @RunWith(AndroidJUnit4::class) ··· 45 49 46 50 // Record added 47 51 val record = allOf( 48 - withId(R.id.viewRecordItem), 52 + withId(baseR.id.viewRecordItem), 49 53 hasDescendant(withText(name)), 50 54 hasDescendant(withText("0$secondString")), 51 55 isCompletelyDisplayed() ··· 54 58 55 59 // Check statistics 56 60 NavUtils.openStatisticsScreen() 57 - clickOnViewWithIdOnPager(R.id.btnStatisticsChartFilter) 61 + clickOnViewWithIdOnPager(statisticsR.id.btnStatisticsChartFilter) 58 62 Thread.sleep(1000) 59 63 clickOnView( 60 64 allOf( 61 - isDescendantOfA(withId(R.id.viewRecordTypeItem)), 62 - withText(R.string.untracked_time_name) 65 + isDescendantOfA(withId(baseR.id.viewRecordTypeItem)), 66 + withText(coreR.string.untracked_time_name) 63 67 ) 64 68 ) 65 69 pressBack() 66 70 67 71 // Check detailed statistics 68 72 clickOnView(allOf(withText(name), isCompletelyDisplayed())) 69 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 73 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo()) 70 74 checkViewIsDisplayed( 71 75 allOf( 72 - withPluralText(R.plurals.statistics_detail_times_tracked, 1), 76 + withPluralText(coreR.plurals.statistics_detail_times_tracked, 1), 73 77 hasSibling(withText("1")) 74 78 ) 75 79 ) 76 80 77 81 // Check records all 78 - onView(withId(R.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 82 + onView(withId(statisticsDetailR.id.cardStatisticsDetailRecords)).perform(nestedScrollTo(), click()) 79 83 checkViewIsDisplayed(record) 80 84 } 81 85 }
+105 -97
app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt
··· 11 11 import androidx.test.espresso.matcher.ViewMatchers.withClassName 12 12 import androidx.test.espresso.matcher.ViewMatchers.withId 13 13 import androidx.test.espresso.matcher.ViewMatchers.withText 14 - import com.example.util.simpletimetracker.R 15 14 import com.example.util.simpletimetracker.feature_dialogs.dateTime.CustomTimePicker 16 15 import org.hamcrest.CoreMatchers.allOf 17 16 import org.hamcrest.CoreMatchers.equalTo 17 + import com.example.util.simpletimetracker.core.R as coreR 18 + import com.example.util.simpletimetracker.feature_change_activity_filter.R as changeActivityFilterR 19 + import com.example.util.simpletimetracker.feature_change_category.R as changeCategoryR 20 + import com.example.util.simpletimetracker.feature_change_record.R as changeRecordR 21 + import com.example.util.simpletimetracker.feature_change_record_tag.R as changeRecordTagR 22 + import com.example.util.simpletimetracker.feature_change_record_type.R as changeRecordTypeR 23 + import com.example.util.simpletimetracker.feature_dialogs.R as dialogsR 24 + import com.example.util.simpletimetracker.feature_main.R as mainR 25 + import com.example.util.simpletimetracker.feature_records.R as recordsR 18 26 19 27 object NavUtils { 20 28 21 29 fun openRunningRecordsScreen() { 22 - onView(withId(R.id.mainTabs)).perform(selectTabAtPosition(0)) 30 + onView(withId(mainR.id.mainTabs)).perform(selectTabAtPosition(0)) 23 31 Thread.sleep(1000) 24 32 } 25 33 26 34 fun openRecordsScreen() { 27 - onView(withId(R.id.mainTabs)).perform(selectTabAtPosition(1)) 35 + onView(withId(mainR.id.mainTabs)).perform(selectTabAtPosition(1)) 28 36 Thread.sleep(1000) 29 37 } 30 38 31 39 fun openStatisticsScreen() { 32 - onView(withId(R.id.mainTabs)).perform(selectTabAtPosition(2)) 40 + onView(withId(mainR.id.mainTabs)).perform(selectTabAtPosition(2)) 33 41 Thread.sleep(1000) 34 42 } 35 43 36 44 fun openSettingsScreen() { 37 - onView(withId(R.id.mainTabs)).perform(selectTabAtPosition(3)) 45 + onView(withId(mainR.id.mainTabs)).perform(selectTabAtPosition(3)) 38 46 Thread.sleep(1000) 39 47 } 40 48 41 49 fun openSettingsNotifications() { 42 - onView(withText(R.string.settings_notification_title)).perform(nestedScrollTo(), click()) 50 + onView(withText(coreR.string.settings_notification_title)).perform(nestedScrollTo(), click()) 43 51 } 44 52 45 53 fun openSettingsDisplay() { 46 - onView(withText(R.string.settings_display_title)).perform(nestedScrollTo(), click()) 54 + onView(withText(coreR.string.settings_display_title)).perform(nestedScrollTo(), click()) 47 55 } 48 56 49 57 fun openSettingsAdditional() { 50 - onView(withText(R.string.settings_additional_title)).perform(nestedScrollTo(), click()) 58 + onView(withText(coreR.string.settings_additional_title)).perform(nestedScrollTo(), click()) 51 59 } 52 60 53 61 fun openCategoriesScreen() { 54 - onView(withText(R.string.settings_edit_categories)).perform(nestedScrollTo(), click()) 62 + onView(withText(coreR.string.settings_edit_categories)).perform(nestedScrollTo(), click()) 55 63 } 56 64 57 65 fun openArchiveScreen() { 58 - onView(withText(R.string.settings_archive)).perform(nestedScrollTo(), click()) 66 + onView(withText(coreR.string.settings_archive)).perform(nestedScrollTo(), click()) 59 67 } 60 68 61 69 fun openCardSizeScreen() { 62 - onView(withText(R.string.settings_change_card_size)).perform(nestedScrollTo(), click()) 70 + onView(withText(coreR.string.settings_change_card_size)).perform(nestedScrollTo(), click()) 63 71 } 64 72 65 73 fun addActivity( ··· 70 78 categories: List<String> = emptyList(), 71 79 goalTime: String? = null, 72 80 ) { 73 - tryAction { clickOnViewWithText(R.string.running_records_add_type) } 81 + tryAction { clickOnViewWithText(coreR.string.running_records_add_type) } 74 82 75 83 // Name 76 - typeTextIntoView(R.id.etChangeRecordTypeName, name) 84 + typeTextIntoView(changeRecordTypeR.id.etChangeRecordTypeName, name) 77 85 78 86 // Color 79 87 if (color != null) { 80 - clickOnViewWithText(R.string.change_record_type_color_hint) 81 - scrollRecyclerToView(R.id.rvChangeRecordTypeColor, withCardColor(color)) 82 - clickOnRecyclerItem(R.id.rvChangeRecordTypeColor, withCardColor(color)) 83 - clickOnViewWithText(R.string.change_record_type_color_hint) 88 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 89 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(color)) 90 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeColor, withCardColor(color)) 91 + clickOnViewWithText(coreR.string.change_record_type_color_hint) 84 92 } 85 93 86 94 // Icon 87 95 if (icon != null) { 88 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 89 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withTag(icon))) 90 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withTag(icon)) 91 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 96 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 97 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withTag(icon))) 98 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withTag(icon)) 99 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 92 100 } else if (text != null) { 93 - clickOnViewWithText(R.string.change_record_type_icon_image_hint) 94 - onView(withId(R.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 95 - scrollRecyclerToView(R.id.rvChangeRecordTypeIcon, hasDescendant(withText(text))) 96 - clickOnRecyclerItem(R.id.rvChangeRecordTypeIcon, withText(text)) 97 - clickOnViewWithId(R.id.fieldChangeRecordTypeIcon) 101 + clickOnViewWithText(coreR.string.change_record_type_icon_image_hint) 102 + onView(withId(changeRecordTypeR.id.rvChangeRecordTypeIcon)).perform(collapseToolbar()) 103 + scrollRecyclerToView(changeRecordTypeR.id.rvChangeRecordTypeIcon, hasDescendant(withText(text))) 104 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeIcon, withText(text)) 105 + clickOnViewWithId(changeRecordTypeR.id.fieldChangeRecordTypeIcon) 98 106 } 99 107 100 108 // Categories 101 109 if (categories.isNotEmpty()) { 102 - clickOnViewWithText(R.string.category_hint) 110 + clickOnViewWithText(coreR.string.category_hint) 103 111 categories.forEach { categoryName -> 104 112 scrollRecyclerToView( 105 - R.id.rvChangeRecordTypeCategories, hasDescendant(withText(categoryName)) 113 + changeRecordTypeR.id.rvChangeRecordTypeCategories, hasDescendant(withText(categoryName)) 106 114 ) 107 - clickOnRecyclerItem(R.id.rvChangeRecordTypeCategories, withText(categoryName)) 115 + clickOnRecyclerItem(changeRecordTypeR.id.rvChangeRecordTypeCategories, withText(categoryName)) 108 116 } 109 - clickOnViewWithText(R.string.category_hint) 117 + clickOnViewWithText(coreR.string.category_hint) 110 118 } 111 119 112 120 // Goal time 113 121 if (!goalTime.isNullOrEmpty()) { 114 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 115 - clickOnViewWithId(R.id.groupChangeRecordTypeSessionGoalTime) 122 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 123 + clickOnViewWithId(changeRecordTypeR.id.groupChangeRecordTypeSessionGoalTime) 116 124 goalTime.forEach { char -> 117 125 clickOnViewWithText(char.toString()) 118 126 } 119 - clickOnViewWithText(R.string.duration_dialog_save) 120 - clickOnViewWithText(R.string.change_record_type_goal_time_hint) 127 + clickOnViewWithText(coreR.string.duration_dialog_save) 128 + clickOnViewWithText(coreR.string.change_record_type_goal_time_hint) 121 129 } 122 130 123 131 closeSoftKeyboard() 124 - clickOnViewWithText(R.string.change_record_type_save) 132 + clickOnViewWithText(coreR.string.change_record_type_save) 125 133 } 126 134 127 135 fun addCategory( ··· 129 137 color: Int? = null, 130 138 activities: List<String> = emptyList(), 131 139 ) { 132 - tryAction { clickOnViewWithText(R.string.categories_add_category) } 140 + tryAction { clickOnViewWithText(coreR.string.categories_add_category) } 133 141 134 142 // Name 135 - typeTextIntoView(R.id.etChangeCategoryName, name) 143 + typeTextIntoView(changeCategoryR.id.etChangeCategoryName, name) 136 144 137 145 // Color 138 146 if (color != null) { 139 - clickOnViewWithText(R.string.change_category_color_hint) 140 - scrollRecyclerToView(R.id.rvChangeCategoryColor, withCardColor(color)) 141 - clickOnRecyclerItem(R.id.rvChangeCategoryColor, withCardColor(color)) 147 + clickOnViewWithText(coreR.string.change_category_color_hint) 148 + scrollRecyclerToView(changeCategoryR.id.rvChangeCategoryColor, withCardColor(color)) 149 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryColor, withCardColor(color)) 142 150 } 143 151 144 152 // Activities 145 - clickOnViewWithText(R.string.change_category_types_hint) 153 + clickOnViewWithText(coreR.string.change_category_types_hint) 146 154 activities.forEach { typeName -> 147 - scrollRecyclerToView(R.id.rvChangeCategoryType, hasDescendant(withText(typeName))) 148 - clickOnRecyclerItem(R.id.rvChangeCategoryType, withText(typeName)) 155 + scrollRecyclerToView(changeCategoryR.id.rvChangeCategoryType, hasDescendant(withText(typeName))) 156 + clickOnRecyclerItem(changeCategoryR.id.rvChangeCategoryType, withText(typeName)) 149 157 } 150 158 151 - clickOnViewWithText(R.string.change_category_save) 159 + clickOnViewWithText(coreR.string.change_category_save) 152 160 } 153 161 154 162 fun addRecordTag( ··· 156 164 activity: String? = null, 157 165 color: Int? = null, 158 166 ) { 159 - tryAction { clickOnViewWithText(R.string.categories_add_record_tag) } 167 + tryAction { clickOnViewWithText(coreR.string.categories_add_record_tag) } 160 168 161 169 // Name 162 - typeTextIntoView(R.id.etChangeRecordTagName, name) 170 + typeTextIntoView(changeRecordTagR.id.etChangeRecordTagName, name) 163 171 164 172 // Color 165 173 if (color != null) { 166 174 clickOnView( 167 175 allOf( 168 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 169 - withText(R.string.change_record_tag_type_general) 176 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 177 + withText(coreR.string.change_record_tag_type_general) 170 178 ) 171 179 ) 172 - clickOnViewWithId(R.id.fieldChangeRecordTagColor) 173 - scrollRecyclerToView(R.id.rvChangeRecordTagColor, withCardColor(color)) 174 - clickOnRecyclerItem(R.id.rvChangeRecordTagColor, withCardColor(color)) 180 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagColor) 181 + scrollRecyclerToView(changeRecordTagR.id.rvChangeRecordTagColor, withCardColor(color)) 182 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagColor, withCardColor(color)) 175 183 } 176 184 177 185 // Activity 178 186 if (!activity.isNullOrEmpty()) { 179 187 clickOnView( 180 188 allOf( 181 - isDescendantOfA(withId(R.id.buttonsChangeRecordTagType)), 182 - withText(R.string.change_record_tag_type_typed) 189 + isDescendantOfA(withId(changeRecordTagR.id.buttonsChangeRecordTagType)), 190 + withText(coreR.string.change_record_tag_type_typed) 183 191 ) 184 192 ) 185 - clickOnViewWithId(R.id.fieldChangeRecordTagType) 186 - scrollRecyclerToView(R.id.rvChangeRecordTagType, hasDescendant(withText(activity))) 187 - clickOnRecyclerItem(R.id.rvChangeRecordTagType, withText(activity)) 193 + clickOnViewWithId(changeRecordTagR.id.fieldChangeRecordTagType) 194 + scrollRecyclerToView(changeRecordTagR.id.rvChangeRecordTagType, hasDescendant(withText(activity))) 195 + clickOnRecyclerItem(changeRecordTagR.id.rvChangeRecordTagType, withText(activity)) 188 196 } 189 197 190 - clickOnViewWithText(R.string.change_category_save) 198 + clickOnViewWithText(coreR.string.change_category_save) 191 199 } 192 200 193 201 fun addRecord(name: String) { 194 - tryAction { clickOnViewWithId(R.id.btnRecordAdd) } 202 + tryAction { clickOnViewWithId(recordsR.id.btnRecordAdd) } 195 203 196 204 // Activity 197 - clickOnViewWithText(R.string.change_record_type_field) 198 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 205 + clickOnViewWithText(coreR.string.change_record_type_field) 206 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 199 207 200 - clickOnViewWithText(R.string.change_record_save) 208 + clickOnViewWithText(coreR.string.change_record_save) 201 209 } 202 210 203 211 fun addRecordWithTime( ··· 209 217 comment: String? = null, 210 218 tag: String? = null, 211 219 ) { 212 - tryAction { clickOnViewWithId(R.id.btnRecordAdd) } 220 + tryAction { clickOnViewWithId(recordsR.id.btnRecordAdd) } 213 221 214 222 // Time started 215 - clickOnViewWithId(R.id.tvChangeRecordTimeStarted) 223 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeStarted) 216 224 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 217 225 .perform(setTime(hourStarted, minutesStarted)) 218 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 226 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 219 227 220 228 // Time ended 221 - clickOnViewWithId(R.id.tvChangeRecordTimeEnded) 229 + clickOnViewWithId(changeRecordR.id.tvChangeRecordTimeEnded) 222 230 onView(withClassName(equalTo(CustomTimePicker::class.java.name))) 223 231 .perform(setTime(hourEnded, minutesEnded)) 224 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 232 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 225 233 226 234 // Comment 227 235 if (!comment.isNullOrEmpty()) { 228 - clickOnViewWithText(R.string.change_record_comment_field) 229 - typeTextIntoView(R.id.etChangeRecordComment, comment) 230 - clickOnViewWithText(R.string.change_record_comment_field) 236 + clickOnViewWithText(coreR.string.change_record_comment_field) 237 + typeTextIntoView(changeRecordR.id.etChangeRecordComment, comment) 238 + clickOnViewWithText(coreR.string.change_record_comment_field) 231 239 } 232 240 233 241 // Activity 234 - clickOnViewWithText(R.string.change_record_type_field) 235 - clickOnRecyclerItem(R.id.rvChangeRecordType, withText(name)) 242 + clickOnViewWithText(coreR.string.change_record_type_field) 243 + clickOnRecyclerItem(changeRecordR.id.rvChangeRecordType, withText(name)) 236 244 237 245 // Tag 238 246 if (tag != null) { 239 - tryAction { clickOnRecyclerItem(R.id.rvChangeRecordCategories, withText(tag)) } 240 - clickOnViewWithText(R.string.change_record_tag_field) 247 + tryAction { clickOnRecyclerItem(changeRecordR.id.rvChangeRecordCategories, withText(tag)) } 248 + clickOnViewWithText(coreR.string.change_record_tag_field) 241 249 } 242 250 243 - clickOnViewWithText(R.string.change_record_save) 251 + clickOnViewWithText(coreR.string.change_record_save) 244 252 } 245 253 246 254 fun addActivityFilter( ··· 249 257 activities: List<String> = emptyList(), 250 258 categories: List<String> = emptyList(), 251 259 ) { 252 - tryAction { clickOnViewWithText(R.string.running_records_add_filter) } 260 + tryAction { clickOnViewWithText(coreR.string.running_records_add_filter) } 253 261 254 262 // Name 255 - typeTextIntoView(R.id.etChangeActivityFilterName, name) 263 + typeTextIntoView(changeActivityFilterR.id.etChangeActivityFilterName, name) 256 264 257 265 // Color 258 266 if (color != null) { 259 - clickOnViewWithText(R.string.change_category_color_hint) 260 - scrollRecyclerToView(R.id.rvChangeActivityFilterColor, withCardColor(color)) 261 - clickOnRecyclerItem(R.id.rvChangeActivityFilterColor, withCardColor(color)) 267 + clickOnViewWithText(coreR.string.change_category_color_hint) 268 + scrollRecyclerToView(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(color)) 269 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterColor, withCardColor(color)) 262 270 } 263 271 264 272 // Activity 265 273 if (activities.isNotEmpty()) { 266 - clickOnViewWithId(R.id.fieldChangeActivityFilterType) 274 + clickOnViewWithId(changeActivityFilterR.id.fieldChangeActivityFilterType) 267 275 clickOnView( 268 276 allOf( 269 - isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), 270 - withText(R.string.activity_hint) 277 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 278 + withText(coreR.string.activity_hint) 271 279 ) 272 280 ) 273 281 activities.forEach { 274 - scrollRecyclerToView(R.id.rvChangeActivityFilterType, hasDescendant(withText(it))) 275 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(it)) 282 + scrollRecyclerToView(changeActivityFilterR.id.rvChangeActivityFilterType, hasDescendant(withText(it))) 283 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(it)) 276 284 } 277 - clickOnViewWithId(R.id.fieldChangeActivityFilterType) 285 + clickOnViewWithId(changeActivityFilterR.id.fieldChangeActivityFilterType) 278 286 } 279 287 280 288 // Category 281 289 if (categories.isNotEmpty()) { 282 - clickOnViewWithId(R.id.fieldChangeActivityFilterType) 290 + clickOnViewWithId(changeActivityFilterR.id.fieldChangeActivityFilterType) 283 291 clickOnView( 284 292 allOf( 285 - isDescendantOfA(withId(R.id.buttonsChangeActivityFilterType)), 286 - withText(R.string.category_hint) 293 + isDescendantOfA(withId(changeActivityFilterR.id.buttonsChangeActivityFilterType)), 294 + withText(coreR.string.category_hint) 287 295 ) 288 296 ) 289 297 categories.forEach { 290 - scrollRecyclerToView(R.id.rvChangeActivityFilterType, hasDescendant(withText(it))) 291 - clickOnRecyclerItem(R.id.rvChangeActivityFilterType, withText(it)) 298 + scrollRecyclerToView(changeActivityFilterR.id.rvChangeActivityFilterType, hasDescendant(withText(it))) 299 + clickOnRecyclerItem(changeActivityFilterR.id.rvChangeActivityFilterType, withText(it)) 292 300 } 293 - clickOnViewWithId(R.id.fieldChangeActivityFilterType) 301 + clickOnViewWithId(changeActivityFilterR.id.fieldChangeActivityFilterType) 294 302 } 295 303 296 - clickOnViewWithText(R.string.change_activity_filter_save) 304 + clickOnViewWithText(coreR.string.change_activity_filter_save) 297 305 } 298 306 299 307 fun setCustomRange( ··· 305 313 dayEnded: Int, 306 314 ) { 307 315 // Set time started 308 - clickOnViewWithId(R.id.tvCustomRangeSelectionTimeStarted) 316 + clickOnViewWithId(dialogsR.id.tvCustomRangeSelectionTimeStarted) 309 317 onView(withClassName(equalTo(DatePicker::class.java.name))) 310 318 .perform(setDate(yearStarted, monthStarted + 1, dayStarted)) 311 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 319 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 312 320 313 321 // Set time ended 314 - clickOnViewWithId(R.id.tvCustomRangeSelectionTimeEnded) 322 + clickOnViewWithId(dialogsR.id.tvCustomRangeSelectionTimeEnded) 315 323 onView(withClassName(equalTo(DatePicker::class.java.name))) 316 324 .perform(setDate(yearEnded, monthEnded + 1, dayEnded)) 317 - clickOnViewWithId(R.id.btnDateTimeDialogPositive) 325 + clickOnViewWithId(dialogsR.id.btnDateTimeDialogPositive) 318 326 319 - clickOnViewWithId(R.id.btnCustomRangeSelection) 327 + clickOnViewWithId(dialogsR.id.btnCustomRangeSelection) 320 328 } 321 329 }
-1
domain/src/main/java/com/example/util/simpletimetracker/domain/extension/RecordsFilterExtensions.kt
··· 115 115 fun List<RecordsFilter>.hasManuallyFiltered(): Boolean { 116 116 return any { it is RecordsFilter.ManuallyFiltered } 117 117 } 118 -
+2 -2
domain/src/main/java/com/example/util/simpletimetracker/domain/model/QuickSettingsWidgetType.kt
··· 1 1 package com.example.util.simpletimetracker.domain.model 2 2 3 3 sealed interface QuickSettingsWidgetType { 4 - object AllowMultitasking: QuickSettingsWidgetType 5 - object ShowRecordTagSelection: QuickSettingsWidgetType 4 + object AllowMultitasking : QuickSettingsWidgetType 5 + object ShowRecordTagSelection : QuickSettingsWidgetType 6 6 }
+1 -1
domain/src/main/java/com/example/util/simpletimetracker/domain/model/RecordsFilter.kt
··· 18 18 19 19 sealed interface CategoryItem { 20 20 data class Categorized(val categoryId: Long) : CategoryItem 21 - object Uncategorized: CategoryItem 21 + object Uncategorized : CategoryItem 22 22 } 23 23 24 24 sealed interface TagItem {
+1 -1
features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/core/GetDoNotDisturbHandledScheduleInteractor.kt
··· 1 1 package com.example.util.simpletimetracker.feature_notification.core 2 2 3 3 import com.example.util.simpletimetracker.core.mapper.TimeMapper 4 - import java.util.* 4 + import java.util.Calendar 5 5 import javax.inject.Inject 6 6 7 7 class GetDoNotDisturbHandledScheduleInteractor @Inject constructor(
+4 -4
features/feature_dialogs/src/main/java/com/example/util/simpletimetracker/feature_dialogs/archive/view/ArchiveDialogFragment.kt
··· 1 1 package com.example.util.simpletimetracker.feature_dialogs.archive.view 2 2 3 - import com.example.util.simpletimetracker.feature_dialogs.databinding.ArchiveDialogFragmentBinding as Binding 4 3 import android.content.Context 5 4 import android.os.Bundle 6 5 import android.view.LayoutInflater ··· 26 25 import com.google.android.flexbox.FlexboxLayoutManager 27 26 import com.google.android.flexbox.JustifyContent 28 27 import dagger.hilt.android.AndroidEntryPoint 29 - import kotlinx.coroutines.GlobalScope 28 + import kotlinx.coroutines.MainScope 30 29 import kotlinx.coroutines.launch 30 + import com.example.util.simpletimetracker.feature_dialogs.databinding.ArchiveDialogFragmentBinding as Binding 31 31 32 32 @AndroidEntryPoint 33 33 class ArchiveDialogFragment : BaseBottomSheetFragment<Binding>() { ··· 91 91 } 92 92 93 93 private fun onDeleteClick() { 94 - GlobalScope.launch { archiveDialogListener?.onDeleteClick(params) } 94 + MainScope().launch { archiveDialogListener?.onDeleteClick(params) } 95 95 dismiss() 96 96 } 97 97 98 98 private fun onRestoreClick() { 99 - GlobalScope.launch { archiveDialogListener?.onRestoreClick(params) } 99 + MainScope().launch { archiveDialogListener?.onRestoreClick(params) } 100 100 dismiss() 101 101 } 102 102