In my case was because I had some animations (UIView.animate...) since the framework needs to wait for the app to be static.
What I did was UIView.setAnimationsEnabled(false) when running the app from the UI tests (you can send launchArguments or something)
Post
Replies
Boosts
Views
Activity
This indicates that compositional layout is trying to resolve layout for a section that doesn't exist in the data source.
This was the issue on my case, however my data source was returning the correct sections (like if the compositional layout had a cache), invalidating the layout worked for me:
collectionView.collectionViewLayout.invalidateLayout()