[performance tests] Wait till project tree is expanded

GitOrigin-RevId: f3610441aa434418fcda5f38d2a68d0a5c71a214
This commit is contained in:
Maxim.Kolmakov
2024-05-14 10:42:33 +02:00
committed by intellij-monorepo-bot
parent 073cee84c0
commit dd53d68e4f

View File

@@ -5,6 +5,7 @@ import com.intellij.openapi.application.EDT
import com.intellij.openapi.ui.playback.PlaybackContext
import com.intellij.openapi.ui.playback.commands.PlaybackCommandCoroutineAdapter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.withContext
/**
@@ -20,8 +21,12 @@ class ExpandProjectViewCommand(text: String, line: Int) : PlaybackCommandCorouti
override suspend fun doExecute(context: PlaybackContext) {
val file = OpenFileCommand.findFile(extractCommandArgument(PREFIX), context.project)
val mutex = Mutex(true)
withContext(Dispatchers.EDT) {
ProjectView.getInstance(context.project).select(null, file, false)
ProjectView.getInstance(context.project).selectCB(null, file, false).doWhenProcessed {
mutex.unlock()
}
}
mutex.lock()
}
}