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 tests

razeeman (Oct 10, 2020, 2:50 PM +0300) 7dc045f6 551151a7

+45 -8
+4
app/build.gradle.kts
··· 63 63 64 64 kapt(Deps.Kapt.dagger) 65 65 kaptAndroidTest(Deps.Kapt.dagger) 66 + 67 + androidTestImplementation(Deps.UiTest.junit) 68 + androidTestImplementation(Deps.UiTest.espresso) 69 + androidTestImplementation(Deps.UiTest.espressoContrib) 66 70 }
-4
core/build.gradle.kts
··· 40 40 api(Deps.Ktx.liveData) 41 41 api(Deps.Ktx.viewModel) 42 42 api(Deps.UiTest.espressoIdling) 43 - 44 - androidTestApi(Deps.UiTest.junit) 45 - androidTestApi(Deps.UiTest.espresso) 46 - androidTestApi(Deps.UiTest.espressoContrib) 47 43 }
+1 -1
domain/build.gradle.kts
··· 24 24 api(Deps.coroutines) 25 25 api(Deps.timber) 26 26 27 - testApi(Deps.Test.junit) 27 + testImplementation(Deps.Test.junit) 28 28 }
+32 -2
app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt
··· 127 127 128 128 // Click on already running 129 129 NavUtils.openRunningRecordsScreen() 130 - Thread.sleep(1000) 131 130 clickOnView( 132 131 allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name1)) 133 132 ) ··· 179 178 180 179 // Start another timer 181 180 NavUtils.openRunningRecordsScreen() 182 - Thread.sleep(1000) 183 181 clickOnView( 184 182 allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name3)) 185 183 ) ··· 375 373 .check(isCompletelyLeftOf(allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name3)))) 376 374 onView(allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name3))) 377 375 .check(isCompletelyLeftOf(allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name1)))) 376 + } 377 + 378 + @Test 379 + fun enableNotifications() { 380 + val name1 = "Test1" 381 + val name2 = "Test2" 382 + 383 + // Add activities 384 + NavUtils.addActivity(name1) 385 + NavUtils.addActivity(name2) 386 + 387 + // Start one timer 388 + clickOnViewWithText(name1) 389 + 390 + // Change settings 391 + NavUtils.openSettingsScreen() 392 + onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 393 + unconstrainedClickOnView(withId(R.id.checkboxSettingsShowNotifications)) 394 + onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 395 + 396 + // Stop first timer 397 + NavUtils.openRunningRecordsScreen() 398 + clickOnView(allOf(withId(R.id.layoutRunningRecordItem), hasDescendant(withText(name1)))) 399 + 400 + // Start another timer 401 + clickOnViewWithText(name2) 402 + 403 + // Change settings 404 + NavUtils.openSettingsScreen() 405 + onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isChecked())) 406 + unconstrainedClickOnView(withId(R.id.checkboxSettingsShowNotifications)) 407 + onView(withId(R.id.checkboxSettingsShowNotifications)).check(matches(isNotChecked())) 378 408 } 379 409 }
+3
app/src/androidTest/java/com/example/util/simpletimetracker/StatisticsFilterTest.kt
··· 47 47 48 48 // Filter untracked 49 49 clickOnViewWithId(R.id.btnStatisticsChartFilter) 50 + Thread.sleep(1000) 50 51 clickOnView( 51 52 allOf( 52 53 isDescendantOfA(withId(R.id.layoutRecordTypeItem)), ··· 62 63 63 64 // Filter activity 64 65 clickOnViewWithId(R.id.btnStatisticsChartFilter) 66 + Thread.sleep(1000) 65 67 clickOnView(allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(name))) 66 68 pressBack() 67 69 checkViewDoesNotExist( ··· 72 74 73 75 // Filter all 74 76 clickOnViewWithId(R.id.btnStatisticsChartFilter) 77 + Thread.sleep(1000) 75 78 clickOnView(allOf(isDescendantOfA(withId(R.id.layoutRecordTypeItem)), withText(newName))) 76 79 pressBack() 77 80 checkViewDoesNotExist(allOf(withText(newName), isCompletelyDisplayed()))
+3 -1
app/src/androidTest/java/com/example/util/simpletimetracker/di/TestAppComponent.kt
··· 14 14 import com.example.util.simpletimetracker.StatisticsRangesTest 15 15 import com.example.util.simpletimetracker.StatisticsTest 16 16 import com.example.util.simpletimetracker.data_local.di.DataLocalModule 17 + import com.example.util.simpletimetracker.feature_notification.di.NotificationModule 17 18 import com.example.util.simpletimetracker.feature_widget.di.WidgetModule 18 19 import com.example.util.simpletimetracker.utils.BaseUiTest 19 20 import dagger.Component ··· 24 25 modules = [ 25 26 AppModule::class, 26 27 DataLocalModule::class, 27 - WidgetModule::class 28 + WidgetModule::class, 29 + NotificationModule::class 28 30 ] 29 31 ) 30 32 interface TestAppComponent: AppComponent {
+2
app/src/androidTest/java/com/example/util/simpletimetracker/utils/NavUtils.kt
··· 29 29 } 30 30 31 31 fun addActivity(name: String, color: Int? = null, icon: Int? = null) { 32 + Thread.sleep(1000) 33 + 32 34 clickOnViewWithText(R.string.running_records_add_type) 33 35 34 36 // Name