Skip to content

Commit 4c9d171

Browse files
committed
add more test cases
1 parent c587104 commit 4c9d171

File tree

4 files changed

+531
-204
lines changed

4 files changed

+531
-204
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ toolkitVersion=3.61-SNAPSHOT
88
publishToken=
99
publishChannel=
1010

11-
ideProfileName=2025.1
11+
ideProfileName=2024.3
1212

1313
remoteRobotPort=8080
1414

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

+112
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class QTestGenerationChatTest {
113113
assertTrue(result.contains("View Diff opened"))
114114
assertTrue(result.contains("Result Accepted"))
115115
assertTrue(result.contains("Unit test generation completed."))
116+
assertTrue(result.contains("Input field re-enabled after acceptance"))
117+
assertTrue(result.contains("Feedback button found with correct text"))
116118
}
117119
}
118120

@@ -211,6 +213,8 @@ class QTestGenerationChatTest {
211213
assertTrue(result.contains("View Diff opened"))
212214
assertTrue(result.contains("Result Reject"))
213215
assertTrue(result.contains("Unit test generation completed."))
216+
assertTrue(result.contains("Input field re-enabled after rejection"))
217+
assertTrue(result.contains("Feedback button found with correct text"))
214218
}
215219
}
216220

@@ -314,6 +318,114 @@ class QTestGenerationChatTest {
314318
assertTrue(result.contains("Cancel button clicked"))
315319
assertTrue(result.contains("Test generation cancelled successfully"))
316320
assertTrue(result.contains("Input field re-enabled after cancellation"))
321+
assertTrue(result.contains("Feedback button found with correct text"))
322+
}
323+
}
324+
325+
@Test
326+
fun `test documentation generation error handling`() {
327+
val testCase = TestCase(
328+
IdeProductProvider.IC,
329+
LocalProjectInfo(
330+
Paths.get("tstData", "qTestGenerationTestProject/")
331+
)
332+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
333+
334+
// inject connection
335+
useExistingConnectionForTest()
336+
337+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
338+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
339+
pluginConfigurator.installPluginFromPath(
340+
Path.of(path)
341+
)
342+
}
343+
344+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
345+
updateGeneralSettings()
346+
}.runIdeWithDriver()
347+
.useDriverAndCloseIde {
348+
waitForProjectOpen()
349+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
350+
Thread.sleep(30000)
351+
val result = executePuppeteerScript(testDocumentationErrorScript)
352+
assertTrue(result.contains("new tab opened"))
353+
assertTrue(result.contains("Error message displayed correctly"))
354+
assertTrue(result.contains("Input field re-enabled after error"))
355+
assertTrue(result.contains("Feedback button found with correct text after error"))
356+
assertTrue(result.contains("Feedback button is clickable"))
357+
}
358+
}
359+
360+
@Test
361+
fun `test remove function error handling`() {
362+
val testCase = TestCase(
363+
IdeProductProvider.IC,
364+
LocalProjectInfo(
365+
Paths.get("tstData", "qTestGenerationTestProject/")
366+
)
367+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
368+
369+
// inject connection
370+
useExistingConnectionForTest()
371+
372+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
373+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
374+
pluginConfigurator.installPluginFromPath(
375+
Path.of(path)
376+
)
377+
}
378+
379+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
380+
updateGeneralSettings()
381+
}.runIdeWithDriver()
382+
.useDriverAndCloseIde {
383+
waitForProjectOpen()
384+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
385+
Thread.sleep(30000)
386+
val result = executePuppeteerScript(testRemoveFunctionErrorScript)
387+
assertTrue(result.contains("new tab opened"))
388+
assertTrue(result.contains("Error message displayed correctly"))
389+
assertTrue(result.contains("Explanation message displayed correctly"))
390+
assertTrue(result.contains("Input field re-enabled after error"))
391+
assertTrue(result.contains("Feedback button found with correct text after error"))
392+
assertTrue(result.contains("Feedback button is clickable"))
393+
}
394+
}
395+
396+
@Test
397+
fun `test method not found error handling`() {
398+
val testCase = TestCase(
399+
IdeProductProvider.IC,
400+
LocalProjectInfo(
401+
Paths.get("tstData", "qTestGenerationTestProject/")
402+
)
403+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
404+
405+
// inject connection
406+
useExistingConnectionForTest()
407+
408+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
409+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
410+
pluginConfigurator.installPluginFromPath(
411+
Path.of(path)
412+
)
413+
}
414+
415+
copyExistingConfig(Paths.get("tstData", "configAmazonQTests"))
416+
updateGeneralSettings()
417+
}.runIdeWithDriver()
418+
.useDriverAndCloseIde {
419+
waitForProjectOpen()
420+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
421+
Thread.sleep(30000)
422+
val result = executePuppeteerScript(testMethodNotFoundErrorScript)
423+
assertTrue(result.contains("new tab opened"))
424+
assertTrue(result.contains("Method not found error message displayed correctly"))
425+
assertTrue(result.contains("Method not found explanation displayed correctly"))
426+
assertTrue(result.contains("Input field re-enabled after error"))
427+
assertTrue(result.contains("Feedback button found with correct text after error"))
428+
assertTrue(result.contains("Feedback button is clickable"))
317429
}
318430
}
319431

0 commit comments

Comments
 (0)