Skip to content

Commit 3bc4b11

Browse files
committed
MainActivityTest.kt: Drop delay function on Instrumentation Test
Since delay already did with Idling Resource, this wasn't allowed to do in instrumentation test (Dicoding reviewer advice). So it was dropped. delayTwoSecond - Deprecated
1 parent 897b73d commit 3bc4b11

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

Diff for: app/src/androidTest/java/com/dicoding/moviecatalog/activity/MainActivityTest.kt

-46
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class MainActivityTest {
4343

4444
@Test
4545
fun load_A_Movie() {
46-
inlineVariable.delayTwoSecond()
4746
onView(withText("MOVIE")).perform(click())
4847
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
4948
onView(withId(R.id.rv_movie)).perform(
@@ -55,7 +54,6 @@ class MainActivityTest {
5554

5655
@Test
5756
fun load_B_DetailMovie() {
58-
inlineVariable.delayTwoSecond()
5957
onView(withText("MOVIE")).perform(click())
6058
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
6159
onView(withId(R.id.rv_movie)).perform(
@@ -64,7 +62,6 @@ class MainActivityTest {
6462
click()
6563
)
6664
)
67-
inlineVariable.delayTwoSecond()
6865
onView(withId(R.id.movie_title_text)).check(matches(isDisplayed()))
6966
onView(withId(R.id.movie_title_text)).check(matches(withText(dummySelectedMovie.title)))
7067
onView(withId(R.id.movie_release_date)).check(matches(isDisplayed()))
@@ -79,7 +76,6 @@ class MainActivityTest {
7976
onView(withId(R.id.movie_revenue_text)).check(matches(withText(revenue)))
8077
onView(withId(R.id.desc_text)).check(matches(isDisplayed()))
8178
onView(withId(R.id.desc_text)).check(matches(withText(dummySelectedMovie.overview)))
82-
inlineVariable.delayTwoSecond()
8379
onView(withId(R.id.cv_genre_1)).check(matches(isDisplayed()))
8480
onView(withId(R.id.movie_genre_text_1)).check(matches(withText(dummySelectedMovie.genres_1)))
8581
onView(withId(R.id.cv_genre_2)).check(matches(isDisplayed()))
@@ -96,7 +92,6 @@ class MainActivityTest {
9692

9793
@Test
9894
fun load_C_ShareMovie() {
99-
inlineVariable.delayTwoSecond()
10095
onView(withText("MOVIE")).perform(click())
10196
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
10297
onView(withId(R.id.rv_movie)).perform(
@@ -105,7 +100,6 @@ class MainActivityTest {
105100
click()
106101
)
107102
)
108-
inlineVariable.delayTwoSecond()
109103
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
110104
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
111105
onView(withId(R.id.menu_fab)).perform(click())
@@ -116,7 +110,6 @@ class MainActivityTest {
116110

117111
@Test
118112
fun load_D_addFavMovies() {
119-
inlineVariable.delayTwoSecond()
120113
onView(withText("MOVIE")).perform(click())
121114
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
122115
onView(withId(R.id.rv_movie)).perform(
@@ -125,15 +118,13 @@ class MainActivityTest {
125118
click()
126119
)
127120
)
128-
inlineVariable.delayTwoSecond()
129121
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
130122
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
131123
onView(withId(R.id.menu_fab)).perform(click())
132124
onView(withId(R.id.sus_fab)).check(matches(isDisplayed()))
133125
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
134126
onView(withId(R.id.sus_fab)).perform(click())
135127
Espresso.pressBackUnconditionally()
136-
inlineVariable.delayTwoSecond()
137128
onView(withText("MOVIE")).perform(click())
138129
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
139130
onView(withId(R.id.rv_movie)).perform(
@@ -142,15 +133,13 @@ class MainActivityTest {
142133
click()
143134
)
144135
)
145-
inlineVariable.delayTwoSecond()
146136
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
147137
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
148138
onView(withId(R.id.menu_fab)).perform(click())
149139
onView(withId(R.id.sus_fab)).check(matches(isDisplayed()))
150140
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
151141
onView(withId(R.id.sus_fab)).perform(click())
152142
Espresso.pressBackUnconditionally()
153-
inlineVariable.delayTwoSecond()
154143
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
155144
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
156145
onView(withId(R.id.sus_list_fab)).perform(click())
@@ -168,15 +157,13 @@ class MainActivityTest {
168157

169158
@Test
170159
fun load_F_sortFavMoviesAsc() {
171-
inlineVariable.delayTwoSecond()
172160
onView(withText("MOVIE")).perform(click())
173161
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
174162
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
175163
onView(withId(R.id.sus_list_fab)).perform(click())
176164
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
177165
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
178166
onView(withId(R.id.sus_fav_fab)).perform(click())
179-
inlineVariable.delayTwoSecond()
180167
onView(withText("MOVIE")).perform(click())
181168
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
182169
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
@@ -185,21 +172,18 @@ class MainActivityTest {
185172
onView(withId(R.id.sus_order_asc)).check(matches(isDisplayed()))
186173
onView(withId(R.id.sus_order_asc)).check(matches(isClickable()))
187174
onView(withId(R.id.sus_order_asc)).perform(click())
188-
inlineVariable.delayTwoSecond()
189175
Espresso.pressBackUnconditionally()
190176
}
191177

192178
@Test
193179
fun load_E_sortFavMoviesDesc() {
194-
inlineVariable.delayTwoSecond()
195180
onView(withText("MOVIE")).perform(click())
196181
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
197182
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
198183
onView(withId(R.id.sus_list_fab)).perform(click())
199184
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
200185
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
201186
onView(withId(R.id.sus_fav_fab)).perform(click())
202-
inlineVariable.delayTwoSecond()
203187
onView(withText("MOVIE")).perform(click())
204188
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
205189
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
@@ -208,21 +192,18 @@ class MainActivityTest {
208192
onView(withId(R.id.sus_order_desc)).check(matches(isDisplayed()))
209193
onView(withId(R.id.sus_order_desc)).check(matches(isClickable()))
210194
onView(withId(R.id.sus_order_desc)).perform(click())
211-
inlineVariable.delayTwoSecond()
212195
Espresso.pressBackUnconditionally()
213196
}
214197

215198
@Test
216199
fun load_G_removeFavMovies() {
217-
inlineVariable.delayTwoSecond()
218200
onView(withText("MOVIE")).perform(click())
219201
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
220202
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
221203
onView(withId(R.id.sus_list_fab)).perform(click())
222204
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
223205
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
224206
onView(withId(R.id.sus_fav_fab)).perform(click())
225-
inlineVariable.delayTwoSecond()
226207
onView(withText("MOVIE")).perform(click())
227208
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
228209
onView(withId(R.id.rv_movie)).perform(
@@ -237,7 +218,6 @@ class MainActivityTest {
237218
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
238219
onView(withId(R.id.sus_fab)).perform(click())
239220
Espresso.pressBackUnconditionally()
240-
inlineVariable.delayTwoSecond()
241221
onView(withId(R.id.rv_movie)).check(matches(isDisplayed()))
242222
onView(withId(R.id.rv_movie)).perform(
243223
RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>(
@@ -250,13 +230,11 @@ class MainActivityTest {
250230
onView(withId(R.id.sus_fab)).check(matches(isDisplayed()))
251231
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
252232
onView(withId(R.id.sus_fab)).perform(click())
253-
inlineVariable.delayTwoSecond()
254233
Espresso.pressBackUnconditionally()
255234
}
256235

257236
@Test
258237
fun load_H_TvShow() {
259-
inlineVariable.delayTwoSecond()
260238
onView(withText("TV SHOW")).perform(click())
261239
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
262240
onView(withId(R.id.rv_tvshow)).perform(
@@ -268,7 +246,6 @@ class MainActivityTest {
268246

269247
@Test
270248
fun load_I_DetailTvShow() {
271-
inlineVariable.delayTwoSecond()
272249
onView(withText("TV SHOW")).perform(click())
273250
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
274251
onView(withId(R.id.rv_tvshow)).perform(
@@ -277,7 +254,6 @@ class MainActivityTest {
277254
click()
278255
)
279256
)
280-
inlineVariable.delayTwoSecond()
281257
onView(withId(R.id.movie_title_text)).check(matches(isDisplayed()))
282258
onView(withId(R.id.movie_title_text)).check(matches(withText(dummySelectedTvShow.tvShowName)))
283259
onView(withId(R.id.movie_release_date)).check(matches(isDisplayed()))
@@ -301,7 +277,6 @@ class MainActivityTest {
301277
onView(withId(R.id.tvShow_language_text)).check(matches(withText(dummySelectedTvShow.tvShowLanguage)))
302278
onView(withId(R.id.desc_text)).check(matches(isDisplayed()))
303279
onView(withId(R.id.desc_text)).check(matches(withText(dummySelectedTvShow.tvShowOverview)))
304-
inlineVariable.delayTwoSecond()
305280
onView(withId(R.id.cv_genre_1)).check(matches(isDisplayed()))
306281
onView(withId(R.id.movie_genre_text_1)).check(matches(withText(dummySelectedTvShow.tvShowGenres_1)))
307282
onView(withId(R.id.cv_genre_2)).check(matches(isDisplayed()))
@@ -330,7 +305,6 @@ class MainActivityTest {
330305

331306
@Test
332307
fun load_J_ShareTvShow() {
333-
inlineVariable.delayTwoSecond()
334308
onView(withText("TV SHOW")).perform(click())
335309
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
336310
onView(withId(R.id.rv_tvshow)).perform(
@@ -339,7 +313,6 @@ class MainActivityTest {
339313
click()
340314
)
341315
)
342-
inlineVariable.delayTwoSecond()
343316
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
344317
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
345318
onView(withId(R.id.menu_fab)).perform(click())
@@ -350,7 +323,6 @@ class MainActivityTest {
350323

351324
@Test
352325
fun load_K_addFavTvShow() {
353-
inlineVariable.delayTwoSecond()
354326
onView(withText("TV SHOW")).perform(click())
355327
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
356328
onView(withId(R.id.rv_tvshow)).perform(
@@ -359,15 +331,13 @@ class MainActivityTest {
359331
click()
360332
)
361333
)
362-
inlineVariable.delayTwoSecond()
363334
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
364335
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
365336
onView(withId(R.id.menu_fab)).perform(click())
366337
onView(withId(R.id.sus_fab)).check(matches(isDisplayed()))
367338
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
368339
onView(withId(R.id.sus_fab)).perform(click())
369340
Espresso.pressBackUnconditionally()
370-
inlineVariable.delayTwoSecond()
371341
onView(withText("TV SHOW")).perform(click())
372342
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
373343
onView(withId(R.id.rv_tvshow)).perform(
@@ -376,15 +346,13 @@ class MainActivityTest {
376346
click()
377347
)
378348
)
379-
inlineVariable.delayTwoSecond()
380349
onView(withId(R.id.menu_fab)).check(matches(isDisplayed()))
381350
onView(withId(R.id.menu_fab)).check(matches(isClickable()))
382351
onView(withId(R.id.menu_fab)).perform(click())
383352
onView(withId(R.id.sus_fab)).check(matches(isDisplayed()))
384353
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
385354
onView(withId(R.id.sus_fab)).perform(click())
386355
Espresso.pressBackUnconditionally()
387-
inlineVariable.delayTwoSecond()
388356
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
389357
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
390358
onView(withId(R.id.sus_list_fab)).perform(click())
@@ -402,15 +370,13 @@ class MainActivityTest {
402370

403371
@Test
404372
fun load_M_sortFavTvShowAsc() {
405-
inlineVariable.delayTwoSecond()
406373
onView(withText("TV SHOW")).perform(click())
407374
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
408375
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
409376
onView(withId(R.id.sus_list_fab)).perform(click())
410377
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
411378
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
412379
onView(withId(R.id.sus_fav_fab)).perform(click())
413-
inlineVariable.delayTwoSecond()
414380
onView(withText("TV SHOW")).perform(click())
415381
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
416382
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
@@ -419,21 +385,18 @@ class MainActivityTest {
419385
onView(withId(R.id.sus_order_asc)).check(matches(isDisplayed()))
420386
onView(withId(R.id.sus_order_asc)).check(matches(isClickable()))
421387
onView(withId(R.id.sus_order_asc)).perform(click())
422-
inlineVariable.delayTwoSecond()
423388
Espresso.pressBackUnconditionally()
424389
}
425390

426391
@Test
427392
fun load_L_sortFavTvShowDesc() {
428-
inlineVariable.delayTwoSecond()
429393
onView(withText("TV SHOW")).perform(click())
430394
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
431395
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
432396
onView(withId(R.id.sus_list_fab)).perform(click())
433397
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
434398
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
435399
onView(withId(R.id.sus_fav_fab)).perform(click())
436-
inlineVariable.delayTwoSecond()
437400
onView(withText("TV SHOW")).perform(click())
438401
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
439402
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
@@ -442,21 +405,18 @@ class MainActivityTest {
442405
onView(withId(R.id.sus_order_desc)).check(matches(isDisplayed()))
443406
onView(withId(R.id.sus_order_desc)).check(matches(isClickable()))
444407
onView(withId(R.id.sus_order_desc)).perform(click())
445-
inlineVariable.delayTwoSecond()
446408
Espresso.pressBackUnconditionally()
447409
}
448410

449411
@Test
450412
fun load_N_removeFavTvShow() {
451-
inlineVariable.delayTwoSecond()
452413
onView(withText("TV SHOW")).perform(click())
453414
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
454415
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
455416
onView(withId(R.id.sus_list_fab)).perform(click())
456417
onView(withId(R.id.sus_fav_fab)).check(matches(isDisplayed()))
457418
onView(withId(R.id.sus_fav_fab)).check(matches(isClickable()))
458419
onView(withId(R.id.sus_fav_fab)).perform(click())
459-
inlineVariable.delayTwoSecond()
460420
onView(withText("TV SHOW")).perform(click())
461421
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
462422
onView(withId(R.id.rv_tvshow)).perform(
@@ -471,7 +431,6 @@ class MainActivityTest {
471431
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
472432
onView(withId(R.id.sus_fab)).perform(click())
473433
Espresso.pressBackUnconditionally()
474-
inlineVariable.delayTwoSecond()
475434
onView(withText("TV SHOW")).perform(click())
476435
onView(withId(R.id.rv_tvshow)).check(matches(isDisplayed()))
477436
onView(withId(R.id.rv_tvshow)).perform(
@@ -486,14 +445,12 @@ class MainActivityTest {
486445
onView(withId(R.id.sus_fab)).check(matches(isClickable()))
487446
onView(withId(R.id.sus_fab)).perform(click())
488447
Espresso.pressBackUnconditionally()
489-
inlineVariable.delayTwoSecond()
490448
onView(withText("TV SHOW")).perform(click())
491449
Espresso.pressBackUnconditionally()
492450
}
493451

494452
@Test
495453
fun load_P_sortMovieAsc() {
496-
inlineVariable.delayTwoSecond()
497454
onView(withText("MOVIE")).perform(click())
498455
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
499456
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
@@ -505,7 +462,6 @@ class MainActivityTest {
505462

506463
@Test
507464
fun load_O_sortMovieDesc() {
508-
inlineVariable.delayTwoSecond()
509465
onView(withText("MOVIE")).perform(click())
510466
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
511467
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
@@ -517,7 +473,6 @@ class MainActivityTest {
517473

518474
@Test
519475
fun load_R_sortTvShowAsc() {
520-
inlineVariable.delayTwoSecond()
521476
onView(withText("TV SHOW")).perform(click())
522477
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
523478
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))
@@ -529,7 +484,6 @@ class MainActivityTest {
529484

530485
@Test
531486
fun load_Q_sortTvShowDesc() {
532-
inlineVariable.delayTwoSecond()
533487
onView(withText("TV SHOW")).perform(click())
534488
onView(withId(R.id.sus_list_fab)).check(matches(isDisplayed()))
535489
onView(withId(R.id.sus_list_fab)).check(matches(isClickable()))

0 commit comments

Comments
 (0)