From 7d0012c037c46c4ba8d30eb6fde3ce44398f5122 Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Mon, 23 Feb 2026 21:24:28 -0800 Subject: [PATCH 1/2] fix: opening encrypted contact page email issue --- .../webmail/gmail/gmail-element-replacer.ts | 2 +- test/source/tests/gmail.ts | 18 ++++++++++++++++++ test/source/tests/tooling/browser-recipe.ts | 13 +++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts b/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts index 4fcdfc4381b..f083808623d 100644 --- a/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts +++ b/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts @@ -206,7 +206,7 @@ export class GmailElementReplacer extends WebmailElementReplacer { // check if message body was converted to attachment by Gmail // happens for pgp/mime messages with attachments // https://github.com/FlowCrypt/flowcrypt-browser/issues/5458 - const encryptedMsgAttachment = attachments.find(a => !a.name && a.treatAs(attachments) === 'encryptedMsg'); + const encryptedMsgAttachment = attachments.find(a => !a.name && a.treatAs(attachments, Mime.isBodyEmpty(body)) === 'encryptedMsg'); if (encryptedMsgAttachment) { const msgEl = this.getMsgBodyEl(msgId); const loaderContext = new GmailLoaderContext(this.factory, msgEl); diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index c29f435e7fb..280c6eeef6d 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -666,6 +666,24 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test }) ); + // https://github.com/FlowCrypt/flowcrypt-browser/issues/6171 + test( + `mail.google.com - large clipped PGP/MIME message with text/plain attachment decrypts`, + testWithBrowser(async (t, browser) => { + await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail'); + const gmailPage = await openGmailPage(t, browser); + await gotoGmailPage(gmailPage, '/FMfcgzQfBspgLbfNnBHGtlBsFtcLGPsr'); + const urls = await gmailPage.getFramesUrls(['/chrome/elements/pgp_block.htm'], { sleep: 10, appearIn: 25 }); + expect(urls.length).to.equal(1); + const pgpBlockFrame = await gmailPage.getFrame(['pgp_block.htm']); + await BrowserRecipe.pgpBlockCheck(t, pgpBlockFrame, { + content: ['Test large clipped message'], + encryption: 'encrypted', + signature: 'not signed', + }); + }) + ); + test( `mail.google.com - render plain text for "message" attachment (which has plain text)`, testWithBrowser(async (t, browser) => { diff --git a/test/source/tests/tooling/browser-recipe.ts b/test/source/tests/tooling/browser-recipe.ts index 96c3f8dc8e2..a75fcdbd28d 100644 --- a/test/source/tests/tooling/browser-recipe.ts +++ b/test/source/tests/tooling/browser-recipe.ts @@ -71,12 +71,17 @@ export class BrowserRecipe { public static openGoogleChatPage = async (t: AvaContext, browser: BrowserHandle, googleLoginIndex = 0) => { const googleChatPage = await browser.newPage(t, TestUrls.googleChat(googleLoginIndex)); await Util.sleep(5); - const chatFrame = await googleChatPage.getFrame(['https://chat.google.com/u/0/mole/world']); - if (await chatFrame.isElementPresent('.fKz7Od')) { + let context: ControllableFrame | ControllablePage; + try { + context = await googleChatPage.getFrame(['https://chat.google.com/u/0/mole/world']); + } catch { + context = googleChatPage; + } + if (await context.isElementPresent('.fKz7Od')) { // close announcement about updated UI - await chatFrame.waitAndClick('.fKz7Od', { delay: 1 }); + await context.waitAndClick('.fKz7Od', { delay: 1 }); } - await chatFrame.waitAny(['a.gb_de', 'a.gb_Vc', 'a.gb_he']); // Google hangout logo + await context.waitAny(['a.gb_de', 'a.gb_Vc', 'a.gb_he']); // Google hangout logo return googleChatPage; }; From e306b60a011a1c544c78d7d909f959b1d3d53698 Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Tue, 24 Feb 2026 01:54:41 -0800 Subject: [PATCH 2/2] fix: test --- test/source/tests/compose.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/source/tests/compose.ts b/test/source/tests/compose.ts index 4d08521046d..86966be95ef 100644 --- a/test/source/tests/compose.ts +++ b/test/source/tests/compose.ts @@ -1707,7 +1707,8 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te }, }); const composePage = await ComposePageRecipe.openStandalone(t, browser, 'compose'); - await composePage.waitAndClick('@action-show-container-cc-bcc-buttons'); + await Util.sleep(2); + await ComposePageRecipe.showRecipientInput(composePage); await composePage.type('@input-to', 'contact'); if (testVariant === 'CONSUMER-MOCK') { // allow contacts scope