@@ -26,9 +26,7 @@ val testHappyPathScript = """
26
26
await page.keyboard.press('Enter');
27
27
try {
28
28
await page.evaluate(() => {
29
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
30
- button => button.textContent.includes('Acknowledge')
31
- );
29
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
32
30
if (acknowledgeButton) {
33
31
acknowledgeButton.click();
34
32
}
@@ -304,6 +302,12 @@ val testRejectPathScript = """
304
302
try {
305
303
await waitForElementWithText(page, "Q - Test")
306
304
console.log("new tab opened")
305
+ await page.evaluate(() => {
306
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
307
+ if (acknowledgeButton) {
308
+ acknowledgeButton.click();
309
+ }
310
+ });
307
311
await page.waitForFunction(
308
312
() => {
309
313
const button = document.querySelector('button[action-id="utg_view_diff"]');
@@ -348,15 +352,6 @@ val testRejectPathScript = """
348
352
349
353
console.log("Input field re-enabled after rejection")
350
354
351
- await page.evaluate(() => {
352
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
353
- button => button.textContent.includes('Acknowledge')
354
- );
355
- if (acknowledgeButton) {
356
- acknowledgeButton.click();
357
- }
358
- });
359
-
360
355
const feedbackButton = await page.waitForFunction(
361
356
(expectedText) => {
362
357
const buttons = document.querySelectorAll('button');
@@ -553,6 +548,13 @@ val testCancelButtonScript = """
553
548
try {
554
549
await waitForElementWithText(page, "Q - Test")
555
550
console.log("new tab opened")
551
+ await page.evaluate(() => {
552
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
553
+ if (acknowledgeButton) {
554
+ acknowledgeButton.click();
555
+ }
556
+ });
557
+
556
558
557
559
558
560
await page.waitForFunction(
@@ -599,18 +601,7 @@ val testCancelButtonScript = """
599
601
);
600
602
601
603
console.log("Input field re-enabled after cancellation")
602
-
603
- await page.evaluate(() => {
604
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
605
- button => button.textContent.includes('Acknowledge')
606
- );
607
- if (acknowledgeButton) {
608
- acknowledgeButton.click();
609
- }
610
- });
611
-
612
-
613
-
604
+
614
605
const feedbackButton = await page.waitForFunction(
615
606
(expectedText) => {
616
607
const buttons = document.querySelectorAll('button');
@@ -674,6 +665,12 @@ val testDocumentationErrorScript = """
674
665
await waitForElementWithText(page, "Q - Test")
675
666
console.log("new tab opened")
676
667
668
+ await page.evaluate(() => {
669
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
670
+ if (acknowledgeButton) {
671
+ acknowledgeButton.click();
672
+ }
673
+ });
677
674
await page.waitForFunction(
678
675
(expectedText) => {
679
676
const pageContent = document.body.textContent || '';
@@ -696,15 +693,6 @@ val testDocumentationErrorScript = """
696
693
);
697
694
698
695
console.log("Input field re-enabled after error")
699
-
700
- await page.evaluate(() => {
701
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
702
- button => button.textContent.includes('Acknowledge')
703
- );
704
- if (acknowledgeButton) {
705
- acknowledgeButton.click();
706
- }
707
- });
708
696
709
697
const feedbackButton = await page.waitForFunction(
710
698
(expectedText) => {
@@ -767,6 +755,12 @@ val testRemoveFunctionErrorScript = """
767
755
try {
768
756
await waitForElementWithText(page, "Q - Test")
769
757
console.log("new tab opened")
758
+ await page.evaluate(() => {
759
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
760
+ if (acknowledgeButton) {
761
+ acknowledgeButton.click();
762
+ }
763
+ });
770
764
771
765
await page.waitForFunction(
772
766
(expectedText) => {
@@ -790,15 +784,6 @@ val testRemoveFunctionErrorScript = """
790
784
791
785
console.log("Input field re-enabled after error")
792
786
793
- await page.evaluate(() => {
794
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
795
- button => button.textContent.includes('Acknowledge')
796
- );
797
- if (acknowledgeButton) {
798
- acknowledgeButton.click();
799
- }
800
- });
801
-
802
787
const feedbackButton = await page.waitForFunction(
803
788
(expectedText) => {
804
789
const buttons = document.querySelectorAll('button');
@@ -860,6 +845,12 @@ val testMethodNotFoundErrorScript = """
860
845
try {
861
846
await waitForElementWithText(page, "Q - Test")
862
847
console.log("new tab opened")
848
+ await page.evaluate(() => {
849
+ const acknowledgeButton = document.querySelector('button[action-id=amazonq-disclaimer-acknowledge-button-id]');
850
+ if (acknowledgeButton) {
851
+ acknowledgeButton.click();
852
+ }
853
+ });
863
854
864
855
await page.waitForFunction(
865
856
(expectedText) => {
@@ -883,15 +874,6 @@ val testMethodNotFoundErrorScript = """
883
874
884
875
console.log("Input field re-enabled after error")
885
876
886
- await page.evaluate(() => {
887
- const acknowledgeButton = Array.from(document.querySelectorAll('button')).find(
888
- button => button.textContent.includes('Acknowledge')
889
- );
890
- if (acknowledgeButton) {
891
- acknowledgeButton.click();
892
- }
893
- });
894
-
895
877
const feedbackButton = await page.waitForFunction(
896
878
(expectedText) => {
897
879
const buttons = document.querySelectorAll('button');
0 commit comments