Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package org.hyperskill.academy.coursecreator.yaml

import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
import com.intellij.util.ui.UIUtil
import com.intellij.testFramework.PlatformTestUtil
import org.hyperskill.academy.learning.yaml.YamlFormatSettings
import org.hyperskill.academy.learning.yaml.YamlFormatSynchronizer

fun createConfigFiles(project: Project) {
project.putUserData(YamlFormatSettings.YAML_TEST_PROJECT_READY, true)
YamlFormatSynchronizer.saveAll(project)
FileDocumentManager.getInstance().saveAllDocuments()
UIUtil.dispatchAllInvocationEvents()
// `saveAll` writes the files in `invokeLater`. `UIUtil.dispatchAllInvocationEvents` doesn't always run them: in the first
// test of a JVM with empty IDE caches, they ran only after the test. This one releases the write-intent lock while it
// dispatches events, and returns only after an `invokeLater` scheduled after them has run.
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
}
Loading