@@ -215,5 +215,87 @@ describe('Amazon Q Feature Dev', function () {
215215 tab . clickButton ( FollowUpTypes . InsertCode )
216216 await waitForButtons ( [ FollowUpTypes . NewTask , FollowUpTypes . CloseSession ] )
217217 } )
218+
219+ describe ( 'file-level accepts' , async ( ) => {
220+ beforeEach ( async ( ) => {
221+ await retryIfRequired ( async ( ) => {
222+ await Promise . any ( [
223+ waitForButtons ( [ FollowUpTypes . InsertCode , FollowUpTypes . ProvideFeedbackAndRegenerateCode ] ) ,
224+ waitForButtons ( [ FollowUpTypes . Retry ] ) ,
225+ ] )
226+ } )
227+ } )
228+
229+ describe ( 'fileList' , async ( ) => {
230+ it ( 'has both accept-change and reject-change action buttons for file' , async ( ) => {
231+ const filePath = tab . getFilePaths ( ) [ 0 ]
232+ assert . ok ( tab . getActionsByFilePath ( filePath ) . length === 2 )
233+ assert . ok ( tab . hasAction ( filePath , 'accept-change' ) )
234+ assert . ok ( tab . hasAction ( filePath , 'reject-change' ) )
235+ } )
236+
237+ it ( 'has only revert-rejection action buttons for rejected file' , async ( ) => {
238+ const filePath = tab . getFilePaths ( ) [ 0 ]
239+ tab . clickFileActionButton ( filePath , 'reject-change' )
240+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'reject-change' ) )
241+
242+ assert . ok ( tab . getActionsByFilePath ( filePath ) . length === 1 )
243+ assert . ok ( tab . hasAction ( filePath , 'revert-rejection' ) )
244+ } )
245+
246+ it ( 'does not have any action buttons for accepted file' , async ( ) => {
247+ const filePath = tab . getFilePaths ( ) [ 0 ]
248+ tab . clickFileActionButton ( filePath , 'accept-change' )
249+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'accept-change' ) )
250+
251+ assert . ok ( tab . getActionsByFilePath ( filePath ) . length === 0 )
252+ } )
253+ } )
254+
255+ describe ( 'accept changes button' , async ( ) => {
256+ describe ( 'button text' , async ( ) => {
257+ it ( 'shows Accept all changes when all files are neither accepted nor rejected' , async ( ) => {
258+ const insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
259+ assert . ok ( insertCodeButton . pillText === 'Accept all changes' )
260+ } )
261+
262+ it ( 'shows Accept remaining changes when one or more file is rejected' , async ( ) => {
263+ const filePath = tab . getFilePaths ( ) [ 0 ]
264+ tab . clickFileActionButton ( filePath , 'reject-change' )
265+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'reject-change' ) )
266+
267+ const insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
268+ assert . ok ( insertCodeButton . pillText === 'Accept remaining changes' )
269+ } )
270+
271+ it ( 'shows Accept remaining changes when one or more file is accepted' , async ( ) => {
272+ const filePath = tab . getFilePaths ( ) [ 0 ]
273+ tab . clickFileActionButton ( filePath , 'accept-change' )
274+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'accept-change' ) )
275+
276+ const insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
277+ assert . ok ( insertCodeButton . pillText === 'Accept remaining changes' )
278+ } )
279+
280+ it ( 'shows Accept remaining changes when a file is rejected, then shows Accept all changes again when the rejection is reverted' , async ( ) => {
281+ let insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
282+ assert . ok ( insertCodeButton . pillText === 'Accept all changes' )
283+
284+ const filePath = tab . getFilePaths ( ) [ 0 ]
285+ tab . clickFileActionButton ( filePath , 'reject-change' )
286+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'reject-change' ) )
287+
288+ insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
289+ assert . ok ( insertCodeButton . pillText === 'Accept remaining changes' )
290+
291+ tab . clickFileActionButton ( filePath , 'revert-rejection' )
292+ await tab . waitForEvent ( ( ) => ! tab . hasAction ( filePath , 'revert-rejection' ) )
293+
294+ insertCodeButton = tab . getFollowUpButton ( FollowUpTypes . InsertCode )
295+ assert . ok ( insertCodeButton . pillText === 'Accept all changes' )
296+ } )
297+ } )
298+ } )
299+ } )
218300 } )
219301} )
0 commit comments