diff --git a/topics/appendix/api_notable/api_notable_list_2024.md b/topics/appendix/api_notable/api_notable_list_2024.md index 15eb709f5..986b46b6a 100644 --- a/topics/appendix/api_notable/api_notable_list_2024.md +++ b/topics/appendix/api_notable/api_notable_list_2024.md @@ -15,6 +15,9 @@ _Early Access Program_ (EAP) releases of upcoming versions are available [here]( Dumb-aware intentions and quick-fixes : Mark implementations as enabled during indexing, see [](indexing_and_psi_stubs.md#DumbAwareAPI). +Testing: `ProjectActivity` +: Executed asynchronously now during tests, see FAQ entry [](testing_faq.md#how-to-handle-projectactivity). + ## 2024.1 ### IntelliJ Platform 2024.1 diff --git a/topics/basics/testing_plugins/testing_faq.md b/topics/basics/testing_plugins/testing_faq.md index beed61234..756a28597 100644 --- a/topics/basics/testing_plugins/testing_faq.md +++ b/topics/basics/testing_plugins/testing_faq.md @@ -78,6 +78,8 @@ Use _ordered_ collections or [`UsefulTestCase.assertUnorderedCollection()`](%gh- Code deferring execution (e.g., via `Application.invokeLater()`) might not run during test execution (and possibly fails in production, too). Use `Application.invokeLater(runnable, myProject.getDisposed())`. +When targeting 2024.2 or later, see also [](#how-to-handle-projectactivity). + ### How to avoid test failure when using resources? In some situations, added or changed files (e.g. XML DTDs provided by a plugin) are not refreshed in [](virtual_file_system.md). @@ -217,4 +219,10 @@ PsiTestUtil.addLibrary(model, "internal-library", getTestDataPath(), "internal-library-2.0.jar"); ``` +### How to handle `ProjectActivity`? + +Since 2024.2, [`ProjectActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) are no longer awaited on project open in tests. +If tests depend on some job done in `ProjectActivity` (e.g., automatic project re-import), implement a dedicated [event/listener](messaging_infrastructure.md) and wait for it explicitly. +As a workaround, use [`StartupActivityTestUtil.waitForProjectActivitiesToComplete()`](%gh-ic-master%/platform/testFramework/src/com/intellij/testFramework/StartupActivityTestUtil.kt). +