Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Fix risk card detail screenshots and device time (EXPOSUREAPP-5970) #…
Browse files Browse the repository at this point in the history
…2688

* Fix risk card detail screenshots and device time (EXPOSUREAPP-5970)

* remove firebase_screenshots task again
  • Loading branch information
ralfgehrer authored Mar 25, 2021
1 parent 1e00b6f commit 0237c53
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import io.mockk.spyk
import org.joda.time.LocalDate
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import testhelpers.BaseUITest
import testhelpers.Screenshot
import testhelpers.SystemUIDemoModeRule
import testhelpers.TestDispatcherProvider
import testhelpers.launchFragment2
import testhelpers.launchInMainActivity
Expand All @@ -47,6 +49,9 @@ class ContactDiaryOverviewFragmentTest : BaseUITest() {

private lateinit var viewModel: ContactDiaryOverviewViewModel

@get:Rule
val systemUIDemoModeRule = SystemUIDemoModeRule()

@Before
fun setup() {
MockKAnnotations.init(this, relaxed = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ import java.util.Date

object HomeData {

private val todayAtNineFiftyFive = Instant.now().toDateTime()
.withTime(9,55,0,0).toInstant()

object Tracing {

val LOW_RISK_ITEM_NO_ENCOUNTERS = LowRiskCard.Item(
state = LowRisk(
riskState = RiskState.LOW_RISK,
isInDetailsMode = false,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
lastEncounterAt = null,
allowManualUpdate = false,
daysWithEncounters = 0,
Expand All @@ -53,8 +56,8 @@ object HomeData {
state = LowRisk(
riskState = RiskState.LOW_RISK,
isInDetailsMode = false,
lastExposureDetectionTime = Instant.now(),
lastEncounterAt = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
lastEncounterAt = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 1,
daysSinceInstallation = 4
Expand All @@ -67,10 +70,10 @@ object HomeData {
state = IncreasedRisk(
riskState = RiskState.INCREASED_RISK,
isInDetailsMode = false,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 1,
lastEncounterAt = Instant.now()
lastEncounterAt = todayAtNineFiftyFive
),
onCardClick = {},
onUpdateClick = {}
Expand All @@ -80,7 +83,7 @@ object HomeData {
state = TracingDisabled(
riskState = RiskState.LOW_RISK,
isInDetailsMode = false,
lastExposureDetectionTime = Instant.now()
lastExposureDetectionTime = todayAtNineFiftyFive
),
onCardClick = {},
onEnableTracingClick = {}
Expand All @@ -99,7 +102,7 @@ object HomeData {
state = TracingFailed(
riskState = RiskState.CALCULATION_FAILED,
isInDetailsMode = false,
lastExposureDetectionTime = Instant.now()
lastExposureDetectionTime = todayAtNineFiftyFive
),
onCardClick = {},
onRetryClick = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ import io.mockk.spyk
import io.mockk.verify
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import testhelpers.BaseUITest
import testhelpers.Screenshot
import testhelpers.SystemUIDemoModeRule
import testhelpers.TestDispatcherProvider
import testhelpers.launchFragment2
import testhelpers.launchInMainActivity
Expand All @@ -72,6 +74,9 @@ class HomeFragmentTest : BaseUITest() {

private lateinit var homeFragmentViewModel: HomeFragmentViewModel

@get:Rule
val systemUIDemoModeRule = SystemUIDemoModeRule()

@Before
fun setup() {
MockKAnnotations.init(this, relaxed = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import org.joda.time.Instant

object TracingData {

private val todayAtNineFiftyFive = Instant.now().toDateTime()
.withTime(9,55,0,0).toInstant()

val TRACING_DISABLED = Pair(
TracingDetailsState(
tracingStatus = GeneralTracingStatus.Status.TRACING_INACTIVE,
Expand All @@ -32,7 +35,7 @@ object TracingData {
state = TracingDisabled(
riskState = RiskState.LOW_RISK,
isInDetailsMode = true,
lastExposureDetectionTime = Instant.now()
lastExposureDetectionTime = todayAtNineFiftyFive
)
),
BehaviorNormalRiskBox.Item(
Expand All @@ -52,18 +55,18 @@ object TracingData {
TracingDetailsState(
tracingStatus = GeneralTracingStatus.Status.TRACING_ACTIVE,
riskState = RiskState.LOW_RISK,
isManualKeyRetrievalEnabled = false
isManualKeyRetrievalEnabled = false,
),
listOf(
LowRiskBox.Item(
state = LowRisk(
riskState = RiskState.LOW_RISK,
isInDetailsMode = true,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 0,
daysSinceInstallation = 4,
lastEncounterAt = Instant.now()
lastEncounterAt = null
)
),
BehaviorNormalRiskBox.Item(
Expand All @@ -90,11 +93,11 @@ object TracingData {
state = LowRisk(
riskState = RiskState.LOW_RISK,
isInDetailsMode = true,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 1,
daysSinceInstallation = 4,
lastEncounterAt = Instant.now()
lastEncounterAt = todayAtNineFiftyFive
)
),
BehaviorNormalRiskBox.Item(
Expand All @@ -121,11 +124,11 @@ object TracingData {
state = LowRisk(
riskState = RiskState.LOW_RISK,
isInDetailsMode = true,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 2,
daysSinceInstallation = 4,
lastEncounterAt = Instant.now()
lastEncounterAt = todayAtNineFiftyFive
)
),
BehaviorNormalRiskBox.Item(
Expand All @@ -152,10 +155,10 @@ object TracingData {
state = IncreasedRisk(
riskState = RiskState.INCREASED_RISK,
isInDetailsMode = true,
lastExposureDetectionTime = Instant.now(),
lastExposureDetectionTime = todayAtNineFiftyFive,
allowManualUpdate = false,
daysWithEncounters = 1,
lastEncounterAt = Instant.now()
lastEncounterAt = todayAtNineFiftyFive
)
),
BehaviorIncreasedRiskBox.Item,
Expand All @@ -165,7 +168,7 @@ object TracingData {
),
DetailsIncreasedRiskBox.Item(
riskState = RiskState.INCREASED_RISK,
lastEncounteredAt = Instant.now()
lastEncounteredAt = todayAtNineFiftyFive
)
)
)
Expand Down

0 comments on commit 0237c53

Please sign in to comment.