-
Notifications
You must be signed in to change notification settings - Fork 11
#2692 Add ability to attach public key #2695
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
Open
ioanatflowcrypt
wants to merge
3
commits into
master
Choose a base branch
from
2692-add-ability-to-attach-public-key-to-email-message
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
appium/tests/specs/mock/composeEmail/CheckPublicKeyAttachment.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { MockApi } from 'api-mocks/mock'; | ||
import { MockApiConfig } from 'api-mocks/mock-config'; | ||
import { MockUserList } from 'api-mocks/mock-data'; | ||
import { | ||
SplashScreen, | ||
MailFolderScreen, | ||
NewMessageScreen, | ||
SetupKeyScreen, | ||
MenuBarScreen, | ||
EmailScreen, | ||
} from '../../../screenobjects/all-screens'; | ||
|
||
describe('COMPOSE EMAIL: ', () => { | ||
it('check public key attachment attach', async () => { | ||
const mockApi = new MockApi(); | ||
const recipient = MockUserList.dmitry; | ||
const testSubject1 = 'Test public key attachment - PGP'; | ||
const testSubject2 = 'Test public key attachment - Password'; | ||
|
||
mockApi.fesConfig = MockApiConfig.defaultEnterpriseFesConfiguration; | ||
mockApi.ekmConfig = MockApiConfig.defaultEnterpriseEkmConfiguration; | ||
const email = '[email protected]'; | ||
mockApi.addGoogleAccount(email); | ||
|
||
// Set up attester to serve public key for PGP recipient | ||
mockApi.attesterConfig = { | ||
servedPubkeys: { | ||
[recipient.email]: recipient.pub!, | ||
}, | ||
}; | ||
|
||
await mockApi.withMockedApis(async () => { | ||
await SplashScreen.mockLogin(); | ||
await SetupKeyScreen.setPassPhrase(); | ||
await MailFolderScreen.checkInboxScreen(); | ||
|
||
// Test 1: Public key attachment with regular PGP message | ||
await MailFolderScreen.clickCreateEmail(); | ||
|
||
// Compose email | ||
await NewMessageScreen.setAddRecipient(recipient.email); | ||
await NewMessageScreen.setSubject(testSubject1); | ||
await NewMessageScreen.setComposeSecurityMessage('This message includes my public key'); | ||
|
||
// Click attach button | ||
await NewMessageScreen.clickAttachButton(); | ||
|
||
// Wait for action sheet to appear and click "Public key" using accessibility identifier | ||
await browser.pause(1000); | ||
await NewMessageScreen.clickAttachPublicKeyButton(); | ||
|
||
// Check that public key attachment was added | ||
// The filename should be in format 0x{longid}.asc | ||
await browser.pause(1000); | ||
const attachmentLabel = await NewMessageScreen.attachmentNameLabel; | ||
const attachmentName = await attachmentLabel.getValue(); | ||
expect(attachmentName).toMatch(/^0x[A-F0-9]{16}\.asc$/); | ||
|
||
// Send the message | ||
await NewMessageScreen.clickSendButton(); | ||
await browser.pause(1000); | ||
|
||
// Go to sent folder to verify the attachment | ||
await MenuBarScreen.clickMenuBtn(); | ||
await MenuBarScreen.clickSentButton(); | ||
await MailFolderScreen.checkSentScreen(); | ||
await MailFolderScreen.clickOnEmailBySubject(testSubject1); | ||
|
||
// Verify attachment in sent email | ||
// TODO: need to uncomment this line when we fix public key render issue | ||
// https://github.com/FlowCrypt/flowcrypt-ios/issues/634 | ||
// await EmailScreen.checkPublicKeyImportView(email, recipient.pub!, false); | ||
await EmailScreen.clickBackButton(); | ||
|
||
// Go back to inbox for test 2 | ||
await MenuBarScreen.clickMenuBtn(); | ||
await MenuBarScreen.clickInboxButton(); | ||
await MailFolderScreen.checkInboxScreen(); | ||
|
||
// Test 2: Public key attachment with password-protected message (non-PGP recipient) | ||
await MailFolderScreen.clickCreateEmail(); | ||
|
||
// Compose email to non-PGP recipient | ||
await NewMessageScreen.setAddRecipient('[email protected]'); | ||
await NewMessageScreen.setSubject(testSubject2); | ||
await NewMessageScreen.setComposeSecurityMessage('This password-protected message includes my public key'); | ||
|
||
// Click attach button | ||
await NewMessageScreen.clickAttachButton(); | ||
|
||
// Wait for action sheet to appear and click "Public key" using accessibility identifier | ||
await browser.pause(1000); | ||
await NewMessageScreen.clickAttachPublicKeyButton(); | ||
|
||
// Check that public key attachment was added | ||
await browser.pause(1000); | ||
const attachmentLabel2 = await NewMessageScreen.attachmentNameLabel; | ||
const attachmentName2 = await attachmentLabel2.getValue(); | ||
expect(attachmentName2).toMatch(/^0x[A-F0-9]{16}\.asc$/); | ||
|
||
// Set message password | ||
await NewMessageScreen.clickPasswordCell(); | ||
await NewMessageScreen.setMessagePassword('abcABC1*'); | ||
|
||
// Send the password-protected message | ||
await NewMessageScreen.clickSendButton(); | ||
await browser.pause(1000); | ||
|
||
// Go to sent folder to verify the attachment | ||
await MenuBarScreen.clickMenuBtn(); | ||
await MenuBarScreen.clickSentButton(); | ||
await MailFolderScreen.checkSentScreen(); | ||
await MailFolderScreen.clickOnEmailBySubject(testSubject2); | ||
|
||
// Verify attachment in sent password-protected email | ||
// TODO: need to uncomment this line when we fix public key render issue | ||
// https://github.com/FlowCrypt/flowcrypt-ios/issues/634 | ||
// await EmailScreen.checkPublicKeyImportView(email, recipient.pub!, false); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.