Something went wrong. Try again.
A fork of Simple Time Tracker with WearOS support. (Now integrated upstream)
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162package com.example.util.simpletimetracker
import androidx.test.core.app.ActivityScenarioimport androidx.test.espresso.matcher.ViewMatchers.hasDescendantimport androidx.test.espresso.matcher.ViewMatchers.withIdimport androidx.test.espresso.matcher.ViewMatchers.withTextimport androidx.test.ext.junit.runners.AndroidJUnit4import com.example.util.simpletimetracker.feature_widget.single.settings.WidgetSingleSettingsActivityimport com.example.util.simpletimetracker.utils.BaseUiTestimport com.example.util.simpletimetracker.utils.Widgetimport com.example.util.simpletimetracker.utils.checkViewDoesNotExistimport com.example.util.simpletimetracker.utils.checkViewIsDisplayedimport com.example.util.simpletimetracker.utils.withCardColorimport dagger.hilt.android.testing.HiltAndroidTestimport org.hamcrest.CoreMatchers.allOfimport org.junit.Testimport org.junit.runner.RunWithimport com.example.util.simpletimetracker.R as coreRimport com.example.util.simpletimetracker.feature_base_adapter.R as baseR
@HiltAndroidTest@Widget@RunWith(AndroidJUnit4::class)class Widget : BaseUiTest() {
private lateinit var scenarioRule: ActivityScenario<WidgetSingleSettingsActivity>
override fun after() { super.after() scenarioRule.close() }
@Test fun widgetConfigure() { val name1 = "TypeName1" val name2 = "TypeName2" val name3 = "TypeName3"
// Add data testUtils.addActivity(name = name1, color = firstColor) testUtils.addActivity(name = name2, color = lastColor) testUtils.addActivity(name = name3, archived = true) scenarioRule = ActivityScenario.launch(WidgetSingleSettingsActivity::class.java)
// Check data checkType(firstColor, name1) checkType(lastColor, name2) checkViewDoesNotExist(withText(name3)) checkViewIsDisplayed(withText(coreR.string.running_records_repeat)) }
private fun checkType(color: Int, name: String) { checkViewIsDisplayed( allOf( withId(baseR.id.viewRecordTypeItem), hasDescendant(withCardColor(color)), hasDescendant(withText(name)), ), ) }}