android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.36k stars 8.28k forks source link

[PagingSample] UI test fails #1075

Open JoseAlcerreca opened 1 year ago

JoseAlcerreca commented 1 year ago

This test passes locally in API 29 and 33 but fails on CI

    @Test
    @UiThread
    fun showSomeResults() {
        val intent = Intent(ApplicationProvider.getApplicationContext(), MainActivity::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        ActivityScenario.launch<MainActivity>(intent)
        onView(withId(R.id.cheeseList)).check { view, noViewFoundException ->
            if (noViewFoundException != null) {
                throw noViewFoundException
            }

            val recyclerView = view as RecyclerView
            assertThat(recyclerView.adapter).isNotNull()
            assertThat(recyclerView.adapter!!.itemCount).isGreaterThan(0)
        }
    }

https://github.com/android/architecture-components-samples/actions/runs/3881734623/jobs/6621073798

paging.android.example.com.pagingsample.MainActivityTest > showSomeResults[test(AVD) - 8.0.0] FAILED 
    androidx.test.espresso.base.AssertionErrorHandler$AssertionFailedWithCauseError: expected to be greater than: 0
    but was                    : 0
Tests on test(AVD) - 8.0.0 failed: There was 1 failure(s).