Skip to content
Merged
2 changes: 1 addition & 1 deletion .github/workflows/compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
matrix:
# FIXME: Even after installation of '119.0', tests still use latest one. Fix and restore.
firefox: [ 'latest' ]
task: [ 'Js', 'Wasm' ]
task: [ 'Wasm' ] # excluded Js for Firefox due to high flakiness
steps:
- name: Checkout Repository
uses: actions/checkout@v5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import kotlin.coroutines.suspendCoroutine
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -111,10 +113,14 @@ internal interface OnCanvasTests {
}
}

suspend fun awaitA11YChanges() {
suspend fun awaitA11YChanges(timeout: Duration = 2.seconds) {
val a11yContainer = getA11YContainer() ?: return
var prevTime = currentTimeMillis()

fun skipFramesUntil(condition: () -> Boolean, onTrue: () -> Unit) {
val currentTime = currentTimeMillis()
assertTrue(currentTime - prevTime < timeout.inWholeMilliseconds, "awaitA11YChanges timed out after $timeout")
prevTime = currentTime
window.requestAnimationFrame {
if (!condition()) {
skipFramesUntil(condition, onTrue)
Expand Down
Loading