From e6dfd13bf3ddd4981fe6eef0e9aba448b8f1b879 Mon Sep 17 00:00:00 2001 From: Victor Andreasson Date: Tue, 9 Apr 2024 16:33:25 +0200 Subject: [PATCH] Item position differs with time of day --- .../com/orgzly/android/espresso/NoteEventsTest.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/com/orgzly/android/espresso/NoteEventsTest.kt b/app/src/androidTest/java/com/orgzly/android/espresso/NoteEventsTest.kt index eb3cf520d..4eaa46e14 100644 --- a/app/src/androidTest/java/com/orgzly/android/espresso/NoteEventsTest.kt +++ b/app/src/androidTest/java/com/orgzly/android/espresso/NoteEventsTest.kt @@ -1,6 +1,7 @@ package com.orgzly.android.espresso import android.os.SystemClock +import android.icu.util.Calendar import androidx.test.core.app.ActivityScenario import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click @@ -165,10 +166,16 @@ class NoteEventsTest : OrgzlyTest() { onItemInAgenda(2, R.id.item_head_event_text).check(matches(isDisplayed())) // Today: event - onItemInAgenda(3, R.id.item_head_scheduled_text).check(matches(not(isDisplayed()))) - onItemInAgenda(3, R.id.item_head_deadline_text).check(matches(not(isDisplayed()))) - onItemInAgenda(3, R.id.item_head_event_text).check(matches(isDisplayed())) - + // Item gets a different position close to midnight + if ((Calendar.getInstance().get(Calendar.HOUR_OF_DAY)) < 23) { + onItemInAgenda(3, R.id.item_head_scheduled_text).check(matches(not(isDisplayed()))) + onItemInAgenda(3, R.id.item_head_deadline_text).check(matches(not(isDisplayed()))) + onItemInAgenda(3, R.id.item_head_event_text).check(matches(isDisplayed())) + } else { + onItemInAgenda(4, R.id.item_head_scheduled_text).check(matches(not(isDisplayed()))) + onItemInAgenda(4, R.id.item_head_deadline_text).check(matches(not(isDisplayed()))) + onItemInAgenda(4, R.id.item_head_event_text).check(matches(isDisplayed())) + } // Tomorrow: event onItemInAgenda(5, R.id.item_head_scheduled_text).check(matches(not(isDisplayed()))) onItemInAgenda(5, R.id.item_head_deadline_text).check(matches(not(isDisplayed())))