-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handled the case "no private key available for account(create a new k…
…ey for email) (#2675) * Handled the case "no private key available for account(create a new key for email)".| #597 * Fixed navigation.| #597 * Added ComposeScreenNoKeyAvailableCreateNewKeyFlowTest.| #597 * Refactored code * Refactored code * wip
- Loading branch information
Showing
19 changed files
with
339 additions
and
118 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
...ndroidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableCreateNewKeyFlowTest.kt
This file contains 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,83 @@ | ||
/* | ||
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected] | ||
* Contributors: DenBond7 | ||
*/ | ||
|
||
package com.flowcrypt.email.ui | ||
|
||
import android.view.KeyEvent | ||
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.pressKey | ||
import androidx.test.espresso.action.ViewActions.replaceText | ||
import androidx.test.espresso.action.ViewActions.typeText | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
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.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 ComposeScreenNoKeyAvailableCreateNewKeyFlowTest : BaseComposeScreenNoKeyAvailableTest() { | ||
private val addPrivateKeyToDatabaseRule = AddPrivateKeyToDatabaseRule( | ||
keyPath = "pgp/[email protected]_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 testCreatingNewKey() { | ||
doBaseActions { | ||
onView(withText(R.string.create_a_new_key)) | ||
.check(matches(isDisplayed())) | ||
.perform(click()) | ||
|
||
Thread.sleep(1000) | ||
|
||
onView(withId(R.id.editTextKeyPassword)) | ||
.perform(click(), typeText(TestConstants.DEFAULT_STRONG_PASSWORD)) | ||
Thread.sleep(1000) | ||
onView(withId(R.id.editTextKeyPassword)) | ||
.perform(pressImeActionButton()) | ||
|
||
Thread.sleep(1000) | ||
|
||
onView(withId(R.id.editTextKeyPasswordSecond)) | ||
.perform(replaceText(TestConstants.DEFAULT_STRONG_PASSWORD)) | ||
onView(withId(R.id.buttonConfirmPassPhrases)) | ||
.perform(click()) | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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.