@@ -9,16 +9,26 @@ plugins {
99 id(" toolkit-kotlin-conventions" )
1010 id(" toolkit-intellij-plugin" )
1111
12- id(" org.jetbrains.intellij.platform.base " )
12+ id(" org.jetbrains.intellij.platform" )
1313}
1414
1515val ideProfile = IdeVersions .ideProfile(project)
16+ val testPlugins by configurations.registering
1617
17- // Add our source sets per IDE profile version (i.e. src-211)
1818sourceSets {
1919 test {
20- java.srcDirs(findFolders(project, " tst" , ideProfile))
21- resources.srcDirs(findFolders(project, " tst-resources" , ideProfile))
20+ java.setSrcDirs(findFolders(project, " tst-prep" , ideProfile))
21+ resources.setSrcDirs(findFolders(project, " tst-resources" , ideProfile))
22+ }
23+ }
24+
25+ val uiTestSource = sourceSets.create(" uiTest" ) {
26+ java.setSrcDirs(findFolders(project, " tst" , ideProfile))
27+ }
28+
29+ idea {
30+ module {
31+ testSources.from(uiTestSource.allSource.srcDirs)
2232 }
2333}
2434
@@ -27,35 +37,57 @@ intellijPlatform {
2737 instrumentCode = false
2838}
2939
30- tasks.initializeIntellijPlatformPlugin {
31- enabled = false
32- }
40+ val uiTestImplementation by configurations.getting
3341
34- tasks.verifyPluginProjectConfiguration {
35- runtimeDirectory.set(null as File ? )
36- enabled = false
42+ configurations.getByName(uiTestSource.compileClasspathConfigurationName) {
43+ extendsFrom(uiTestImplementation)
3744}
3845
39- val testPlugins by configurations.registering
46+ configurations.getByName(uiTestSource.runtimeClasspathConfigurationName) {
47+ extendsFrom(uiTestImplementation)
48+ }
4049
4150dependencies {
4251 // should really be set by the BOM, but too much work to figure out right now
43- testImplementation(" org.kodein.di:kodein-di-jvm:7.20.2" )
52+ uiTestImplementation(" org.kodein.di:kodein-di-jvm:7.20.2" )
53+ uiTestImplementation(platform(libs.junit5.bom))
54+ uiTestImplementation(libs.junit5.jupiter)
55+
4456 intellijPlatform {
45- // shouldn't be needed? but IsolationException
4657 val version = ideProfile.community.sdkVersion
4758 intellijIdeaCommunity(version, ! version.contains(" SNAPSHOT" ))
48- testFramework(TestFrameworkType .Starter )
59+
60+ localPlugin(project(" :plugin-core" ))
61+ testImplementation(project(" :plugin-core:core" ))
62+ testImplementation(project(" :plugin-core:jetbrains-community" ))
63+ testImplementation(testFixtures(project(" :plugin-core:jetbrains-community" )))
64+
65+ testFramework(TestFrameworkType .Bundled )
66+ testFramework(TestFrameworkType .JUnit5 )
67+
68+ testFramework(TestFrameworkType .Starter , configurationName = uiTestImplementation.name)
4969 }
5070
5171 testPlugins(project(" :plugin-amazonq" , " pluginZip" ))
5272 testPlugins(project(" :plugin-core" , " pluginZip" ))
5373}
5474
5575tasks.test {
56- dependsOn(testPlugins)
76+ enabled = false
77+ }
5778
58- useJUnitPlatform()
79+ val prepareAmazonQTest by intellijPlatformTesting.testIde.registering {
80+ task {
81+ useJUnitPlatform()
82+ }
83+ }
84+
85+ tasks.register<Test >(" uiTest" ) {
86+ testClassesDirs = uiTestSource.output.classesDirs
87+ classpath = uiTestSource.runtimeClasspath
88+
89+ dependsOn(prepareAmazonQTest)
90+ dependsOn(testPlugins)
5991
6092 systemProperty(" ui.test.plugins" , testPlugins.get().asPath)
6193 systemProperty(" org.gradle.project.ideProfileName" , ideProfile.name)
0 commit comments