Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run Espresso tests when using FlexboxLayout/FlexboxLayoutManager + RecyclerView in combination with NestedScrollView #547

Closed
1 task done
j1c1m1b1 opened this issue Apr 20, 2020 · 2 comments

Comments

@j1c1m1b1
Copy link

Issues and steps to reproduce

  • Have a RecyclerView and add a FlexboxLayout in the item layout of each adapter item.
  • Create instrumented tests that launch a fragment containing the adapter
  • The tests fail after 60 seconds waiting to the UI to be idle

Additional Info

  • When setting the FlexboxLayout visibility to GONE the issue is not present anymore.

Expected behavior

*Tests run without issue

Version of the flexbox library

  • 2.0.1

Link to code

Fragment XML (snippet)

<androidx.core.widget.NestedScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/btnApply"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/toolbar">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvSorting"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                tools:listitem="@layout/list_item_sort" />

            <include
                android:id="@+id/layoutBrands"
                layout="@layout/layout_brand_selection" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvFilters"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:listitem="@layout/list_item_filter_group" />
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

Item XML

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/groupName"
        style="@style/TextStyle.Headline.NormalCaps"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/margin_normal"
        android:textSize="@dimen/filter_tv_title_text_size"
        app:layout_constraintBottom_toTopOf="@id/flexItems"
        app:layout_constraintEnd_toStartOf="@id/tvShowAll"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Größe" />

    <TextView
        android:id="@+id/tvShowAll"
        style="@style/TextStyle.KeyColor"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/margin_normal"
        android:gravity="end"
        android:text="@string/filter_toggle_all"
        app:layout_constraintBottom_toBottomOf="@id/groupName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/groupName" />

    <com.google.android.flexbox.FlexboxLayout
        android:id="@+id/flexItems"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/margin_normal"
        android:layout_marginEnd="@dimen/margin_normal"
        android:layout_marginBottom="@dimen/margin_normal"
        app:flexDirection="row"
        app:flexWrap="wrap"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/groupName" />
</androidx.constraintlayout.widget.ConstraintLayout>
@j1c1m1b1
Copy link
Author

The issue was not related to FlexboxLayout I apologise for this.

@moshlp
Copy link

moshlp commented Dec 9, 2022

@j1c1m1b1 how did you solve it? same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants