From 8901d59ec4969a210eb4c28ae8a18322eff14da0 Mon Sep 17 00:00:00 2001 From: martgil Date: Wed, 12 Feb 2025 15:11:50 +0800 Subject: [PATCH 01/10] fix: correct reply-all option invocation --- .../js/content_scripts/webmail/gmail/gmail-element-replacer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 379a17104d2..7a2d21c0aba 100644 --- a/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts +++ b/extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts @@ -374,7 +374,7 @@ export class GmailElementReplacer extends WebmailElementReplacer { event.stopImmediatePropagation(); const secureReplyInvokedFromMenu = btn.className.includes('action_menu_message_button'); let replyOption: ReplyOption; - if (btn.className.includes('reply-all')) { + if (btn.className.includes('reply_all')) { replyOption = 'a_reply_all'; } else if (btn.className.includes('forward')) { replyOption = 'a_forward'; From 35e3dcd778411d44dc5a8e5b95481150d692675a Mon Sep 17 00:00:00 2001 From: martgil Date: Wed, 12 Feb 2025 15:36:38 +0800 Subject: [PATCH 02/10] test: test updated --- test/source/tests/gmail.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index e046509cac6..e47b44635b3 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -525,6 +525,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.waitAndClick('@action-reply-all-message-button'); const replyBox2 = await gmailPage.getFrame(['/chrome/elements/compose.htm'], { sleep: 5 }); await replyBox2.waitForContent('@input-body', ''); + const recipientsCount = await replyBox2.target.$eval('.email_address', e => $(e).length); + expect(recipientsCount).to.equal(2); await gmailPage.waitAndClick(gmailContextMenu); await Util.sleep(1); expect(await gmailPage.isElementPresent('@action-forward-message-button')); From 4205cdab7fa866135b680c6ef67354f7d6776055 Mon Sep 17 00:00:00 2001 From: martgil Date: Wed, 12 Feb 2025 16:58:31 +0800 Subject: [PATCH 03/10] test: update test --- test/source/tests/gmail.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index e47b44635b3..bc6f9a947c4 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -525,7 +525,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.waitAndClick('@action-reply-all-message-button'); const replyBox2 = await gmailPage.getFrame(['/chrome/elements/compose.htm'], { sleep: 5 }); await replyBox2.waitForContent('@input-body', ''); - const recipientsCount = await replyBox2.target.$eval('.email_address', e => $(e).length); + const recipientsCount = await replyBox2.target.$$eval('.email_address', elements => elements.length); expect(recipientsCount).to.equal(2); await gmailPage.waitAndClick(gmailContextMenu); await Util.sleep(1); From 32aebf4ae8cfd9f34361e72e77f368b082d48e6b Mon Sep 17 00:00:00 2001 From: martgil <46025304+martgil@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:22:36 +0800 Subject: [PATCH 04/10] refactor: display better label for "reply to all" --- extension/js/common/xss-safe-factory.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extension/js/common/xss-safe-factory.ts b/extension/js/common/xss-safe-factory.ts index c5da95a3685..05439e0d73a 100644 --- a/extension/js/common/xss-safe-factory.ts +++ b/extension/js/common/xss-safe-factory.ts @@ -270,14 +270,15 @@ export class XssSafeFactory { }; public btnSecureMenuBtn = (replyOption: ReplyOption) => { - const actionText = replyOption.replace('a_', '').replace('_', ' '); - const action = { - underscore: actionText.replace(' ', '_'), - hyphen: actionText.replace(' ', '-'), + const replyOptionText = replyOption.replace('a_', '').replace('_', ' '); + const htmlAttrib = { + className: replyOptionText.replace(' ', '_'), + testName: replyOptionText.replace(' ', '-'), }; + const displayText = replyOptionText === 'reply all' ? replyOptionText.replace('all', 'to all') : replyOptionText; // * The action_${action.underscore}_message_button is used as an identifier in GmailElementReplacer.actionActivateSecureReplyHandler() - return `
- secure ${actionText} + return `
+ secure ${displayText}
`; }; From 5d3288d46ba8724366231ad0e6eaaf252b3a6976 Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 11:13:34 +0800 Subject: [PATCH 05/10] test: debugging --- test/source/tests/gmail.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index bc6f9a947c4..034d842cd5a 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -420,11 +420,11 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await Util.sleep(2); await gmailPage.waitAll('.reply_message'); await pageHasSecureReplyContainer(t, browser, gmailPage, { isReplyPromptAccepted: true, composeFrameCount: 2 }); - const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 }); - await Util.sleep(3); - await replyBox.waitAndClick('@action-expand-quoted-text'); + // const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 }); + // await Util.sleep(3); + // await replyBox.waitAndClick('@action-expand-quoted-text'); // Check if quoted message doesn't contain last message - expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); + // expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); }) ); From a6ac0f1efefdb447fbe609a14139f9ae19aa20af Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 12:25:21 +0800 Subject: [PATCH 06/10] test: debugging --- test/source/tests/gmail.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 034d842cd5a..24973139ffa 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -420,9 +420,9 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await Util.sleep(2); await gmailPage.waitAll('.reply_message'); await pageHasSecureReplyContainer(t, browser, gmailPage, { isReplyPromptAccepted: true, composeFrameCount: 2 }); - // const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 }); - // await Util.sleep(3); - // await replyBox.waitAndClick('@action-expand-quoted-text'); + const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm'], { sleep: 5 }); + await Util.sleep(3); + await replyBox.waitAndClick('@action-expand-quoted-text'); // Check if quoted message doesn't contain last message // expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); }) From 47039762d25a0ae03088e9ee7e12502ecb832617 Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 13:23:33 +0800 Subject: [PATCH 07/10] test: debugging --- test/source/tests/gmail.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 24973139ffa..cbcfd0e2d65 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -420,8 +420,10 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await Util.sleep(2); await gmailPage.waitAll('.reply_message'); await pageHasSecureReplyContainer(t, browser, gmailPage, { isReplyPromptAccepted: true, composeFrameCount: 2 }); - const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm'], { sleep: 5 }); + const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 }); await Util.sleep(3); + console.log(await replyBox.read('@input-body')); + console.log(await replyBox.read('@action-expand-quoted-text')); await replyBox.waitAndClick('@action-expand-quoted-text'); // Check if quoted message doesn't contain last message // expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); From cbca8de1bb73dab1f094d63719b77a5673cd7d7a Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 14:43:56 +0800 Subject: [PATCH 08/10] test: debugging --- test/source/tests/gmail.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index cbcfd0e2d65..31884c5aa86 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -421,12 +421,10 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test await gmailPage.waitAll('.reply_message'); await pageHasSecureReplyContainer(t, browser, gmailPage, { isReplyPromptAccepted: true, composeFrameCount: 2 }); const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 }); - await Util.sleep(3); - console.log(await replyBox.read('@input-body')); - console.log(await replyBox.read('@action-expand-quoted-text')); + await replyBox.waitAll(['@action-expand-quoted-text']); await replyBox.waitAndClick('@action-expand-quoted-text'); // Check if quoted message doesn't contain last message - // expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); + expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`); }) ); From eb1d557ce1851730bef7e316022381616ce7e512 Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 18:44:44 +0800 Subject: [PATCH 09/10] test: skip tests that fails too often --- test/source/tests/gmail.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 5189f184ebc..17a74efc9df 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -301,7 +301,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test ); // convo-sensitive, draft-sensitive test - test.serial( + // skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769 + test.skip( 'mail.google.com - secure reply btn, reply draft', testWithBrowser( async (t, browser) => { @@ -403,7 +404,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test ); // https://github.com/FlowCrypt/flowcrypt-browser/issues/5906 - test( + // skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769 + test.skip( 'mail.google.com - Keep original reply message when switching to secure mode', testWithBrowser(async (t, browser) => { await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail'); @@ -495,7 +497,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test }) ); - test( + // skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769 + test.skip( 'mail.google.com - switch to encrypted forward', testWithBrowser(async (t, browser) => { await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail'); From e9bd7d04dc54044bd7777014024d0e03e49a6560 Mon Sep 17 00:00:00 2001 From: martgil Date: Tue, 18 Feb 2025 18:54:21 +0800 Subject: [PATCH 10/10] chore: add comment --- test/source/tests/gmail.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/source/tests/gmail.ts b/test/source/tests/gmail.ts index 17a74efc9df..48516fd100d 100644 --- a/test/source/tests/gmail.ts +++ b/test/source/tests/gmail.ts @@ -301,7 +301,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test ); // convo-sensitive, draft-sensitive test - // skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769 + // skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769, originally uses test.serial test.skip( 'mail.google.com - secure reply btn, reply draft', testWithBrowser(