Skip to content

CATROID-1596 Fix test 'importActorOrObjectTest'#5151

Open
hannesweilharter wants to merge 3 commits intoCatrobat:developfrom
hannesweilharter:CATROID-1596
Open

CATROID-1596 Fix test 'importActorOrObjectTest'#5151
hannesweilharter wants to merge 3 commits intoCatrobat:developfrom
hannesweilharter:CATROID-1596

Conversation

@hannesweilharter
Copy link
Copy Markdown
Contributor

@hannesweilharter hannesweilharter commented Feb 15, 2026

  • fix all tests of ImportLocalSpriteTest
  • View-based Synchronization: Replaced manual CountingIdlingResource with ViewVisibilityIdlingResource to monitor progress_bar visibility.
  • Thread Safety Fix: Informed the idling check to avoid RuntimeException and improve stability across different environments (local & Jenkins).
  • Production Cleanup: Removed all test-specific logic from ProjectListFragment.kt and deleted the obsolete EspressoIdlingResource.kt.
  • Test Reliability: Removed redundant manual waits, making ImportLocalSpriteTest faster 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.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer

@@ -0,0 +1,40 @@
/*

Check warning

Code scanning / detekt

Detects missing final newlines Warning

File must end with a newline (\n)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline at the end of the file please.

@reichli reichli added the Active Member Tickets that are assigned to members that are still currently active label Feb 20, 2026
Copy link
Copy Markdown
Contributor

@Frajhamster Frajhamster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squash all commits into one please!

@@ -0,0 +1,40 @@
/*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline at the end of the file please.

Copy link
Copy Markdown
Contributor

@Frajhamster Frajhamster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@sonarqubecloud
Copy link
Copy Markdown

@Before
@Throws(Exception::class)
fun setUp() {
IdlingRegistry.getInstance().register(EspressoIdlingResource.idlingResource)
Copy link
Copy Markdown
Contributor

@dorianpercic dorianpercic Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to find a simpler solution

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dorianpercic do you have an idea on how to fix the tests?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this sounds good, maybe we can test it if it works.

Copy link
Copy Markdown
Member

@harshsomankar123-tech harshsomankar123-tech Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannesweilharter @dorianpercic I tried this in my project let me know if it looks good, so I’ll push the code in this PR.

@harshsomankar123-tech
Copy link
Copy Markdown
Member

@dorianpercic @hannesweilharter I have made the changes and updated it with the new approach I suggested. Please take a look when you have time.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Active Member Tickets that are assigned to members that are still currently active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants