@@ -13,6 +13,7 @@ import { Messenger } from './framework/messenger'
13
13
import { FollowUpTypes } from '../../amazonqFeatureDev/types'
14
14
import { examples , newTaskChanges , sessionClosed } from '../../amazonqFeatureDev/userFacingText'
15
15
import { ChatItem } from '@aws/mynah-ui'
16
+ import { sleep } from '../../shared/utilities/timeoutUtils'
16
17
17
18
describe ( 'Amazon Q Feature Dev' , function ( ) {
18
19
let framework : qTestingFramework
@@ -22,6 +23,7 @@ describe('Amazon Q Feature Dev', function () {
22
23
const prompt = 'Implement fibonacci in typescript'
23
24
const iterateApproachPrompt = prompt + ' and add tests'
24
25
const codegenApproachPrompt = prompt + ' and add even more tests'
26
+ const tooManyRequestsWaitTime = 100000
25
27
26
28
before ( async function ( ) {
27
29
await using( registerAuthHook ( 'amazonq-test-account' ) , async ( ) => {
@@ -120,16 +122,25 @@ describe('Amazon Q Feature Dev', function () {
120
122
await waitUntilReady ( )
121
123
122
124
const findAnotherTopic = 'find another topic to discuss'
125
+ const tooManyRequests = 'Too many requests'
126
+ const failureState = ( message : string ) => {
127
+ return (
128
+ tab . getChatItems ( ) . pop ( ) ?. body ?. includes ( message ) ||
129
+ tab . getChatItems ( ) . slice ( - 2 ) . shift ( ) ?. body ?. includes ( message )
130
+ )
131
+ }
123
132
while (
124
133
tab . hasButton ( FollowUpTypes . Retry ) ||
125
- ( request &&
126
- ( tab . getChatItems ( ) . pop ( ) ?. body ?. includes ( findAnotherTopic ) ||
127
- tab . getChatItems ( ) . slice ( - 2 ) . shift ( ) ?. body ?. includes ( findAnotherTopic ) ) )
134
+ ( request && ( failureState ( findAnotherTopic ) || failureState ( tooManyRequests ) ) )
128
135
) {
129
136
if ( tab . hasButton ( FollowUpTypes . Retry ) ) {
130
137
console . log ( 'Retrying request' )
131
138
tab . clickButton ( FollowUpTypes . Retry )
132
139
await waitUntilReady ( )
140
+ } else if ( failureState ( tooManyRequests ) ) {
141
+ // 3 versions of the e2e tests are running at the same time in the ci so we occassionally need to wait before continuing
142
+ request && request ( )
143
+ await sleep ( tooManyRequestsWaitTime )
133
144
} else {
134
145
// We've hit guardrails, re-make the request and wait again
135
146
request && request ( )
0 commit comments