Skip to content

Commit ea9e0e1

Browse files
committed
fix the test and change back gradlew file
1 parent 61444a3 commit ea9e0e1

File tree

3 files changed

+128
-72
lines changed

3 files changed

+128
-72
lines changed

ui-tests-starter/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ tasks.register<Test>("uiTest") {
9595

9696
systemProperty("ui.test.plugins", testPlugins.get().asPath)
9797
systemProperty("org.gradle.project.ideProfileName", ideProfile.name)
98-
val testSuite = System.getenv("TEST_DIR") ?: ""
99-
filter {
100-
includeTestsMatching("software.aws.toolkits.jetbrains.uitests.testTests.*")
101-
}
10298
}
10399

104100
// hack to disable ui tests in ./gradlew check

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

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ class QTestGenerationChatTest {
5151
}
5252

5353
@Test
54-
fun `can run a test from the chat`() {
54+
fun `test method not found error handling`() {
5555
val testCase = TestCase(
5656
IdeProductProvider.IC,
5757
LocalProjectInfo(
58-
Paths.get("tstData", "qTestGenerationTestProject")
58+
Paths.get("tstData", "qTestGenerationTestProject/")
5959
)
60-
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
60+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
6161

6262
// inject connection
6363
useExistingConnectionForTest()
@@ -74,22 +74,24 @@ class QTestGenerationChatTest {
7474
}.runIdeWithDriver()
7575
.useDriverAndCloseIde {
7676
waitForProjectOpen()
77-
// required wait time for the system to be fully ready
77+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
7878
Thread.sleep(30000)
79-
val result = executePuppeteerScript(testNoFilePathScript)
79+
val result = executePuppeteerScript(testMethodNotFoundErrorScript)
8080
assertTrue(result.contains("new tab opened"))
81-
assertTrue(result.contains("a source file open right now that I can generate a test for"))
81+
assertTrue(result.contains("Error message displayed correctly"))
82+
assertTrue(result.contains("Input field re-enabled after error"))
83+
assertTrue(result.contains("Feedback button found with correct text after error"))
8284
}
8385
}
8486

8587
@Test
86-
fun `test happy path from the chat`() {
88+
fun `test cancel button during test generation`() {
8789
val testCase = TestCase(
8890
IdeProductProvider.IC,
8991
LocalProjectInfo(
9092
Paths.get("tstData", "qTestGenerationTestProject/")
9193
)
92-
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
94+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
9395

9496
// inject connection
9597
useExistingConnectionForTest()
@@ -108,24 +110,25 @@ class QTestGenerationChatTest {
108110
waitForProjectOpen()
109111
openFile(Paths.get("testModule1", "HappyPath.java").toString())
110112
Thread.sleep(30000)
111-
val result = executePuppeteerScript(testHappyPathScript)
113+
val result = executePuppeteerScript(testCancelButtonScript)
112114
assertTrue(result.contains("new tab opened"))
113-
assertTrue(result.contains("View Diff opened"))
114-
assertTrue(result.contains("Result Accepted"))
115-
assertTrue(result.contains("Unit test generation completed."))
116-
assertTrue(result.contains("Input field re-enabled after acceptance"))
115+
assertTrue(result.contains("Progress bar text displayed"))
116+
assertTrue(result.contains("Cancel button found"))
117+
assertTrue(result.contains("Cancel button clicked"))
118+
assertTrue(result.contains("Test generation cancelled successfully"))
119+
assertTrue(result.contains("Input field re-enabled after cancellation"))
117120
assertTrue(result.contains("Feedback button found with correct text"))
118121
}
119122
}
120123

121124
@Test
122-
fun `test expected error path from the chat`() {
125+
fun `test documentation generation error handling`() {
123126
val testCase = TestCase(
124127
IdeProductProvider.IC,
125128
LocalProjectInfo(
126129
Paths.get("tstData", "qTestGenerationTestProject/")
127130
)
128-
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
131+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
129132

130133
// inject connection
131134
useExistingConnectionForTest()
@@ -142,22 +145,24 @@ class QTestGenerationChatTest {
142145
}.runIdeWithDriver()
143146
.useDriverAndCloseIde {
144147
waitForProjectOpen()
145-
openFile(Paths.get("testModule1", "ErrorPath.java").toString())
148+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
146149
Thread.sleep(30000)
147-
val result = executePuppeteerScript(expectedErrorPath)
150+
val result = executePuppeteerScript(testDocumentationErrorScript)
148151
assertTrue(result.contains("new tab opened"))
149-
assertTrue(result.contains("Test generation complete with expected error"))
152+
assertTrue(result.contains("Error message displayed correctly"))
153+
assertTrue(result.contains("Input field re-enabled after error"))
154+
assertTrue(result.contains("Feedback button found with correct text after error"))
150155
}
151156
}
152157

153158
@Test
154-
fun `test unsupported language error path from the chat`() {
159+
fun `test remove function error handling`() {
155160
val testCase = TestCase(
156161
IdeProductProvider.IC,
157162
LocalProjectInfo(
158163
Paths.get("tstData", "qTestGenerationTestProject/")
159164
)
160-
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
165+
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
161166

162167
// inject connection
163168
useExistingConnectionForTest()
@@ -174,22 +179,24 @@ class QTestGenerationChatTest {
174179
}.runIdeWithDriver()
175180
.useDriverAndCloseIde {
176181
waitForProjectOpen()
177-
openFile(Paths.get("testModule2", "UnSupportedLanguage.kt").toString())
182+
openFile(Paths.get("testModule1", "HappyPath.java").toString())
178183
Thread.sleep(30000)
179-
val result = executePuppeteerScript(unsupportedLanguagePath)
184+
val result = executePuppeteerScript(testRemoveFunctionErrorScript)
180185
assertTrue(result.contains("new tab opened"))
181-
assertTrue(result.contains("Test generation complete with expected error"))
186+
assertTrue(result.contains("Error message displayed correctly"))
187+
assertTrue(result.contains("Input field re-enabled after error"))
188+
assertTrue(result.contains("Feedback button found with correct text after error"))
182189
}
183190
}
184191

185192
@Test
186-
fun `test reject path from the chat`() {
193+
fun `can run a test from the chat`() {
187194
val testCase = TestCase(
188195
IdeProductProvider.IC,
189196
LocalProjectInfo(
190-
Paths.get("tstData", "qTestGenerationTestProject/")
197+
Paths.get("tstData", "qTestGenerationTestProject")
191198
)
192-
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
199+
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
193200

194201
// inject connection
195202
useExistingConnectionForTest()
@@ -206,26 +213,22 @@ class QTestGenerationChatTest {
206213
}.runIdeWithDriver()
207214
.useDriverAndCloseIde {
208215
waitForProjectOpen()
209-
openFile(Paths.get("testModule1", "HappyPath.java").toString())
216+
// required wait time for the system to be fully ready
210217
Thread.sleep(30000)
211-
val result = executePuppeteerScript(testRejectPathScript)
218+
val result = executePuppeteerScript(testNoFilePathScript)
212219
assertTrue(result.contains("new tab opened"))
213-
assertTrue(result.contains("View Diff opened"))
214-
assertTrue(result.contains("Result Reject"))
215-
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"))
220+
assertTrue(result.contains("a source file open right now that I can generate a test for"))
218221
}
219222
}
220223

221224
@Test
222-
fun `test NL error from the chat`() {
225+
fun `test happy path from the chat`() {
223226
val testCase = TestCase(
224227
IdeProductProvider.IC,
225228
LocalProjectInfo(
226229
Paths.get("tstData", "qTestGenerationTestProject/")
227230
)
228-
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
231+
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
229232

230233
// inject connection
231234
useExistingConnectionForTest()
@@ -244,21 +247,24 @@ class QTestGenerationChatTest {
244247
waitForProjectOpen()
245248
openFile(Paths.get("testModule1", "HappyPath.java").toString())
246249
Thread.sleep(30000)
247-
val result = executePuppeteerScript(testNLErrorPathScript)
250+
val result = executePuppeteerScript(testHappyPathScript)
248251
assertTrue(result.contains("new tab opened"))
249-
assertTrue(result.contains("Command entered: /test /something/"))
250-
assertTrue(result.contains("Error message displayed correctly"))
252+
assertTrue(result.contains("View Diff opened"))
253+
assertTrue(result.contains("Result Accepted"))
254+
assertTrue(result.contains("Unit test generation completed."))
255+
assertTrue(result.contains("Input field re-enabled after acceptance"))
256+
assertTrue(result.contains("Feedback button found with correct text"))
251257
}
252258
}
253259

254260
@Test
255-
fun `test progress bar during test generation`() {
261+
fun `test expected error path from the chat`() {
256262
val testCase = TestCase(
257263
IdeProductProvider.IC,
258264
LocalProjectInfo(
259265
Paths.get("tstData", "qTestGenerationTestProject/")
260266
)
261-
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
267+
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
262268

263269
// inject connection
264270
useExistingConnectionForTest()
@@ -275,23 +281,22 @@ class QTestGenerationChatTest {
275281
}.runIdeWithDriver()
276282
.useDriverAndCloseIde {
277283
waitForProjectOpen()
278-
openFile(Paths.get("testModule1", "HappyPath.java").toString())
284+
openFile(Paths.get("testModule1", "ErrorPath.java").toString())
279285
Thread.sleep(30000)
280-
val result = executePuppeteerScript(testProgressBarScript)
286+
val result = executePuppeteerScript(expectedErrorPath)
281287
assertTrue(result.contains("new tab opened"))
282-
assertTrue(result.contains("Progress bar text displayed"))
283-
assertTrue(result.contains("Test generation completed successfully"))
288+
assertTrue(result.contains("Test generation complete with expected error"))
284289
}
285290
}
286291

287292
@Test
288-
fun `test cancel button during test generation`() {
293+
fun `test unsupported language error path from the chat`() {
289294
val testCase = TestCase(
290295
IdeProductProvider.IC,
291296
LocalProjectInfo(
292297
Paths.get("tstData", "qTestGenerationTestProject/")
293298
)
294-
).useRelease(System.getProperty("org.gradle.project.ideProfileName"))
299+
).withVersion(System.getProperty("org.gradle.project.ideProfileName"))
295300

296301
// inject connection
297302
useExistingConnectionForTest()
@@ -308,21 +313,16 @@ class QTestGenerationChatTest {
308313
}.runIdeWithDriver()
309314
.useDriverAndCloseIde {
310315
waitForProjectOpen()
311-
openFile(Paths.get("testModule1", "HappyPath.java").toString())
316+
openFile(Paths.get("testModule2", "UnSupportedLanguage.kt").toString())
312317
Thread.sleep(30000)
313-
val result = executePuppeteerScript(testCancelButtonScript)
318+
val result = executePuppeteerScript(unsupportedLanguagePath)
314319
assertTrue(result.contains("new tab opened"))
315-
assertTrue(result.contains("Progress bar text displayed"))
316-
assertTrue(result.contains("Cancel button found"))
317-
assertTrue(result.contains("Cancel button clicked"))
318-
assertTrue(result.contains("Test generation cancelled successfully"))
319-
assertTrue(result.contains("Input field re-enabled after cancellation"))
320-
assertTrue(result.contains("Feedback button found with correct text"))
320+
assertTrue(result.contains("Test generation complete with expected error"))
321321
}
322322
}
323323

324324
@Test
325-
fun `test documentation generation error handling`() {
325+
fun `test reject path from the chat`() {
326326
val testCase = TestCase(
327327
IdeProductProvider.IC,
328328
LocalProjectInfo(
@@ -347,16 +347,18 @@ class QTestGenerationChatTest {
347347
waitForProjectOpen()
348348
openFile(Paths.get("testModule1", "HappyPath.java").toString())
349349
Thread.sleep(30000)
350-
val result = executePuppeteerScript(testDocumentationErrorScript)
350+
val result = executePuppeteerScript(testRejectPathScript)
351351
assertTrue(result.contains("new tab opened"))
352-
assertTrue(result.contains("Error message displayed correctly"))
353-
assertTrue(result.contains("Input field re-enabled after error"))
354-
assertTrue(result.contains("Feedback button found with correct text after error"))
352+
assertTrue(result.contains("View Diff opened"))
353+
assertTrue(result.contains("Result Reject"))
354+
assertTrue(result.contains("Unit test generation completed."))
355+
assertTrue(result.contains("Input field re-enabled after rejection"))
356+
assertTrue(result.contains("Feedback button found with correct text"))
355357
}
356358
}
357359

358360
@Test
359-
fun `test remove function error handling`() {
361+
fun `test NL error from the chat`() {
360362
val testCase = TestCase(
361363
IdeProductProvider.IC,
362364
LocalProjectInfo(
@@ -381,16 +383,15 @@ class QTestGenerationChatTest {
381383
waitForProjectOpen()
382384
openFile(Paths.get("testModule1", "HappyPath.java").toString())
383385
Thread.sleep(30000)
384-
val result = executePuppeteerScript(testRemoveFunctionErrorScript)
386+
val result = executePuppeteerScript(testNLErrorPathScript)
385387
assertTrue(result.contains("new tab opened"))
388+
assertTrue(result.contains("Command entered: /test /something/"))
386389
assertTrue(result.contains("Error message displayed correctly"))
387-
assertTrue(result.contains("Input field re-enabled after error"))
388-
assertTrue(result.contains("Feedback button found with correct text after error"))
389390
}
390391
}
391392

392393
@Test
393-
fun `test method not found error handling`() {
394+
fun `test progress bar during test generation`() {
394395
val testCase = TestCase(
395396
IdeProductProvider.IC,
396397
LocalProjectInfo(
@@ -415,11 +416,10 @@ class QTestGenerationChatTest {
415416
waitForProjectOpen()
416417
openFile(Paths.get("testModule1", "HappyPath.java").toString())
417418
Thread.sleep(30000)
418-
val result = executePuppeteerScript(testMethodNotFoundErrorScript)
419+
val result = executePuppeteerScript(testProgressBarScript)
419420
assertTrue(result.contains("new tab opened"))
420-
assertTrue(result.contains("Error message displayed correctly"))
421-
assertTrue(result.contains("Input field re-enabled after error"))
422-
assertTrue(result.contains("Feedback button found with correct text after error"))
421+
assertTrue(result.contains("Progress bar text displayed"))
422+
assertTrue(result.contains("Test generation completed successfully"))
423423
}
424424
}
425425

ui-tests-starter/tstData/qTestGenerationTestProject/test/HappyPathTest.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,64 @@ public void test_multiply_1() {
2323
double result = HappyPath.multiply(2.5, 3.0);
2424
assertEquals(7.5, result, 0.0001);
2525
}
26+
27+
/**
28+
* Tests the multiply method with the largest possible double values.
29+
* This verifies that the method handles extreme input values correctly.
30+
*/
31+
@Test
32+
public void testMultiplyWithMaxDoubleValues() {
33+
double result = HappyPath.multiply(Double.MAX_VALUE, Double.MAX_VALUE);
34+
assertEquals(Double.POSITIVE_INFINITY, result, 0);
35+
}
36+
37+
/**
38+
* Tests the multiply method with the smallest possible double values.
39+
* This verifies that the method handles very small input values correctly.
40+
*/
41+
@Test
42+
public void testMultiplyWithMinDoubleValues() {
43+
double result = HappyPath.multiply(Double.MIN_VALUE, Double.MIN_VALUE);
44+
assertEquals(0.0, result, 0);
45+
}
46+
47+
/**
48+
* Tests the multiply method with NaN as input.
49+
* This verifies that the method handles NaN correctly.
50+
*/
51+
@Test
52+
public void testMultiplyWithNaN() {
53+
double result = HappyPath.multiply(Double.NaN, 1.0);
54+
assertTrue(Double.isNaN(result));
55+
}
56+
57+
/**
58+
* Tests the multiply method with negative infinity as input.
59+
* This verifies that the method handles negative infinity correctly.
60+
*/
61+
@Test
62+
public void testMultiplyWithNegativeInfinity() {
63+
double result = HappyPath.multiply(Double.NEGATIVE_INFINITY, 1.0);
64+
assertEquals(Double.NEGATIVE_INFINITY, result, 0);
65+
}
66+
67+
/**
68+
* Tests the multiply method with positive infinity as input.
69+
* This verifies that the method handles infinity correctly.
70+
*/
71+
@Test
72+
public void testMultiplyWithPositiveInfinity() {
73+
double result = HappyPath.multiply(Double.POSITIVE_INFINITY, 1.0);
74+
assertEquals(Double.POSITIVE_INFINITY, result, 0);
75+
}
76+
77+
/**
78+
* Tests the multiply method with positive numbers.
79+
* Verifies that the method correctly multiplies two positive doubles.
80+
*/
81+
@Test
82+
public void test_multiply_1_2() {
83+
double result = HappyPath.multiply(2.5, 3.0);
84+
assertEquals(7.5, result, 0.0001);
85+
}
2686
}

0 commit comments

Comments
 (0)