Skip to content

Commit c587104

Browse files
committed
add e2e test for progress bar and cancel
1 parent 30f9b7e commit c587104

File tree

2 files changed

+400
-1
lines changed

2 files changed

+400
-1
lines changed

ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/testTests/QTestGenerationChatTest.kt

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class QTestGenerationChatTest {
204204
}.runIdeWithDriver()
205205
.useDriverAndCloseIde {
206206
waitForProjectOpen()
207-
openFile(Paths.get("testModule2", "UnSupportedLanguage.kt").toString())
207+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
208208
Thread.sleep(30000)
209209
val result = executePuppeteerScript(testRejectPathScript)
210210
assertTrue(result.contains("new tab opened"))
@@ -214,6 +214,109 @@ class QTestGenerationChatTest {
214214
}
215215
}
216216

217+
@Test
218+
fun `test NL error from the chat`(){
219+
val testCase = TestCase(
220+
IdeProductProvider.IC,
221+
LocalProjectInfo(
222+
Paths.get("tstData", "qTestGenerationTestProject/")
223+
)
224+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
225+
226+
// inject connection
227+
useExistingConnectionForTest()
228+
229+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
230+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
231+
pluginConfigurator.installPluginFromPath(
232+
Path.of(path)
233+
)
234+
}
235+
236+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
237+
updateGeneralSettings()
238+
}.runIdeWithDriver()
239+
.useDriverAndCloseIde {
240+
waitForProjectOpen()
241+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
242+
Thread.sleep(30000)
243+
val result = executePuppeteerScript(testNLErrorPathScript)
244+
assertTrue(result.contains("new tab opened"))
245+
assertTrue(result.contains("Command entered: /test /something/"))
246+
assertTrue(result.contains("Error message displayed correctly"))
247+
}
248+
249+
}
250+
251+
@Test
252+
fun `test progress bar during test generation`() {
253+
val testCase = TestCase(
254+
IdeProductProvider.IC,
255+
LocalProjectInfo(
256+
Paths.get("tstData", "qTestGenerationTestProject/")
257+
)
258+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
259+
260+
// inject connection
261+
useExistingConnectionForTest()
262+
263+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
264+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
265+
pluginConfigurator.installPluginFromPath(
266+
Path.of(path)
267+
)
268+
}
269+
270+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
271+
updateGeneralSettings()
272+
}.runIdeWithDriver()
273+
.useDriverAndCloseIde {
274+
waitForProjectOpen()
275+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
276+
Thread.sleep(30000)
277+
val result = executePuppeteerScript(testProgressBarScript)
278+
assertTrue(result.contains("new tab opened"))
279+
assertTrue(result.contains("Progress bar text displayed"))
280+
assertTrue(result.contains("Test generation completed successfully"))
281+
}
282+
}
283+
284+
@Test
285+
fun `test cancel button during test generation`() {
286+
val testCase = TestCase(
287+
IdeProductProvider.IC,
288+
LocalProjectInfo(
289+
Paths.get("tstData", "qTestGenerationTestProject/")
290+
)
291+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
292+
293+
// inject connection
294+
useExistingConnectionForTest()
295+
296+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
297+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
298+
pluginConfigurator.installPluginFromPath(
299+
Path.of(path)
300+
)
301+
}
302+
303+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
304+
updateGeneralSettings()
305+
}.runIdeWithDriver()
306+
.useDriverAndCloseIde {
307+
waitForProjectOpen()
308+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
309+
Thread.sleep(30000)
310+
val result = executePuppeteerScript(testCancelButtonScript)
311+
assertTrue(result.contains("new tab opened"))
312+
assertTrue(result.contains("Progress bar text displayed"))
313+
assertTrue(result.contains("Cancel button found"))
314+
assertTrue(result.contains("Cancel button clicked"))
315+
assertTrue(result.contains("Test generation cancelled successfully"))
316+
assertTrue(result.contains("Input field re-enabled after cancellation"))
317+
}
318+
}
319+
217320
companion object {
218321
@JvmStatic
219322
@AfterAll

0 commit comments

Comments
 (0)