Skip to content

Re-phrase lost password when user uses key manager url #3821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 27, 2021

Conversation

martgil
Copy link
Collaborator

@martgil martgil commented Jul 16, 2021

issue #3781

Re-phrasing the "lost password" context when the user uses key manager which came from org rules.


To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@martgil
Copy link
Collaborator Author

martgil commented Jul 21, 2021

Here is the underlying error that prevents me when trying to create a new test for issue #3781.

Hi @tomholub. Thanks for the reference, It helps me to understand it better now. I have tried what exactly we need to do but I am having an error on compose.ts for some reason:
image

As we can see even though I haven't used any of the .passphrase property it still insists TypeError: Cannot read property 'passphrase' of undefined at Function.SetupPageRecipe.recover (/home/mart/project/flowcrypt-browser/test/source/tests/page-recipe/setup-page-recipe.ts:208:69).

The npm command I used for testing is the npm run test_local_chrome_consumer_mock; So that the if (testVariant !== 'CONSUMER-LIVE-GMAIL') will pass since I'm running the local test for consumer and not a consumer-live variant of testing. I believed that the flowcrypt-browser/test/source/tests/page-recipe/setup-page-recipe.ts has nothing to do with the error. The error for .passphrase property is undefined keeps appearing even on the untouched version of the code from compose.ts so It's really strange.

@martgil martgil marked this pull request as draft July 21, 2021 09:25
await inboxPage.waitAll('@dialog-passphrase');
const passphraseDialog = await inboxPage.getFrame(['passphrase.htm']);
await Util.sleep(5);
expect(await passphraseDialog.readHtml('@lost-pass-phrase-with-ekm')).to.equal('Ask your IT staff for help if you lost your pass phrase.');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to copy the whole test and make a new one: you should can instead edit the existing EKM test I referred to earlier.

@martgil
Copy link
Collaborator Author

martgil commented Jul 26, 2021

@tomholub I have moved the test to the existing one you're referring to and confirmed the test works properly. But there is still a build error in the CI which I don't have an idea why.

@tomholub
Copy link
Collaborator

Live Gmail tests sometimes have problems with login, not your fault. I'm re-running them.

@tomholub
Copy link
Collaborator

And bringing updates from master to here, in case we fixed it since.

Comment on lines 447 to 448
await Util.sleep(5);
expect(await passphraseDialog.readHtml('@lost-pass-phrase-with-ekm')).to.equal('Ask your IT staff for help if you lost your pass phrase.');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use waitForContent method, which will keep retrying until it can find the text, instead of wait + try once. (it will execute faster, as it doesn't always have to wait for 5 seconds)

Otherwise this looks good. You should also alter one more test - a test that doesn't use EKM, to test the opposite scenario. I'll highlight the discussion below.

@tomholub
Copy link
Collaborator

As I mentioned in #3781 (comment) , you should also test the opposite scenario without EKM - again but adding one more test condition to the existing test.


5. find and edit an appropriate test that does not have OrgRules set. You've already found one: `compose - signed with entered pass phrase + will remember pass phrase in session`
    ava.default('compose - signed with entered pass phrase + will remember pass phrase in session', testWithBrowser('ci.tests.gmail', async (t, browser) => {
      const k = Config.key('ci.tests.gmail');
      const settingsPage = await browser.newPage(t, TestUrls.extensionSettings('ci.tests.gmail@flowcrypt.test'));
      await SettingsPageRecipe.forgetAllPassPhrasesInStorage(settingsPage, k.passphrase);
      const inboxPage = await browser.newPage(t, TestUrls.extensionInbox('ci.tests.gmail@flowcrypt.test'));
      const composeFrame = await InboxPageRecipe.openAndGetComposeFrame(inboxPage);
      await ComposePageRecipe.fillMsg(composeFrame, { to: 'human@flowcrypt.com' }, 'sign with entered pass phrase', { encrypt: false });
      await composeFrame.waitAndClick('@action-send');
      await inboxPage.waitAll('@dialog-passphrase');
      const passphraseDialog = await inboxPage.getFrame(['passphrase.htm']);
      await passphraseDialog.waitAndType('@input-pass-phrase', k.passphrase);
      await passphraseDialog.waitAndClick('@action-confirm-pass-phrase-entry');
      await inboxPage.waitTillGone('@dialog-passphrase');
      await inboxPage.waitTillGone('@container-new-message'); // confirming pass phrase will auto-send the message
      // signed - done, now try to see if it remembered pp in session
      const composePage = await ComposePageRecipe.openStandalone(t, browser, 'compose');
      await ComposePageRecipe.fillMsg(composePage, { to: 'human@flowcrypt.com' }, 'signed message pp in session', { encrypt: false });
      await ComposePageRecipe.sendAndClose(composePage);
      await settingsPage.close();
      await inboxPage.close();
    }));

Notice that it has a generic domain: ci.tests.gmail@flowcrypt.test. This should mean that it doesn't have any OrgRules set up (unlike for example user@forbid-storing-passphrase-org-rule.flowcrypt.test which does).

Here you can similarly edit the test, but this time to test for the opposite behavior.

@martgil
Copy link
Collaborator Author

martgil commented Jul 27, 2021

Thanks, @tomholub. I will pay more attention to small details next time. I think we have the test we want for this. I have learned so much here. Thanks Again!

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@tomholub tomholub marked this pull request as ready for review July 27, 2021 12:20
@tomholub tomholub merged commit 56c2592 into master Jul 27, 2021
@tomholub tomholub deleted the rephrase-lost-password branch July 27, 2021 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace "Forgot pass phrase?" on pass phrase dialog when key_manager_url OrgRule is set
3 participants