Skip to content

Commit ad77056

Browse files
authored
Fix UI test input target (#4179)
UI tests should also use final toolkit build artifact instead of :jetbrains-core
1 parent b621414 commit ad77056

File tree

4 files changed

+69
-62
lines changed

4 files changed

+69
-62
lines changed

buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ val toolkitIntelliJ = project.extensions.create<ToolkitIntelliJExtension>("intel
1919

2020
val ideProfile = IdeVersions.ideProfile(project)
2121
val toolkitVersion: String by project
22-
val remoteRobotPort: String by project
2322

2423
// please check changelog generation logic if this format is changed
2524
version = "$toolkitVersion-${ideProfile.shortName}"
@@ -30,6 +29,9 @@ plugins {
3029
id("org.jetbrains.intellij")
3130
}
3231

32+
// TODO: https://github.com/gradle/gradle/issues/15383
33+
val versionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
34+
3335
// Add our source sets per IDE profile version (i.e. src-211)
3436
sourceSets {
3537
main {
@@ -125,10 +127,7 @@ tasks.buildSearchableOptions {
125127
}
126128

127129
// https://github.com/JetBrains/gradle-intellij-plugin/blob/829786d5d196ab942d7e6eb3e472ac0af776d3fa/src/main/kotlin/org/jetbrains/intellij/tasks/RunIdeBase.kt#L315
128-
val openedPackages = OpenedPackages + listOf(
129-
// very noisy in UI tests
130-
"--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED",
131-
) + with(OperatingSystem.current()) {
130+
val openedPackages = OpenedPackages + with(OperatingSystem.current()) {
132131
when {
133132
isWindows -> listOf(
134133
"--add-opens=java.base/sun.nio.fs=ALL-UNNAMED",
@@ -194,59 +193,6 @@ tasks.runIde {
194193
}
195194
}
196195

197-
// TODO: https://github.com/gradle/gradle/issues/15383
198-
val versionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
199-
tasks.withType<DownloadRobotServerPluginTask> {
200-
version.set(versionCatalog.findVersion("intellijRemoteRobot").get().requiredVersion)
201-
}
202-
203-
// Enable coverage for the UI test target IDE
204-
ciOnly {
205-
extensions.getByType<JacocoPluginExtension>().applyTo(tasks.withType<RunIdeForUiTestTask>())
206-
}
207-
tasks.withType<RunIdeForUiTestTask>().all {
208-
systemProperty("robot-server.port", remoteRobotPort)
209-
// mac magic
210-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
211-
systemProperty("jbScreenMenuBar.enabled", "false")
212-
systemProperty("apple.laf.useScreenMenuBar", "false")
213-
systemProperty("ide.mac.file.chooser.native", "false")
214-
215-
systemProperty("jb.consents.confirmation.enabled", "false")
216-
// This does some magic in EndUserAgreement.java to make it not show the privacy policy
217-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
218-
systemProperty("ide.show.tips.on.startup.default.value", false)
219-
220-
systemProperty("aws.telemetry.skip_prompt", "true")
221-
systemProperty("aws.suppress_deprecation_prompt", true)
222-
systemProperty("idea.trust.all.projects", "true")
223-
224-
// These are experiments to enable for UI tests
225-
systemProperty("aws.experiment.connectedLocalTerminal", true)
226-
systemProperty("aws.experiment.dynamoDb", true)
227-
228-
debugOptions {
229-
enabled.set(true)
230-
suspend.set(false)
231-
}
232-
233-
jvmArgs(openedPackages)
234-
235-
ciOnly {
236-
configure<JacocoTaskExtension> {
237-
// sync with testing-subplugin
238-
// don't instrument sdk, icons, etc.
239-
includes = listOf("software.aws.toolkits.*")
240-
excludes = listOf("software.aws.toolkits.telemetry.*")
241-
242-
// 221+ uses a custom classloader and jacoco fails to find classes
243-
isIncludeNoLocationClasses = true
244-
245-
output = Output.TCP_CLIENT // Dump to our jacoco server instead of to a file
246-
}
247-
}
248-
}
249-
250196
configurations.instrumentedJar.configure {
251197
// when the "instrumentedJar" configuration is selected, gradle is unable to resolve configurations needed by jacoco
252198
// to calculate coverage, so we declare these as seconary artifacts on the primary "instrumentedJar" implicit variant

buildspec/linuxUiTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ phases:
4545
credential_source=EcsContainer"
4646
4747
- chmod +x gradlew
48-
- ./gradlew -PideProfileName=$ALTERNATIVE_IDE_PROFILE_NAME buildPlugin --console plain --info
48+
- ./gradlew -PideProfileName=$ALTERNATIVE_IDE_PROFILE_NAME :plugin-toolkit:intellij:buildPlugin --console plain --info
4949

5050
- ffmpeg -loglevel quiet -nostdin -f x11grab -video_size ${SCREEN_WIDTH}x${SCREEN_HEIGHT} -i ${DISPLAY} -codec:v libx264 -pix_fmt yuv420p -vf drawtext="fontsize=48:box=1:[email protected]:boxborderw=5:fontcolor=white:x=0:y=h-text_h:text='%{gmtime\:%H\\\\\:%M\\\\\:%S}'" -framerate 12 -g 12 /tmp/screen_recording.mp4 &
5151
- ./gradlew -PideProfileName=$ALTERNATIVE_IDE_PROFILE_NAME uiTestCore coverageReport --console plain --info

plugins/toolkit/intellij/build.gradle.kts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import org.jetbrains.intellij.tasks.DownloadRobotServerPluginTask
5+
import org.jetbrains.intellij.tasks.RunIdeForUiTestTask
6+
import org.jetbrains.intellij.utils.OpenedPackages
7+
import software.aws.toolkits.gradle.ciOnly
48
import software.aws.toolkits.gradle.intellij.IdeFlavor
59
import software.aws.toolkits.gradle.intellij.IdeVersions
610
import software.aws.toolkits.gradle.intellij.ToolkitIntelliJExtension
@@ -16,6 +20,7 @@ val toolkitIntelliJ = project.extensions.create<ToolkitIntelliJExtension>("intel
1620
ideFlavor.set(IdeFlavor.values().firstOrNull { it.name == runIdeVariant.orNull } ?: IdeFlavor.IC)
1721
}
1822

23+
val remoteRobotPort: String by project
1924
val ideProfile = IdeVersions.ideProfile(project)
2025

2126
val toolkitVersion: String by project
@@ -91,3 +96,59 @@ configurations {
9196
exclude(group = "software.amazon.awssdk", module = "netty-nio-client")
9297
}
9398
}
99+
100+
// Enable coverage for the UI test target IDE
101+
ciOnly {
102+
extensions.getByType<JacocoPluginExtension>().applyTo(tasks.withType<RunIdeForUiTestTask>())
103+
}
104+
tasks.withType<DownloadRobotServerPluginTask> {
105+
// TODO: https://github.com/gradle/gradle/issues/15383
106+
version.set(versionCatalogs.named("libs").findVersion("intellijRemoteRobot").get().requiredVersion)
107+
}
108+
tasks.withType<RunIdeForUiTestTask>().all {
109+
systemProperty("robot-server.port", remoteRobotPort)
110+
// mac magic
111+
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
112+
systemProperty("jbScreenMenuBar.enabled", "false")
113+
systemProperty("apple.laf.useScreenMenuBar", "false")
114+
systemProperty("ide.mac.file.chooser.native", "false")
115+
116+
systemProperty("jb.consents.confirmation.enabled", "false")
117+
// This does some magic in EndUserAgreement.java to make it not show the privacy policy
118+
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
119+
systemProperty("ide.show.tips.on.startup.default.value", false)
120+
121+
systemProperty("aws.telemetry.skip_prompt", "true")
122+
systemProperty("aws.suppress_deprecation_prompt", true)
123+
systemProperty("idea.trust.all.projects", "true")
124+
125+
// These are experiments to enable for UI tests
126+
systemProperty("aws.experiment.connectedLocalTerminal", true)
127+
systemProperty("aws.experiment.dynamoDb", true)
128+
129+
debugOptions {
130+
enabled.set(true)
131+
suspend.set(false)
132+
}
133+
134+
jvmArgs(
135+
OpenedPackages + listOf(
136+
// very noisy in UI tests
137+
"--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED",
138+
)
139+
)
140+
141+
ciOnly {
142+
configure<JacocoTaskExtension> {
143+
// sync with testing-subplugin
144+
// don't instrument sdk, icons, etc.
145+
includes = listOf("software.aws.toolkits.*")
146+
excludes = listOf("software.aws.toolkits.telemetry.*")
147+
148+
// 221+ uses a custom classloader and jacoco fails to find classes
149+
isIncludeNoLocationClasses = true
150+
151+
output = JacocoTaskExtension.Output.TCP_CLIENT // Dump to our jacoco server instead of to a file
152+
}
153+
}
154+
}

ui-tests/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ tasks.test {
4444
}
4545

4646
tasks.register<Test>("uiTestCore") {
47-
dependsOn(":plugin-toolkit:jetbrains-core:buildPlugin")
48-
inputs.files(":plugin-toolkit:jetbrains-core:buildPlugin")
47+
dependsOn(":plugin-toolkit:intellij:buildPlugin")
48+
inputs.files(":plugin-toolkit:intellij:buildPlugin")
4949

5050
systemProperty("ide.experimental.ui", false)
5151
systemProperty("org.gradle.project.ideProfileName", ideProfileName)
@@ -55,7 +55,7 @@ tasks.register<Test>("uiTestCore") {
5555
systemProperty("testDataPath", project.rootDir.resolve("testdata").toString())
5656
systemProperty("testReportPath", project.buildDir.resolve("reports").resolve("tests").resolve("testRecordings").toString())
5757

58-
systemProperty("GRADLE_PROJECT", "plugin-toolkit:jetbrains-core")
58+
systemProperty("GRADLE_PROJECT", "plugin-toolkit:intellij")
5959
useJUnitPlatform {
6060
includeTags("core")
6161
}

0 commit comments

Comments
 (0)