1
1
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- package software.aws.toolkits.jetbrains.uitests.chatTests.qTestGeneration
4
+ package software.aws.toolkits.jetbrains.uitests.testTests
5
5
6
6
import com.intellij.driver.sdk.openFile
7
7
import com.intellij.driver.sdk.waitForProjectOpen
@@ -55,7 +55,7 @@ class QTestGenerationChatTest {
55
55
val testCase = TestCase (
56
56
IdeProductProvider .IC ,
57
57
LocalProjectInfo (
58
- Paths .get(" tstData" , " Hello " )
58
+ Paths .get(" tstData" , " qTestGenerationTestProject " )
59
59
)
60
60
).useRelease(System .getProperty(" org.gradle.project.ideProfileName" ))
61
61
@@ -87,7 +87,7 @@ class QTestGenerationChatTest {
87
87
val testCase = TestCase (
88
88
IdeProductProvider .IC ,
89
89
LocalProjectInfo (
90
- Paths .get(" tstData" , " Hello /" )
90
+ Paths .get(" tstData" , " qTestGenerationTestProject /" )
91
91
)
92
92
).useRelease(System .getProperty(" org.gradle.project.ideProfileName" ))
93
93
@@ -106,8 +106,7 @@ class QTestGenerationChatTest {
106
106
}.runIdeWithDriver()
107
107
.useDriverAndCloseIde {
108
108
waitForProjectOpen()
109
- openFile(Paths .get(" Example.java" ).toString())
110
- // required wait time for the system to be fully ready
109
+ openFile(Paths .get(" testModule1" , " HappyPath.java" ).toString())
111
110
Thread .sleep(30000 )
112
111
val result = executePuppeteerScript(testHappyPathScript)
113
112
assertTrue(result.contains(" new tab opened" ))
@@ -117,6 +116,70 @@ class QTestGenerationChatTest {
117
116
}
118
117
}
119
118
119
+ @Test
120
+ fun `test expected error path from the chat` () {
121
+ val testCase = TestCase (
122
+ IdeProductProvider .IC ,
123
+ LocalProjectInfo (
124
+ Paths .get(" tstData" , " qTestGenerationTestProject/" )
125
+ )
126
+ ).useRelease(System .getProperty(" org.gradle.project.ideProfileName" ))
127
+
128
+ // inject connection
129
+ useExistingConnectionForTest()
130
+
131
+ Starter .newContext(CurrentTestMethod .hyphenateWithClass(), testCase).apply {
132
+ System .getProperty(" ui.test.plugins" ).split(File .pathSeparator).forEach { path ->
133
+ pluginConfigurator.installPluginFromPath(
134
+ Path .of(path)
135
+ )
136
+ }
137
+
138
+ copyExistingConfig(Paths .get(" tstData" , " configAmazonQTests" ))
139
+ updateGeneralSettings()
140
+ }.runIdeWithDriver()
141
+ .useDriverAndCloseIde {
142
+ waitForProjectOpen()
143
+ openFile(Paths .get(" testModule1" , " ErrorPath.java" ).toString())
144
+ Thread .sleep(30000 )
145
+ val result = executePuppeteerScript(expectedErrorPath)
146
+ assertTrue(result.contains(" new tab opened" ))
147
+ assertTrue(result.contains(" Test generation complete with expected error" ))
148
+ }
149
+ }
150
+
151
+ @Test
152
+ fun `test unsupported language error path from the chat` () {
153
+ val testCase = TestCase (
154
+ IdeProductProvider .IC ,
155
+ LocalProjectInfo (
156
+ Paths .get(" tstData" , " qTestGenerationTestProject/" )
157
+ )
158
+ ).useRelease(System .getProperty(" org.gradle.project.ideProfileName" ))
159
+
160
+ // inject connection
161
+ useExistingConnectionForTest()
162
+
163
+ Starter .newContext(CurrentTestMethod .hyphenateWithClass(), testCase).apply {
164
+ System .getProperty(" ui.test.plugins" ).split(File .pathSeparator).forEach { path ->
165
+ pluginConfigurator.installPluginFromPath(
166
+ Path .of(path)
167
+ )
168
+ }
169
+
170
+ copyExistingConfig(Paths .get(" tstData" , " configAmazonQTests" ))
171
+ updateGeneralSettings()
172
+ }.runIdeWithDriver()
173
+ .useDriverAndCloseIde {
174
+ waitForProjectOpen()
175
+ openFile(Paths .get(" testModule2" , " UnSupportedLanguage.kt" ).toString())
176
+ Thread .sleep(30000 )
177
+ val result = executePuppeteerScript(unsupportedLanguagePath)
178
+ assertTrue(result.contains(" new tab opened" ))
179
+ assertTrue(result.contains(" Test generation complete with expected error" ))
180
+ }
181
+ }
182
+
120
183
companion object {
121
184
@JvmStatic
122
185
@AfterAll
0 commit comments