Something went wrong. Try again.
A fork of Simple Time Tracker with WearOS support. (Now integrated upstream)
Something went wrong. Try again.
SimpleTimeTracker-WearOS app src androidTest java com example util simpletimetracker GoalsOnCardsTest.kt
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495package com.example.util.simpletimetracker
import androidx.test.ext.junit.runners.AndroidJUnit4import com.example.util.simpletimetracker.GoalsTestUtils.checkTypeMarkimport com.example.util.simpletimetracker.GoalsTestUtils.checkNoTypeMarkimport com.example.util.simpletimetracker.utils.BaseUiTestimport com.example.util.simpletimetracker.utils.NavUtilsimport dagger.hilt.android.testing.HiltAndroidTestimport org.junit.Testimport org.junit.runner.RunWithimport java.util.concurrent.TimeUnit
@HiltAndroidTest@RunWith(AndroidJUnit4::class)class GoalsOnCardsTest : BaseUiTest() {
@Test fun noGoals() { val noGoals = "noGoals" val otherGoals = "otherGoals"
// Add data testUtils.addActivity(noGoals) testUtils.addActivity( name = otherGoals, goals = listOf( GoalsTestUtils.getSessionDurationGoal(1), GoalsTestUtils.getWeeklyDurationGoal(1), GoalsTestUtils.getMonthlyDurationGoal(1), GoalsTestUtils.getWeeklyCountGoal(1), GoalsTestUtils.getMonthlyCountGoal(1), ), ) Thread.sleep(1000)
// Check checkNoTypeMark(noGoals) checkNoTypeMark(otherGoals) }
@Test fun checkmarks() { val durationGoal = "durationGoal" val countGoal = "countGoal"
// Add data testUtils.addActivity( name = durationGoal, goals = listOf(GoalsTestUtils.getDailyDurationGoal(2)), ) testUtils.addActivity( name = countGoal, goals = listOf(GoalsTestUtils.getDailyCountGoal(2)), ) Thread.sleep(1000)
// Not reached checkTypeMark(durationGoal, isVisible = false) checkTypeMark(countGoal, isVisible = false)
// Add records NavUtils.openRecordsScreen() val current = System.currentTimeMillis() testUtils.addRecord( typeName = durationGoal, timeStarted = current - TimeUnit.SECONDS.toMillis(1), timeEnded = current, ) testUtils.addRecord( typeName = countGoal, )
// Not reached NavUtils.openRunningRecordsScreen() checkTypeMark(durationGoal, isVisible = false) checkTypeMark(countGoal, isVisible = false)
// Add more records NavUtils.openRecordsScreen() testUtils.addRecord( typeName = durationGoal, timeStarted = current - TimeUnit.SECONDS.toMillis(1), timeEnded = current, ) testUtils.addRecord( typeName = countGoal, )
// Reached NavUtils.openRunningRecordsScreen() checkTypeMark(durationGoal, isVisible = true) checkTypeMark(countGoal, isVisible = true) }}