-
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.
Issue 2712 add email signatures support (#2769)
* Updated AccountAliasesEntity.| #2712 * wip * wip * wip * wip * wip * wip * wip * wip * Added UpdateSignatureDialogFragment.| #2712 * Added appending a signature to outgoing messages.| #2712 * wip * wip * wip * wip * wip * Added some tests.| #2712 * Added some tests for Gmail API.| #2712 * Added some tests.| #2712 * Fixed the database migration.| #2712 * Fixed lint warnings.| #2712
- Loading branch information
Showing
44 changed files
with
3,134 additions
and
190 deletions.
There are no files selected for viewing
1,200 changes: 1,200 additions & 0 deletions
1,200
FlowCrypt/schemas/com.flowcrypt.email.database.FlowCryptRoomDatabase/45.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
28 changes: 0 additions & 28 deletions
28
FlowCrypt/src/androidTest/java/com/flowcrypt/email/rules/AddGmailAliasToDatabaseRule.kt
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
...ndroidTest/java/com/flowcrypt/email/ui/ComposeScreenForwardWithCustomSignatureFlowTest.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,66 @@ | ||
/* | ||
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected] | ||
* Contributors: DenBond7 | ||
*/ | ||
|
||
package com.flowcrypt.email.ui | ||
|
||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.scrollTo | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
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.model.MessageType | ||
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.activity.fragment.CreateMessageFragmentArgs | ||
import com.flowcrypt.email.ui.base.BaseComposeScreenWithCustomSignatureFlowTest | ||
import org.hamcrest.core.StringStartsWith | ||
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) | ||
class ComposeScreenForwardWithCustomSignatureFlowTest : | ||
BaseComposeScreenWithCustomSignatureFlowTest() { | ||
override val createMessageFragmentArgs: CreateMessageFragmentArgs | ||
get() = CreateMessageFragmentArgs( | ||
incomingMessageInfo = getMsgInfo( | ||
path = "messages/info/standard_msg_reply_to_header.json", | ||
mimeMsgPath = "messages/mime/standard_msg_reply_to_header.txt", | ||
accountEntity = BASE_ADD_ACCOUNT_RULE.apply { execute() }.accountEntityWithDecryptedInfo | ||
), | ||
encryptedByDefault = false, | ||
messageType = MessageType.FORWARD | ||
) | ||
|
||
@get:Rule | ||
var ruleChain: TestRule = RuleChain | ||
.outerRule(RetryRule.DEFAULT) | ||
.around(ClearAppSettingsRule()) | ||
.around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
.around(addAccountToDatabaseRule) | ||
.around(addPrivateKeyToDatabaseRule) | ||
.around(activityScenarioRule) | ||
.around(ScreenshotTestRule()) | ||
|
||
@Test | ||
fun testAddingSignatureAfterStart() { | ||
Thread.sleep(1000) | ||
onView(withId(R.id.editTextEmailMessage)) | ||
.perform(scrollTo()) | ||
.check(matches(withText(StringStartsWith.startsWith("\n\n$SIGNATURE")))) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...oidTest/java/com/flowcrypt/email/ui/ComposeScreenNewMessageWithCustomSignatureFlowTest.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,66 @@ | ||
/* | ||
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected] | ||
* Contributors: DenBond7 | ||
*/ | ||
|
||
package com.flowcrypt.email.ui | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.scrollTo | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
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.junit.annotations.FlowCryptTestSettings | ||
import com.flowcrypt.email.model.MessageType | ||
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.activity.fragment.CreateMessageFragmentArgs | ||
import com.flowcrypt.email.ui.base.BaseComposeScreenWithCustomSignatureFlowTest | ||
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 ComposeScreenNewMessageWithCustomSignatureFlowTest : | ||
BaseComposeScreenWithCustomSignatureFlowTest() { | ||
override val createMessageFragmentArgs: CreateMessageFragmentArgs | ||
get() = CreateMessageFragmentArgs( | ||
encryptedByDefault = true, | ||
messageType = MessageType.NEW | ||
) | ||
|
||
@get:Rule | ||
var ruleChain: TestRule = RuleChain | ||
.outerRule(RetryRule.DEFAULT) | ||
.around(ClearAppSettingsRule()) | ||
.around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
.around(addAccountToDatabaseRule) | ||
.around(addPrivateKeyToDatabaseRule) | ||
.around(activityScenarioRule) | ||
.around(ScreenshotTestRule()) | ||
|
||
@Test | ||
fun testAddingSignatureAfterStart() { | ||
Thread.sleep(1000) | ||
|
||
onView(withId(R.id.editTextEmailMessage)) | ||
.perform(scrollTo()) | ||
.check(matches(withText("\n\n$SIGNATURE"))) | ||
} | ||
|
||
companion object { | ||
const val SIGNATURE = "My great signature" | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
.../androidTest/java/com/flowcrypt/email/ui/ComposeScreenReplyWithCustomSignatureFlowTest.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,65 @@ | ||
/* | ||
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected] | ||
* Contributors: DenBond7 | ||
*/ | ||
|
||
package com.flowcrypt.email.ui | ||
|
||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.scrollTo | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
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.model.MessageType | ||
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.activity.fragment.CreateMessageFragmentArgs | ||
import com.flowcrypt.email.ui.base.BaseComposeScreenWithCustomSignatureFlowTest | ||
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) | ||
class ComposeScreenReplyWithCustomSignatureFlowTest : | ||
BaseComposeScreenWithCustomSignatureFlowTest() { | ||
override val createMessageFragmentArgs: CreateMessageFragmentArgs | ||
get() = CreateMessageFragmentArgs( | ||
incomingMessageInfo = getMsgInfo( | ||
path = "messages/info/standard_msg_reply_to_header.json", | ||
mimeMsgPath = "messages/mime/standard_msg_reply_to_header.txt", | ||
accountEntity = BASE_ADD_ACCOUNT_RULE.apply { execute() }.accountEntityWithDecryptedInfo | ||
), | ||
encryptedByDefault = false, | ||
messageType = MessageType.REPLY | ||
) | ||
|
||
@get:Rule | ||
var ruleChain: TestRule = RuleChain | ||
.outerRule(RetryRule.DEFAULT) | ||
.around(ClearAppSettingsRule()) | ||
.around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) | ||
.around(addAccountToDatabaseRule) | ||
.around(addPrivateKeyToDatabaseRule) | ||
.around(activityScenarioRule) | ||
.around(ScreenshotTestRule()) | ||
|
||
@Test | ||
fun testAddingSignatureAfterStart() { | ||
Thread.sleep(1000) | ||
onView(withId(R.id.editTextEmailMessage)) | ||
.perform(scrollTo()) | ||
.check(matches(withText("\n\n$SIGNATURE"))) | ||
} | ||
} |
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.