Skip to content

Commit 5ed4f23

Browse files
committed
change archive tests
1 parent 6f6b7e8 commit 5ed4f23

File tree

1 file changed

+64
-6
lines changed
  • app/src/androidTest/java/com/example/util/simpletimetracker

1 file changed

+64
-6
lines changed

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

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,36 @@ class ArchiveTest : BaseUiTest() {
135135
@Test
136136
fun archivedRecordTag() {
137137
val name1 = "TypeName1"
138-
val tag1 = "TagName1"
139-
val tag2 = "TagName2"
138+
val tag1 = "Tag1"
139+
val tag2 = "Tag2"
140+
val tag3 = "Tag3"
141+
val tag4 = "Tag4"
140142

141143
testUtils.addActivity(name1)
142144
testUtils.addRecord(name1)
143145
testUtils.addRecordTag(tag1, name1)
144146
testUtils.addRecordTag(tag2, name1)
147+
testUtils.addRecordTag(tag3)
148+
testUtils.addRecordTag(tag4)
145149

146150
NavUtils.openSettingsScreen()
147151
onView(withId(R.id.checkboxSettingsShowRecordTagSelection)).perform(nestedScrollTo())
148152
unconstrainedClickOnView(withId(R.id.checkboxSettingsShowRecordTagSelection))
149153
NavUtils.openCategoriesScreen()
150154
checkTagVisible(tag1)
151155
checkTagVisible(tag2)
156+
checkTagVisible(tag3)
157+
checkTagVisible(tag4)
152158

153159
// Delete one
154160
clickOnView(withText(tag2))
155161
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
162+
clickOnView(withText(tag4))
163+
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
156164
checkTagVisible(tag1)
157165
checkTagNotVisible(tag2)
166+
checkTagVisible(tag3)
167+
checkTagNotVisible(tag4)
158168
pressBack()
159169

160170
// Not shown on records
@@ -166,6 +176,8 @@ class ArchiveTest : BaseUiTest() {
166176
clickOnViewWithText(R.string.change_record_category_field)
167177
checkTagVisible(tag1)
168178
checkTagNotVisible(tag2)
179+
checkTagVisible(tag3)
180+
checkTagNotVisible(tag4)
169181
pressBack()
170182

171183
// Still shown in stat detail filter
@@ -174,6 +186,8 @@ class ArchiveTest : BaseUiTest() {
174186
clickOnViewWithId(R.id.cardStatisticsDetailFilter)
175187
checkTagVisible(tag1)
176188
checkTagVisible(tag2)
189+
checkTagVisible(tag3)
190+
checkTagVisible(tag4)
177191
pressBack()
178192
pressBack()
179193

@@ -182,6 +196,8 @@ class ArchiveTest : BaseUiTest() {
182196
clickOnView(allOf(withText(name1), isCompletelyDisplayed()))
183197
checkTagVisible(tag1)
184198
checkTagNotVisible(tag2)
199+
checkTagVisible(tag3)
200+
checkTagNotVisible(tag4)
185201
pressBack()
186202
tryAction { clickOnView(allOf(isDescendantOfA(withId(R.id.viewRunningRecordItem)), withText(name1))) }
187203

@@ -190,14 +206,20 @@ class ArchiveTest : BaseUiTest() {
190206
NavUtils.openArchiveScreen()
191207
checkTagNotVisible(tag1)
192208
checkTagVisible(tag2)
209+
checkTagNotVisible(tag3)
210+
checkTagVisible(tag4)
193211

194212
// Restore
195213
clickOnViewWithText(tag2)
196214
clickOnViewWithText(R.string.archive_dialog_restore)
215+
clickOnViewWithText(tag4)
216+
clickOnViewWithText(R.string.archive_dialog_restore)
197217

198218
// Archive is empty
199219
checkTagNotVisible(tag1)
200220
checkTagNotVisible(tag2)
221+
checkTagNotVisible(tag3)
222+
checkTagNotVisible(tag4)
201223
checkViewIsDisplayed(withText(R.string.archive_empty))
202224
pressBack()
203225

@@ -206,25 +228,33 @@ class ArchiveTest : BaseUiTest() {
206228
clickOnView(allOf(withText(name1), isCompletelyDisplayed()))
207229
checkTagVisible(tag1)
208230
checkTagVisible(tag2)
231+
checkTagVisible(tag3)
232+
checkTagVisible(tag4)
209233
pressBack()
210234
}
211235

212236
@Test
213237
fun archiveDeletionStatistics() {
214238
val name1 = "TypeName1"
215239
val name2 = "TypeName2"
216-
val tag1 = "TagName1"
217-
val tag2 = "TagName2"
240+
val tag1 = "Tag1"
241+
val tag2 = "Tag2"
242+
val tag3 = "Tag3"
243+
val tag4 = "Tag4"
218244

219245
testUtils.addActivity(name1)
220246
testUtils.addActivity(name2)
221247

222248
testUtils.addRecordTag(tag1, name1)
223249
testUtils.addRecordTag(tag2, name1)
250+
testUtils.addRecordTag(tag3)
251+
testUtils.addRecordTag(tag4)
224252

225253
testUtils.addRecord(name1, tagNames = listOf(tag1))
226254
testUtils.addRecord(name1, tagNames = listOf(tag1))
227255
testUtils.addRecord(name1, tagNames = listOf(tag1))
256+
testUtils.addRecord(name1, tagNames = listOf(tag3))
257+
testUtils.addRecord(name1, tagNames = listOf(tag1, tag3))
228258
testUtils.addRecord(name1)
229259

230260
// Delete
@@ -238,6 +268,10 @@ class ArchiveTest : BaseUiTest() {
238268
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
239269
tryAction { clickOnViewWithText(tag2) }
240270
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
271+
tryAction { clickOnViewWithText(tag3) }
272+
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
273+
tryAction { clickOnViewWithText(tag4) }
274+
clickOnViewWithId(R.id.btnChangeRecordTagDelete)
241275
pressBack()
242276

243277
// Check archive
@@ -246,14 +280,16 @@ class ArchiveTest : BaseUiTest() {
246280
checkTypeVisible(name2)
247281
checkTagVisible(tag1)
248282
checkTagVisible(tag2)
283+
checkTagVisible(tag3)
284+
checkTagVisible(tag4)
249285

250286
// Check activity with data
251287
clickOnViewWithText(name1)
252288
checkViewIsDisplayed(
253289
allOf(
254290
withId(R.id.layoutArchiveDialogInfoItem),
255291
hasDescendant(withText(R.string.archive_records_count)),
256-
hasDescendant(withText("4"))
292+
hasDescendant(withText("6"))
257293
)
258294
)
259295
checkViewIsDisplayed(
@@ -289,7 +325,7 @@ class ArchiveTest : BaseUiTest() {
289325
allOf(
290326
withId(R.id.layoutArchiveDialogInfoItem),
291327
hasDescendant(withText(R.string.archive_tagged_records_count)),
292-
hasDescendant(withText("3"))
328+
hasDescendant(withText("4"))
293329
)
294330
)
295331
pressBack()
@@ -303,6 +339,28 @@ class ArchiveTest : BaseUiTest() {
303339
hasDescendant(withText("0"))
304340
)
305341
)
342+
pressBack()
343+
344+
// Check general tag with data
345+
clickOnViewWithText(tag3)
346+
checkViewIsDisplayed(
347+
allOf(
348+
withId(R.id.layoutArchiveDialogInfoItem),
349+
hasDescendant(withText(R.string.archive_tagged_records_count)),
350+
hasDescendant(withText("2"))
351+
)
352+
)
353+
pressBack()
354+
355+
// Check general tag with no data
356+
clickOnViewWithText(tag4)
357+
checkViewIsDisplayed(
358+
allOf(
359+
withId(R.id.layoutArchiveDialogInfoItem),
360+
hasDescendant(withText(R.string.archive_tagged_records_count)),
361+
hasDescendant(withText("0"))
362+
)
363+
)
306364
}
307365

308366
private fun checkTypeVisible(name: String) {

0 commit comments

Comments
 (0)