From e34f85c6c67932aafc48031e403fb5b2bf4b1825 Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Thu, 4 Apr 2024 10:40:49 +0300 Subject: [PATCH] Added ComposeScreenNoKeyAvailableFlowTest.testAddEmailToExistingSingleKeyPassphraseInDatabase().| #597 --- .../ui/ComposeScreenNoKeyAvailableFlowTest.kt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableFlowTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableFlowTest.kt index a029aa13b..0c63315a5 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableFlowTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableFlowTest.kt @@ -116,6 +116,42 @@ class ComposeScreenNoKeyAvailableFlowTest : BaseComposeScreenTest() { .check(matches(not(hasTextColor(R.color.gray)))) } + @Test + fun testAddEmailToExistingSingleKeyPassphraseInDatabase() { + activeActivityRule?.launch(intent) + registerAllIdlingResources() + fillInAllFields( + to = setOf( + requireNotNull(TestConstants.RECIPIENT_WITH_PUBLIC_KEY_ON_ATTESTER.asInternetAddress()) + ) + ) + + //check that editTextFrom has gray text color. It means a sender doesn't have a private key + onView(withId(R.id.editTextFrom)) + .check(matches(isDisplayed())) + .check(matches(hasTextColor(R.color.gray))) + + onView(withId(R.id.menuActionSend)) + .check(matches(isDisplayed())) + .perform(click()) + + isDialogWithTextDisplayed( + decorView, + getResString(R.string.no_key_available, addAccountToDatabaseRule.account.email) + ) + + onView(withText(R.string.add_email_to_existing_key)) + .check(matches(isDisplayed())) + .perform(click()) + + Thread.sleep(2000) + + //check that editTextFrom doesn't have gray text color. It means a sender has a private key. + onView(withId(R.id.editTextFrom)) + .check(matches(isDisplayed())) + .check(matches(not(hasTextColor(R.color.gray)))) + } + companion object { @get:ClassRule @JvmStatic