Skip to content

Commit 940686d

Browse files
committed
fix the bugs
1 parent 4c9d171 commit 940686d

File tree

3 files changed

+38
-46
lines changed

3 files changed

+38
-46
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ class QTestGenerationChatTest {
353353
assertTrue(result.contains("Error message displayed correctly"))
354354
assertTrue(result.contains("Input field re-enabled after error"))
355355
assertTrue(result.contains("Feedback button found with correct text after error"))
356-
assertTrue(result.contains("Feedback button is clickable"))
357356
}
358357
}
359358

@@ -386,10 +385,8 @@ class QTestGenerationChatTest {
386385
val result = executePuppeteerScript(testRemoveFunctionErrorScript)
387386
assertTrue(result.contains("new tab opened"))
388387
assertTrue(result.contains("Error message displayed correctly"))
389-
assertTrue(result.contains("Explanation message displayed correctly"))
390388
assertTrue(result.contains("Input field re-enabled after error"))
391389
assertTrue(result.contains("Feedback button found with correct text after error"))
392-
assertTrue(result.contains("Feedback button is clickable"))
393390
}
394391
}
395392

@@ -421,11 +418,9 @@ class QTestGenerationChatTest {
421418
Thread.sleep(30000)
422419
val result = executePuppeteerScript(testMethodNotFoundErrorScript)
423420
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"))
421+
assertTrue(result.contains("Error message displayed correctly"))
426422
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"))
423+
assertTrue(result.contains("Feedback button found with correct text"))
429424
}
430425
}
431426

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

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ val testDocumentationErrorScript = """
674674
);
675675
676676
if (feedbackButton){
677-
console.log("Feedback button found with correct text")
677+
console.log("Feedback button found with correct text after error")
678678
}else{
679679
console.log("Feedback button not found")
680680
throw new Error('Feedback button not found');
@@ -734,22 +734,8 @@ val testRemoveFunctionErrorScript = """
734734
},
735735
"I apologize, but I couldn't process your /test instruction"
736736
);
737-
737+
738738
console.log("Error message displayed correctly")
739-
740-
await page.waitForFunction(
741-
(expectedText) => {
742-
const pageContent = document.body.textContent || '';
743-
return pageContent.includes(expectedText);
744-
},
745-
{
746-
timeout: 10000
747-
},
748-
"The /test command is designed to generate unit tests"
749-
);
750-
751-
console.log("Explanation message displayed correctly")
752-
753739
await page.waitForFunction(
754740
() => {
755741
const inputElement = document.querySelector('.mynah-chat-prompt-input');
@@ -772,7 +758,7 @@ val testRemoveFunctionErrorScript = """
772758
);
773759
774760
if (feedbackButton){
775-
console.log("Feedback button found with correct text")
761+
console.log("Feedback button found with correct text after error")
776762
}else{
777763
console.log("Feedback button not found")
778764
throw new Error('Feedback button not found');
@@ -815,7 +801,7 @@ val testMethodNotFoundErrorScript = """
815801
elements.map(elem => elem.evaluate(el => el.getAttribute('command')))
816802
);
817803
818-
await page.type('.mynah-chat-prompt-input', '/test generate tests for zipping')
804+
await page.type('.mynah-chat-prompt-input', '/test generate tests for zipping function')
819805
await page.keyboard.press('Enter');
820806
821807
try {
@@ -828,26 +814,12 @@ val testMethodNotFoundErrorScript = """
828814
return pageContent.includes(expectedText);
829815
},
830816
{
831-
timeout: 10000
832-
},
833-
"I apologize, but I could not find the specified class, function, or method"
834-
);
835-
836-
console.log("Method not found error message displayed correctly")
837-
838-
await page.waitForFunction(
839-
(expectedText) => {
840-
const pageContent = document.body.textContent || '';
841-
return pageContent.includes(expectedText);
842-
},
843-
{
844-
timeout: 10000
817+
timeout: 30000
845818
},
846-
"Please make sure the method exists in the current file"
819+
"I apologize, but I could not find the specified class"
847820
);
848-
849-
console.log("Method not found explanation displayed correctly")
850-
821+
822+
console.log("Error message displayed correctly")
851823
await page.waitForFunction(
852824
() => {
853825
const inputElement = document.querySelector('.mynah-chat-prompt-input');
@@ -857,7 +829,7 @@ val testMethodNotFoundErrorScript = """
857829
);
858830
859831
console.log("Input field re-enabled after error")
860-
832+
861833
const feedbackButton = await page.waitForFunction(
862834
(expectedText) => {
863835
const buttons = document.querySelectorAll('button');
@@ -870,12 +842,11 @@ val testMethodNotFoundErrorScript = """
870842
);
871843
872844
if (feedbackButton){
873-
console.log("Feedback button found with correct text")
845+
console.log("Feedback button found with correct text after error")
874846
}else{
875847
console.log("Feedback button not found")
876848
throw new Error('Feedback button not found');
877849
}
878-
879850
880851
} catch (e) {
881852
console.log("Test failed")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import org.junit.Test;
2+
import static org.junit.Assert.*;
3+
4+
public class HappyPathTest {
5+
6+
/**
7+
* Test case for multiply method with positive numbers
8+
* Verifies that the method correctly multiplies two positive double values
9+
*/
10+
@Test
11+
public void test_multiply_positive_numbers() {
12+
double result = HappyPath.multiply(2.5, 3.0);
13+
assertEquals(7.5, result, 0.0001);
14+
}
15+
16+
17+
/**
18+
* Tests the multiply method with positive numbers.
19+
* Verifies that the method correctly multiplies two positive double values.
20+
*/
21+
@Test
22+
public void test_multiply_1() {
23+
double result = HappyPath.multiply(2.5, 3.0);
24+
assertEquals(7.5, result, 0.0001);
25+
}
26+
}

0 commit comments

Comments
 (0)