@@ -402,6 +402,32 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
402402 } )
403403 ) ;
404404
405+ // https://github.com/FlowCrypt/flowcrypt-browser/issues/5906
406+ test (
407+ 'mail.google.com - Keep original reply message when switching to secure mode' ,
408+ testWithBrowser ( async ( t , browser ) => {
409+ await BrowserRecipe . setUpCommonAcct ( t , browser , 'ci.tests.gmail' ) ;
410+ const gmailPage = await openGmailPage ( t , browser ) ;
411+ await gotoGmailPage ( gmailPage , '/FMfcgzGqRGfPBbNLWvfPvDbxnHBwkdGf' ) ; // plain convo
412+ await Util . sleep ( 30 ) ;
413+ await gmailPage . waitAndClick ( '[role="listitem"] .adf.ads' , { delay : 1 } ) ; // click first message of thread
414+ await Util . sleep ( 3 ) ;
415+ const messages = await gmailPage . target . $$ ( '[role="listitem"] .adn.ads' ) ;
416+ const plainReplyButton = await messages [ 0 ] . $ ( '[data-tooltip="Reply"]' ) ;
417+ await Util . sleep ( 1 ) ;
418+ await plainReplyButton ! . click ( ) ;
419+ await gmailPage . waitAndClick ( '#switch_to_encrypted_reply' ) ; // Switch to encrypted compose
420+ await Util . sleep ( 2 ) ;
421+ await gmailPage . waitAll ( '.reply_message' ) ;
422+ await pageHasSecureReplyContainer ( t , browser , gmailPage , { isReplyPromptAccepted : true , composeFrameCount : 2 } ) ;
423+ const replyBox = await gmailPage . getFrame ( [ '/chrome/elements/compose.htm' , '&skipClickPrompt=___cu_true___' ] , { sleep : 5 } ) ;
424+ await Util . sleep ( 3 ) ;
425+ await replyBox . waitAndClick ( '@action-expand-quoted-text' ) ;
426+ // Check if quoted message doesn't contain last message
427+ expect ( await replyBox . read ( '@input-body' ) ) . to . not . contain ( `Here's reply` ) ;
428+ } )
429+ ) ;
430+
405431 test (
406432 'mail.google.com - switch to encrypted reply for middle message' ,
407433 testWithBrowser ( async ( t , browser ) => {
0 commit comments