Repository navigation
fixed "no private key available" issue. Part 2. add email to existing key #2669
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
DenBond7
merged 15 commits into
master
from
issue_597_add_user_id_to_exsisting_private_key
Apr 5, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f8dcaec
Added ChoosePrivateKeyDialogFragment.| #597
DenBond7 41fe1b4
Merge branch 'master' into issue_597_add_user_id_to_exsisting_private…
DenBond7 352fe9e
Added AddNewUserIdToPrivateKeyDialogFragment.| #597
DenBond7 c4ab639
'add email to existing key'. Handled a case when a private key has a …
DenBond7 97b294e
'add email to existing key'. Added updating contacts after editing a …
DenBond7 adbc5b2
wip
DenBond7 35938ef
wip
DenBond7 a9cb84c
Fixed option "no private key available|add email to existing key" if …
DenBond7 e34f85c
Added ComposeScreenNoKeyAvailableFlowTest.testAddEmailToExistingSingl…
DenBond7 b02a36f
wip
DenBond7 2663ebc
wip
DenBond7 52b1baf
Added ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInDatabase…
DenBond7 3a6b813
Added ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInRamFlowT…
DenBond7 7d45767
Added ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInRamFlowTest…
DenBond7 3af339d
Refactored code
DenBond7 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
71 changes: 71 additions & 0 deletions
71
...crypt/email/ui/ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInDatabaseFlowTest.kt
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,71 @@ | ||
| /* | ||
| * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com | ||
| * Contributors: DenBond7 | ||
| */ | ||
|
|
||
| package com.flowcrypt.email.ui | ||
|
|
||
| import androidx.test.espresso.Espresso.onView | ||
| import androidx.test.espresso.action.ViewActions.click | ||
| import androidx.test.espresso.assertion.ViewAssertions.matches | ||
| import androidx.test.espresso.matcher.ViewMatchers.hasTextColor | ||
| import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
| import androidx.test.espresso.matcher.ViewMatchers.withId | ||
| import androidx.test.espresso.matcher.ViewMatchers.withText | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import androidx.test.filters.MediumTest | ||
| import com.flowcrypt.email.R | ||
| import com.flowcrypt.email.TestConstants | ||
| import com.flowcrypt.email.extensions.kotlin.asInternetAddress | ||
| import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings | ||
| import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule | ||
| import com.flowcrypt.email.rules.ClearAppSettingsRule | ||
| import com.flowcrypt.email.rules.GrantPermissionRuleChooser | ||
| import com.flowcrypt.email.rules.RetryRule | ||
| import com.flowcrypt.email.rules.ScreenshotTestRule | ||
| import com.flowcrypt.email.ui.base.BaseComposeScreenNoKeyAvailableTest | ||
| import org.hamcrest.CoreMatchers.not | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.rules.RuleChain | ||
| import org.junit.rules.TestRule | ||
| import org.junit.runner.RunWith | ||
|
|
||
| /** | ||
| * @author Denys Bondarenko | ||
| */ | ||
| @MediumTest | ||
| @RunWith(AndroidJUnit4::class) | ||
| @FlowCryptTestSettings(useCommonIdling = false) | ||
| class ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInDatabaseFlowTest : | ||
| BaseComposeScreenNoKeyAvailableTest() { | ||
| private val addPrivateKeyToDatabaseRuleFirst = AddPrivateKeyToDatabaseRule( | ||
| keyPath = "pgp/key_testing@flowcrypt.test_keyA_strong.asc" | ||
| ) | ||
|
|
||
| private val addPrivateKeyToDatabaseRuleSecond = AddPrivateKeyToDatabaseRule( | ||
| keyPath = "pgp/key_testing@flowcrypt.test_keyC_strong.asc" | ||
| ) | ||
|
|
||
| @get:Rule | ||
| var ruleChain: TestRule = RuleChain | ||
| .outerRule(RetryRule.DEFAULT) | ||
| .around(ClearAppSettingsRule()) | ||
| .around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
| .around(addAccountToDatabaseRule) | ||
| .around(addPrivateKeyToDatabaseRuleFirst) | ||
| .around(addPrivateKeyToDatabaseRuleSecond) | ||
| .around(activeActivityRule) | ||
| .around(ScreenshotTestRule()) | ||
|
|
||
| @Test | ||
| fun testAddEmailToExistingKey() { | ||
| doTestAddEmailToExistingKey { | ||
| waitForObjectWithText(getResString(android.R.string.ok), 2000) | ||
|
|
||
| onView(withId(R.id.buttonOk)) | ||
| .check(matches(isDisplayed())) | ||
| .perform(click()) | ||
| } | ||
| } | ||
| } |
84 changes: 84 additions & 0 deletions
84
.../flowcrypt/email/ui/ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInRamFlowTest.kt
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,84 @@ | ||
| /* | ||
| * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com | ||
| * Contributors: DenBond7 | ||
| */ | ||
|
|
||
| package com.flowcrypt.email.ui | ||
|
|
||
| import androidx.test.espresso.Espresso.onView | ||
| import androidx.test.espresso.action.ViewActions.clearText | ||
| import androidx.test.espresso.action.ViewActions.click | ||
| import androidx.test.espresso.action.ViewActions.pressImeActionButton | ||
| import androidx.test.espresso.action.ViewActions.replaceText | ||
| import androidx.test.espresso.assertion.ViewAssertions.matches | ||
| import androidx.test.espresso.matcher.RootMatchers | ||
| import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
| import androidx.test.espresso.matcher.ViewMatchers.withId | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import androidx.test.filters.MediumTest | ||
| import com.flowcrypt.email.R | ||
| import com.flowcrypt.email.TestConstants | ||
| import com.flowcrypt.email.database.entity.KeyEntity | ||
| import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings | ||
| import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule | ||
| import com.flowcrypt.email.rules.ClearAppSettingsRule | ||
| import com.flowcrypt.email.rules.GrantPermissionRuleChooser | ||
| import com.flowcrypt.email.rules.RetryRule | ||
| import com.flowcrypt.email.rules.ScreenshotTestRule | ||
| import com.flowcrypt.email.ui.base.BaseComposeScreenNoKeyAvailableTest | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.rules.RuleChain | ||
| import org.junit.rules.TestRule | ||
| import org.junit.runner.RunWith | ||
|
|
||
| /** | ||
| * @author Denys Bondarenko | ||
| */ | ||
| @MediumTest | ||
| @RunWith(AndroidJUnit4::class) | ||
| @FlowCryptTestSettings(useCommonIdling = false) | ||
| class ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInRamFlowTest : | ||
| BaseComposeScreenNoKeyAvailableTest() { | ||
| private val addPrivateKeyToDatabaseRuleFirst = AddPrivateKeyToDatabaseRule( | ||
| keyPath = "pgp/key_testing@flowcrypt.test_keyA_strong.asc", | ||
| passphraseType = KeyEntity.PassphraseType.RAM | ||
| ) | ||
|
|
||
| private val addPrivateKeyToDatabaseRuleSecond = AddPrivateKeyToDatabaseRule( | ||
| keyPath = "pgp/key_testing@flowcrypt.test_keyC_strong.asc", | ||
| passphraseType = KeyEntity.PassphraseType.RAM | ||
| ) | ||
|
|
||
| @get:Rule | ||
| var ruleChain: TestRule = RuleChain | ||
| .outerRule(RetryRule.DEFAULT) | ||
| .around(ClearAppSettingsRule()) | ||
| .around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
| .around(addAccountToDatabaseRule) | ||
| .around(addPrivateKeyToDatabaseRuleFirst) | ||
| .around(addPrivateKeyToDatabaseRuleSecond) | ||
| .around(activeActivityRule) | ||
| .around(ScreenshotTestRule()) | ||
|
|
||
| @Test | ||
| fun testAddEmailToExistingKey() { | ||
| doTestAddEmailToExistingKey { | ||
| waitForObjectWithText(getResString(android.R.string.ok), 2000) | ||
|
|
||
| onView(withId(R.id.buttonOk)) | ||
| .check(matches(isDisplayed())) | ||
| .perform(click()) | ||
|
|
||
| waitForObjectWithText(getResString(R.string.provide_passphrase), 2000) | ||
|
|
||
| onView(withId(R.id.eTKeyPassword)) | ||
| .inRoot(RootMatchers.isDialog()) | ||
| .perform( | ||
| clearText(), | ||
| replaceText(TestConstants.DEFAULT_STRONG_PASSWORD), | ||
| pressImeActionButton() | ||
| ) | ||
| } | ||
| } | ||
| } |
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
71 changes: 71 additions & 0 deletions
71
...com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInRamFlowTest.kt
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,71 @@ | ||
| /* | ||
| * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com | ||
| * Contributors: DenBond7 | ||
| */ | ||
|
|
||
| package com.flowcrypt.email.ui | ||
|
|
||
| import androidx.test.espresso.Espresso.onView | ||
| import androidx.test.espresso.action.ViewActions | ||
| import androidx.test.espresso.action.ViewActions.replaceText | ||
| import androidx.test.espresso.assertion.ViewAssertions.doesNotExist | ||
| import androidx.test.espresso.matcher.RootMatchers | ||
| import androidx.test.espresso.matcher.ViewMatchers.withId | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import androidx.test.filters.MediumTest | ||
| import com.flowcrypt.email.R | ||
| import com.flowcrypt.email.TestConstants | ||
| import com.flowcrypt.email.database.entity.KeyEntity | ||
| import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings | ||
| import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule | ||
| import com.flowcrypt.email.rules.ClearAppSettingsRule | ||
| import com.flowcrypt.email.rules.GrantPermissionRuleChooser | ||
| import com.flowcrypt.email.rules.RetryRule | ||
| import com.flowcrypt.email.rules.ScreenshotTestRule | ||
| import com.flowcrypt.email.ui.base.BaseComposeScreenNoKeyAvailableTest | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.rules.RuleChain | ||
| import org.junit.rules.TestRule | ||
| import org.junit.runner.RunWith | ||
|
|
||
| /** | ||
| * @author Denys Bondarenko | ||
| */ | ||
| @MediumTest | ||
| @RunWith(AndroidJUnit4::class) | ||
| @FlowCryptTestSettings(useCommonIdling = false) | ||
| class ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInRamFlowTest : BaseComposeScreenNoKeyAvailableTest() { | ||
| private val addPrivateKeyToDatabaseRule = AddPrivateKeyToDatabaseRule( | ||
| keyPath = "pgp/key_testing@flowcrypt.test_keyA_strong.asc", | ||
| passphraseType = KeyEntity.PassphraseType.RAM | ||
| ) | ||
|
|
||
| @get:Rule | ||
| var ruleChain: TestRule = RuleChain | ||
| .outerRule(RetryRule.DEFAULT) | ||
| .around(ClearAppSettingsRule()) | ||
| .around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
| .around(addAccountToDatabaseRule) | ||
| .around(addPrivateKeyToDatabaseRule) | ||
| .around(activeActivityRule) | ||
| .around(ScreenshotTestRule()) | ||
|
|
||
| @Test | ||
| fun testAddEmailToExistingKey() { | ||
| doTestAddEmailToExistingKey { | ||
| onView(withId(R.id.buttonOk)) | ||
| .check(doesNotExist()) | ||
|
|
||
| waitForObjectWithText(getResString(R.string.provide_passphrase), 2000) | ||
|
|
||
| onView(withId(R.id.eTKeyPassword)) | ||
| .inRoot(RootMatchers.isDialog()) | ||
| .perform( | ||
| ViewActions.clearText(), | ||
| replaceText(TestConstants.DEFAULT_STRONG_PASSWORD), | ||
| ViewActions.pressImeActionButton() | ||
| ) | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.