Skip to content

Commit ac524c5

Browse files
martgilmartgil
andauthored
#5928 Fix secure reply-all issues in Gmail context menu (#5934)
* fix: correct reply-all option invocation * test: test updated * test: update test * refactor: display better label for "reply to all" * test: debugging * test: debugging * test: debugging * test: debugging * test: skip tests that fails too often * chore: add comment --------- Co-authored-by: martgil <[email protected]>
1 parent ab59cca commit ac524c5

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

extension/js/common/xss-safe-factory.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,15 @@ export class XssSafeFactory {
270270
};
271271

272272
public btnSecureMenuBtn = (replyOption: ReplyOption) => {
273-
const actionText = replyOption.replace('a_', '').replace('_', ' ');
274-
const action = {
275-
underscore: actionText.replace(' ', '_'),
276-
hyphen: actionText.replace(' ', '-'),
273+
const replyOptionText = replyOption.replace('a_', '').replace('_', ' ');
274+
const htmlAttrib = {
275+
className: replyOptionText.replace(' ', '_'),
276+
testName: replyOptionText.replace(' ', '-'),
277277
};
278+
const displayText = replyOptionText === 'reply all' ? replyOptionText.replace('all', 'to all') : replyOptionText;
278279
// * The action_${action.underscore}_message_button is used as an identifier in GmailElementReplacer.actionActivateSecureReplyHandler()
279-
return `<div class="action_${action.underscore}_message_button action_menu_message_button" data-test="action-${action.hyphen}-message-button">
280-
<img src="${this.srcImg(`svgs/${action.hyphen}-icon.svg`)}" /><span>secure ${actionText}</span>
280+
return `<div class="action_${htmlAttrib.className}_message_button action_menu_message_button" data-test="action-${htmlAttrib.testName}-message-button">
281+
<img src="${this.srcImg(`svgs/${htmlAttrib.testName}-icon.svg`)}" /><span>secure ${displayText}</span>
281282
</div>`;
282283
};
283284

extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export class GmailElementReplacer extends WebmailElementReplacer {
379379
event.stopImmediatePropagation();
380380
const secureReplyInvokedFromMenu = btn.className.includes('action_menu_message_button');
381381
let replyOption: ReplyOption;
382-
if (btn.className.includes('reply-all')) {
382+
if (btn.className.includes('reply_all')) {
383383
replyOption = 'a_reply_all';
384384
} else if (btn.className.includes('forward')) {
385385
replyOption = 'a_forward';

test/source/tests/gmail.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
301301
);
302302

303303
// convo-sensitive, draft-sensitive test
304-
test.serial(
304+
// skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769, originally uses test.serial
305+
test.skip(
305306
'mail.google.com - secure reply btn, reply draft',
306307
testWithBrowser(
307308
async (t, browser) => {
@@ -403,7 +404,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
403404
);
404405

405406
// https://github.com/FlowCrypt/flowcrypt-browser/issues/5906
406-
test(
407+
// skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769
408+
test.skip(
407409
'mail.google.com - Keep original reply message when switching to secure mode',
408410
testWithBrowser(async (t, browser) => {
409411
await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail');
@@ -421,7 +423,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
421423
await gmailPage.waitAll('.reply_message');
422424
await pageHasSecureReplyContainer(t, browser, gmailPage, { isReplyPromptAccepted: true, composeFrameCount: 2 });
423425
const replyBox = await gmailPage.getFrame(['/chrome/elements/compose.htm', '&skipClickPrompt=___cu_true___'], { sleep: 5 });
424-
await Util.sleep(3);
426+
await replyBox.waitAll(['@action-expand-quoted-text']);
425427
await replyBox.waitAndClick('@action-expand-quoted-text');
426428
// Check if quoted message doesn't contain last message
427429
expect(await replyBox.read('@input-body')).to.not.contain(`Here's reply`);
@@ -495,7 +497,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
495497
})
496498
);
497499

498-
test(
500+
// skipped temporarily as per https://github.com/FlowCrypt/flowcrypt-browser/issues/5934#issuecomment-2664926769
501+
test.skip(
499502
'mail.google.com - switch to encrypted forward',
500503
testWithBrowser(async (t, browser) => {
501504
await BrowserRecipe.setUpCommonAcct(t, browser, 'ci.tests.gmail');
@@ -537,6 +540,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
537540
await gmailPage.waitAndClick('@action-reply-all-message-button');
538541
const replyBox2 = await gmailPage.getFrame(['/chrome/elements/compose.htm'], { sleep: 5 });
539542
await replyBox2.waitForContent('@input-body', '');
543+
const recipientsCount = await replyBox2.target.$$eval('.email_address', elements => elements.length);
544+
expect(recipientsCount).to.equal(2);
540545
await gmailPage.waitAndClick(gmailContextMenu);
541546
await Util.sleep(1);
542547
expect(await gmailPage.isElementPresent('@action-forward-message-button'));

0 commit comments

Comments
 (0)