Skip to content

Commit

Permalink
Added a test.| #1255
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Jun 10, 2021
1 parent bc13231 commit a90f931
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ 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.api.email.model.AttachmentInfo
import com.flowcrypt.email.api.email.model.IncomingMessageInfo
import com.flowcrypt.email.api.retrofit.response.model.node.DecryptErrorDetails
import com.flowcrypt.email.api.retrofit.response.model.node.DecryptErrorMsgBlock
Expand Down Expand Up @@ -233,6 +234,41 @@ class MessageDetailsActivityPassphraseInRamTest : BaseMessageDetailsActivityTest
checkWebView(decryptedInfo)
}

@Test
fun testShowNeedPassphraseDialogWhenTryingToDownloadAttachment() {
val encryptedAttInfo = TestGeneralUtil.getObjectFromJson(
"messages/attachments/encrypted_att.json",
AttachmentInfo::class.java
)

val msgInfo = getMsgInfo(
"messages/info/encrypted_msg_info_text_with_one_att.json",
"messages/mime/encrypted_msg_info_plain_text_with_one_att.txt", encryptedAttInfo
)

launchActivity(msgInfo!!.msgEntity)

//close a dialog during start up
onView(withText(getResString(R.string.cancel)))
.inRoot(isDialog())
.check(matches(isDisplayed()))
.perform(click())

//Click on the download button
onView(withId(R.id.imageButtonDownloadAtt))
.check(matches(isDisplayed()))
.perform(click())

//check that a dialog is displayed
val tVStatusMessageText = getQuantityString(
R.plurals.please_provide_passphrase_for_following_keys,
1
)
onView(withText(tVStatusMessageText))
.inRoot(isDialog())
.check(matches(isDisplayed()))
}

private fun checkWebView(decryptedInfo: IncomingMessageInfo?) {
//todo-denbond7 improve that in the future
//we need that to wait while webview rendered content
Expand Down

0 comments on commit a90f931

Please sign in to comment.