Skip to content

Commit 34b771a

Browse files
committed
update test
1 parent cdc7a2e commit 34b771a

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ class SettingsTest : BaseUiTest() {
105105
clickOnViewWithText(name3)
106106
var startTime = System.currentTimeMillis()
107107
.let { timeMapper.formatTime(it, true) }
108-
checkViewIsDisplayed(
109-
allOf(
110-
withId(R.id.viewRunningRecordItem),
111-
hasDescendant(withText(name2)),
112-
hasDescendant(withText(startTime))
108+
tryAction {
109+
checkViewIsDisplayed(
110+
allOf(
111+
withId(R.id.viewRunningRecordItem),
112+
hasDescendant(withText(name2)),
113+
hasDescendant(withText(startTime))
114+
)
113115
)
114-
)
116+
}
115117
checkViewIsDisplayed(
116118
allOf(
117119
withId(R.id.viewRunningRecordItem),
@@ -141,13 +143,15 @@ class SettingsTest : BaseUiTest() {
141143
clickOnView(
142144
allOf(isDescendantOfA(withId(R.id.viewRecordTypeItem)), withText(name1))
143145
)
144-
checkViewIsDisplayed(
145-
allOf(
146-
withId(R.id.viewRunningRecordItem),
147-
hasDescendant(withText(name1)),
148-
hasDescendant(withText(startTime))
146+
tryAction {
147+
checkViewIsDisplayed(
148+
allOf(
149+
withId(R.id.viewRunningRecordItem),
150+
hasDescendant(withText(name1)),
151+
hasDescendant(withText(startTime))
152+
)
149153
)
150-
)
154+
}
151155
checkViewDoesNotExist(
152156
allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name2)))
153157
)
@@ -167,13 +171,15 @@ class SettingsTest : BaseUiTest() {
167171
)
168172
startTime = System.currentTimeMillis()
169173
.let { timeMapper.formatTime(it, true) }
170-
checkViewIsDisplayed(
171-
allOf(
172-
withId(R.id.viewRunningRecordItem),
173-
hasDescendant(withText(name2)),
174-
hasDescendant(withText(startTime))
174+
tryAction {
175+
checkViewIsDisplayed(
176+
allOf(
177+
withId(R.id.viewRunningRecordItem),
178+
hasDescendant(withText(name2)),
179+
hasDescendant(withText(startTime))
180+
)
175181
)
176-
)
182+
}
177183
checkViewDoesNotExist(
178184
allOf(withId(R.id.viewRunningRecordItem), hasDescendant(withText(name1)))
179185
)
@@ -196,13 +202,15 @@ class SettingsTest : BaseUiTest() {
196202
)
197203
val newStartTime = System.currentTimeMillis()
198204
.let { timeMapper.formatTime(it, true) }
199-
checkViewIsDisplayed(
200-
allOf(
201-
withId(R.id.viewRunningRecordItem),
202-
hasDescendant(withText(name2)),
203-
hasDescendant(withText(startTime))
205+
tryAction {
206+
checkViewIsDisplayed(
207+
allOf(
208+
withId(R.id.viewRunningRecordItem),
209+
hasDescendant(withText(name2)),
210+
hasDescendant(withText(startTime))
211+
)
204212
)
205-
)
213+
}
206214
checkViewIsDisplayed(
207215
allOf(
208216
withId(R.id.viewRunningRecordItem),

0 commit comments

Comments
 (0)