-
Notifications
You must be signed in to change notification settings - Fork 80
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
Implement idling resources for tests. #599
Implement idling resources for tests. #599
Conversation
@@ -137,4 +140,45 @@ class BasicTestTest { | |||
} | |||
} | |||
} | |||
|
|||
@Test | |||
fun testIdlingResource() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this test live in "skikoTest" with @IgnoreJsTarget
to run it for k/native too?
In skikoTests, instead of the rule there is a method "runSkikoComposeUiTest" in the scope of which setContent
and registerIdlingResource
should be available.
If more tests from in this file can be in "skikoTests", then maybe it's better to do it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now I'm working on replicating Android's test API (which uses rule
), so I prefer to test with that. Later on, we can work on commonizing the test API, and we'll probably move/copy some tests into common (without rule
).
@@ -243,6 +257,9 @@ class SkikoComposeUiTest( | |||
while (!isIdle()) { | |||
renderNextFrame() | |||
uncaughtExceptionHandler.throwUncaught() | |||
if (!areAllResourcesIdle()) { | |||
delay(IDLING_RESOURCES_CHECK_INTERVAL_MS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so JS tests should avoid using "waitForIdle" and use "awaitIdle" instead within TestScope (coroutine scope). Then idling resources should work there too, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I was thinking, but the problem is that all the automatic synchronization (following setContent
and when you do onNode(...)
) calls waitForIdle
. So to use it with JS we'll need a new, async, API for those calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! the comments are just questions/suggestions.
4456da3
to
898d00e
Compare
af278e5
to
ba3e64f
Compare
Proposed Changes
Implement support for idling resources in
SkikoComposeUiTest
.Note that the typical way idling resources are used requires
sleep
(and doesn't make sense in a single-threaded environment), so I added it as an expect/actual, with the JS implementation raising an exception.We can consider supporting idling resources for JS, but it would require a different API.
Testing
Test: Added a unit test.