Skip to content

Commit be94bb7

Browse files
committed
use assertThat
1 parent 467a7db commit be94bb7

File tree

2 files changed

+104
-72
lines changed

2 files changed

+104
-72
lines changed

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

Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import com.intellij.ide.starter.models.TestCase
1515
import com.intellij.ide.starter.project.LocalProjectInfo
1616
import com.intellij.ide.starter.runner.CurrentTestMethod
1717
import com.intellij.ide.starter.runner.Starter
18+
import org.assertj.core.api.Assertions.assertThat
1819
import org.junit.jupiter.api.AfterAll
19-
import org.junit.jupiter.api.Assertions.assertTrue
2020
import org.junit.jupiter.api.BeforeEach
2121
import org.junit.jupiter.api.Test
2222
import org.kodein.di.DI
@@ -77,10 +77,13 @@ class QTestGenerationChatTest {
7777
openFile(Paths.get("testModule1", "HappyPath.java").toString())
7878
Thread.sleep(30000)
7979
val result = executePuppeteerScript(testMethodNotFoundErrorScript)
80-
assertTrue(result.contains("new tab opened"))
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"))
80+
assertThat(result)
81+
.contains(
82+
"new tab opened",
83+
"Error message displayed correctly",
84+
"Input field re-enabled after error",
85+
"Feedback button found with correct text after error"
86+
)
8487
}
8588
}
8689

@@ -111,13 +114,16 @@ class QTestGenerationChatTest {
111114
openFile(Paths.get("testModule1", "HappyPath.java").toString())
112115
Thread.sleep(30000)
113116
val result = executePuppeteerScript(testCancelButtonScript)
114-
assertTrue(result.contains("new tab opened"))
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"))
120-
assertTrue(result.contains("Feedback button found with correct text"))
117+
assertThat(result)
118+
.contains(
119+
"new tab opened",
120+
"Progress bar text displayed",
121+
"Cancel button found",
122+
"Cancel button clicked",
123+
"Test generation cancelled successfully",
124+
"Input field re-enabled after cancellation",
125+
"Feedback button found with correct text"
126+
)
121127
}
122128
}
123129

@@ -148,10 +154,13 @@ class QTestGenerationChatTest {
148154
openFile(Paths.get("testModule1", "HappyPath.java").toString())
149155
Thread.sleep(30000)
150156
val result = executePuppeteerScript(testDocumentationErrorScript)
151-
assertTrue(result.contains("new tab opened"))
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"))
157+
assertThat(result)
158+
.contains(
159+
"new tab opened",
160+
"Error message displayed correctly",
161+
"Input field re-enabled after error",
162+
"Feedback button found with correct text after error"
163+
)
155164
}
156165
}
157166

@@ -182,10 +191,13 @@ class QTestGenerationChatTest {
182191
openFile(Paths.get("testModule1", "HappyPath.java").toString())
183192
Thread.sleep(30000)
184193
val result = executePuppeteerScript(testRemoveFunctionErrorScript)
185-
assertTrue(result.contains("new tab opened"))
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"))
194+
assertThat(result)
195+
.contains(
196+
"new tab opened",
197+
"Error message displayed correctly",
198+
"Input field re-enabled after error",
199+
"Feedback button found with correct text after error"
200+
)
189201
}
190202
}
191203

@@ -216,8 +228,9 @@ class QTestGenerationChatTest {
216228
// required wait time for the system to be fully ready
217229
Thread.sleep(30000)
218230
val result = executePuppeteerScript(testNoFilePathScript)
219-
assertTrue(result.contains("new tab opened"))
220-
assertTrue(result.contains("a source file open right now that I can generate a test for"))
231+
assertThat(result)
232+
.contains("new tab opened")
233+
.contains("a source file open right now that I can generate a test for")
221234
}
222235
}
223236

@@ -248,12 +261,14 @@ class QTestGenerationChatTest {
248261
openFile(Paths.get("testModule1", "HappyPath.java").toString())
249262
Thread.sleep(30000)
250263
val result = executePuppeteerScript(testHappyPathScript)
251-
assertTrue(result.contains("new tab opened"))
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"))
264+
265+
assertThat(result)
266+
.contains(
267+
"new tab opened",
268+
"View Diff opened",
269+
"Result Accepted",
270+
"Unit test generation completed."
271+
)
257272
}
258273
}
259274

@@ -284,8 +299,12 @@ class QTestGenerationChatTest {
284299
openFile(Paths.get("testModule1", "ErrorPath.java").toString())
285300
Thread.sleep(30000)
286301
val result = executePuppeteerScript(expectedErrorPath)
287-
assertTrue(result.contains("new tab opened"))
288-
assertTrue(result.contains("Test generation complete with expected error"))
302+
303+
assertThat(result)
304+
.contains(
305+
"new tab opened",
306+
"Test generation complete with expected error"
307+
)
289308
}
290309
}
291310

@@ -316,8 +335,12 @@ class QTestGenerationChatTest {
316335
openFile(Paths.get("testModule2", "UnSupportedLanguage.kt").toString())
317336
Thread.sleep(30000)
318337
val result = executePuppeteerScript(unsupportedLanguagePath)
319-
assertTrue(result.contains("new tab opened"))
320-
assertTrue(result.contains("Test generation complete with expected error"))
338+
339+
assertThat(result)
340+
.contains(
341+
"new tab opened",
342+
"Test generation complete with expected error"
343+
)
321344
}
322345
}
323346

@@ -348,12 +371,15 @@ class QTestGenerationChatTest {
348371
openFile(Paths.get("testModule1", "HappyPath.java").toString())
349372
Thread.sleep(30000)
350373
val result = executePuppeteerScript(testRejectPathScript)
351-
assertTrue(result.contains("new tab opened"))
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"))
374+
assertThat(result)
375+
.contains(
376+
"new tab opened",
377+
"View Diff opened",
378+
"Result Reject",
379+
"Unit test generation completed.",
380+
"Input field re-enabled after rejection",
381+
"Feedback button found with correct text"
382+
)
357383
}
358384
}
359385

@@ -384,9 +410,12 @@ class QTestGenerationChatTest {
384410
openFile(Paths.get("testModule1", "HappyPath.java").toString())
385411
Thread.sleep(30000)
386412
val result = executePuppeteerScript(testNLErrorPathScript)
387-
assertTrue(result.contains("new tab opened"))
388-
assertTrue(result.contains("Command entered: /test /something/"))
389-
assertTrue(result.contains("Error message displayed correctly"))
413+
assertThat(result)
414+
.contains(
415+
"new tab opened",
416+
"Command entered: /test /something/",
417+
"Error message displayed correctly"
418+
)
390419
}
391420
}
392421

@@ -417,9 +446,12 @@ class QTestGenerationChatTest {
417446
openFile(Paths.get("testModule1", "HappyPath.java").toString())
418447
Thread.sleep(30000)
419448
val result = executePuppeteerScript(testProgressBarScript)
420-
assertTrue(result.contains("new tab opened"))
421-
assertTrue(result.contains("Progress bar text displayed"))
422-
assertTrue(result.contains("Test generation completed successfully"))
449+
assertThat(result)
450+
.contains(
451+
"new tab opened",
452+
"Progress bar text displayed",
453+
"Test generation completed successfully"
454+
)
423455
}
424456
}
425457

0 commit comments

Comments
 (0)