-
Notifications
You must be signed in to change notification settings - Fork 48
Replace "Forgot pass phrase?" on pass phrase dialog when key_manager_url OrgRule is set #3781
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
Comments
That looks good but is that still a link? It looks like the user could click it and go somewhere we don't want them to go. |
Let's disable the link when the user uses EKM as you say |
There's a test that uses EKM and also FORBID_STORING_PASS_PHRASE org rule. That test will be using the pass phrase dialog, I think. You can add a line to that test to verify the content has changed and is not clickable. Thanks! |
I have tried to understand how ava testing was implemented in the flowcrypt-browser but I can't able to absorb what's happening inside the code. Can I help somebody once I get it, I'm going to add the test for the changes that I have made hopefully. Pardon me for any inconvenience. |
@martgil see if "Running tests locally" in https://github.com/FlowCrypt/flowcrypt-browser/wiki will help you. After that, please ask a more specific question and we'll be able to help or demonstrate. Thanks! |
Hi @tomholub. Thanks for that. I think I have found it. There is currently a test that involves the |
Could you point me to the test you found? |
I found this test located in 'test/source/tests/compose.ts' and the exact test im referring is the 'compose - signed with entered pass phrase + will remember pass phrase in session' from this ava test. Because it has the passphraseDiaglog which I need to fetch the DOM tree from. |
Here's how to find the ideal test to modify (or how to write a new test) when testing OrgRules.
Here, it's not quite clear - but since this will be just a small change, it doesn't hurt to address both sides. Let's start with the specific OrgRule test as an example.
here's one: another one:
In our case, it seems to be this one: ava.default('[email protected] - do not store passphrase', testWithBrowser(undefined, async (t, browser) => {
const acctEmail = '[email protected]';
const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, acctEmail);
await Util.sleep(5);
const passphrase = 'long enough to suit requirements';
await SetupPageRecipe.createKey(settingsPage, 'unused', 'none', { key: { passphrase }, usedPgpBefore: false },
{ isSavePassphraseDisabled: true, isSavePassphraseChecked: false });
await settingsPage.notPresent('.swal2-container');
const inboxPage = await browser.newPage(t, TestUrls.extensionInbox(acctEmail));
await InboxPageRecipe.finishSessionOnInboxPage(inboxPage);
const composeFrame = await InboxPageRecipe.openAndGetComposeFrame(inboxPage);
await ComposePageRecipe.fillMsg(composeFrame, { to: '[email protected]' }, 'should not send as pass phrase is not known', { encrypt: false });
await composeFrame.waitAndClick('@action-send');
await inboxPage.waitAll('@dialog-passphrase');
const passphraseDialog = await inboxPage.getFrame(['passphrase.htm']);
const forgetPassPhraseElement = await passphraseDialog.waitAny('@forget-pass-phrase');
expect(await InboxPageRecipe.isElementDisabled(forgetPassPhraseElement)).to.equal(true);
expect(await InboxPageRecipe.isElementChecked(forgetPassPhraseElement)).to.equal(true);
await inboxPage.close();
await settingsPage.close();
})); If you notice, it already uses You can run the test per wiki (with .only) to make sure it runs properly.
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('[email protected]'));
await SettingsPageRecipe.forgetAllPassPhrasesInStorage(settingsPage, k.passphrase);
const inboxPage = await browser.newPage(t, TestUrls.extensionInbox('[email protected]'));
const composeFrame = await InboxPageRecipe.openAndGetComposeFrame(inboxPage);
await ComposePageRecipe.fillMsg(composeFrame, { to: '[email protected]' }, '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: '[email protected]' }, 'signed message pp in session', { encrypt: false });
await ComposePageRecipe.sendAndClose(composePage);
await settingsPage.close();
await inboxPage.close();
})); Notice that it has a generic domain: Here you can similarly edit the test, but this time to test for the opposite behavior. |
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: As we can see even though I haven't used any of the The npm command I used for testing is the |
Please submit it to the Draft PR, then we'll be able to try it and help more specifically. |
Understood @tomholub. I have converted the original PR into a draft PR for this issue. |
…3821) * Re-phrase lost password when user uses key manager url * Remove link pop-up for FES user * use javascript when switching "lost passphrase" context * update descriptive css naming convention * Added test for 'rephrase forgot passphrase for ekm user with disabled link' * Added new line before the ava.default on compose.ts * moved passphrase test for ekm user from compose.ts to setup.ts * add additional test for lost passphrase; uses waitForContent Co-authored-by: Tom J <[email protected]>
Instead of the "Forgot pass phrase?" link, there should be text that says "Ask your IT staff for help if you lost your pass phrase."
The text was updated successfully, but these errors were encountered: