CATROID-1596 Fix test 'importActorOrObjectTest'#5151
CATROID-1596 Fix test 'importActorOrObjectTest'#5151hannesweilharter wants to merge 3 commits intoCatrobat:developfrom
Conversation
| @@ -0,0 +1,40 @@ | |||
| /* | |||
Check warning
Code scanning / detekt
Detects missing final newlines Warning
There was a problem hiding this comment.
Please add a newline at the end of the file please.
Frajhamster
left a comment
There was a problem hiding this comment.
Squash all commits into one please!
| @@ -0,0 +1,40 @@ | |||
| /* | |||
There was a problem hiding this comment.
Please add a newline at the end of the file please.
4d551c1 to
1ecda57
Compare
1ecda57 to
d5804f3
Compare
|
| @Before | ||
| @Throws(Exception::class) | ||
| fun setUp() { | ||
| IdlingRegistry.getInstance().register(EspressoIdlingResource.idlingResource) |
There was a problem hiding this comment.
IdlingRegistry.getInstance().register(EspressoIdlingResource.idlingResource)
It's great it works, but I am really not to keen on the solution, since this adds quite some complexity to the test cases tracking every idling resource counter.
There was a problem hiding this comment.
I will try to find a simpler solution
There was a problem hiding this comment.
@dorianpercic do you have an idea on how to fix the tests?
There was a problem hiding this comment.
Hi @dorianpercic @hannesweilharter,
Instead of using EspressoIdlingResource, I was thinking about a possible alternative approach: using a ViewVisibilityIdlingResource that observes the progress_bar in ProjectListFragment. Since the progress bar already represents the loading state, Espresso can naturally wait for it to disappear before proceeding.
The current manual CountingIdlingResource approach feels a bit heavy because it introduces test-specific logic into production code, can be error-prone if increments/decrements are missed, and adds extra maintenance/complexity.
With the view-based approach, we could:
- Keep production code clean (no test-related logic)
- Avoid manual counter tracking
- Rely on UI state, which aligns with actual user behavior
- Make tests more resilient to future changes in async implementation
What do you think about this approach?
There was a problem hiding this comment.
Yes, this sounds good, maybe we can test it if it works.
There was a problem hiding this comment.
@hannesweilharter @dorianpercic I tried this in my project let me know if it looks good, so I’ll push the code in this PR.
17941bc to
adc09f9
Compare
adc09f9 to
bd1739b
Compare
|
@dorianpercic @hannesweilharter I have made the changes and updated it with the new approach I suggested. Please take a look when you have time. |
…Test synchronization
|



ImportLocalSpriteTestCountingIdlingResourcewithViewVisibilityIdlingResourceto monitorprogress_barvisibility.RuntimeExceptionand improve stability across different environments (local & Jenkins).ProjectListFragment.ktand deleted the obsoleteEspressoIdlingResource.kt.ImportLocalSpriteTestfaster and more robust.https://catrobat.atlassian.net/browse/CATROID-1596
Your checklist for this pull request
Please review the contributing guidelines and wiki pages of this repository.