Skip to content

Commit a4b152e

Browse files
committed
Added ReadyForCIAndFlakyFilter.| #2642
1 parent 2a548b1 commit a4b152e

File tree

33 files changed

+93
-2
lines changed

33 files changed

+93
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected]
3+
* Contributors: DenBond7
4+
*/
5+
6+
package com.flowcrypt.email.junit.filters
7+
8+
import androidx.test.filters.FlakyTest
9+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
10+
import org.junit.runner.Description
11+
12+
/**
13+
* @author Denys Bondarenko
14+
*/
15+
open class ReadyForCIAndFlakyFilter : BaseCustomFilter() {
16+
override fun evaluateTest(description: Description?): Boolean {
17+
val annotationClass = NotReadyForCI::class.java
18+
val annotationClassFlakyTest = FlakyTest::class.java
19+
return !isAnnotationPresentAtClassOrMethod(description, annotationClass)
20+
&& isAnnotationPresentAtClassOrMethod(description, annotationClassFlakyTest)
21+
}
22+
23+
override fun describe() = "Filter flaky tests that are ready to be run on a CI server"
24+
}

FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/filters/ReadyForCIAndNonFlakyFilter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ open class ReadyForCIAndNonFlakyFilter : BaseCustomFilter() {
2020
&& !isAnnotationPresentAtClassOrMethod(description, annotationClassFlakyTest)
2121
}
2222

23-
override fun describe() = "Filter tests that are ready to be run on a CI server"
23+
override fun describe() = "Filter not flaky tests that are ready to be run on a CI server"
2424
}

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/AttachmentDownloadingProgressFlowTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.flowcrypt.email.database.entity.AccountEntity
2121
import com.flowcrypt.email.database.entity.KeyEntity
2222
import com.flowcrypt.email.extensions.kotlin.toHex
2323
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
24+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
2425
import com.flowcrypt.email.matchers.CustomMatchers.Companion.withDrawable
2526
import com.flowcrypt.email.model.KeyImportDetails
2627
import com.flowcrypt.email.rules.AddAccountToDatabaseRule
@@ -42,7 +43,6 @@ import okhttp3.mockwebserver.Dispatcher
4243
import okhttp3.mockwebserver.MockResponse
4344
import okhttp3.mockwebserver.RecordedRequest
4445
import org.hamcrest.Matchers.not
45-
import org.junit.Ignore
4646
import org.junit.Rule
4747
import org.junit.Test
4848
import org.junit.rules.RuleChain
@@ -155,6 +155,7 @@ class AttachmentDownloadingProgressFlowTest : BaseMessageDetailsFlowTest() {
155155

156156
@Test
157157
@FlakyTest
158+
@NotReadyForCI
158159
fun testVisibilityOfDownloadingProgressIcon() {
159160
baseCheckWithAtt(
160161
incomingMsgInfo = getMsgInfo(

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableCreateNewKeyFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.flowcrypt.email.R
2424
import com.flowcrypt.email.TestConstants
2525
import com.flowcrypt.email.database.entity.KeyEntity
2626
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
27+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
2728
import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule
2829
import com.flowcrypt.email.rules.ClearAppSettingsRule
2930
import com.flowcrypt.email.rules.GrantPermissionRuleChooser
@@ -61,6 +62,7 @@ class ComposeScreenNoKeyAvailableCreateNewKeyFlowTest : BaseComposeScreenNoKeyAv
6162

6263
@Test
6364
@FlakyTest
65+
@NotReadyForCI
6466
fun testCreatingNewKey() {
6567
doBaseActions {
6668
onView(withText(R.string.create_a_new_key))

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInDatabaseFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.flowcrypt.email.R
1919
import com.flowcrypt.email.TestConstants
2020
import com.flowcrypt.email.extensions.kotlin.asInternetAddress
2121
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
22+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
2223
import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule
2324
import com.flowcrypt.email.rules.ClearAppSettingsRule
2425
import com.flowcrypt.email.rules.GrantPermissionRuleChooser
@@ -62,6 +63,7 @@ class ComposeScreenNoKeyAvailableMultipleKeysWithPassphraseInDatabaseFlowTest :
6263

6364
@Test
6465
@FlakyTest
66+
@NotReadyForCI
6567
fun testAddEmailToExistingKey() {
6668
doTestAddEmailToExistingKey {
6769
waitForObjectWithText(getResString(android.R.string.ok), 2000)

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInDatabaseFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.test.filters.MediumTest
2020
import com.flowcrypt.email.R
2121
import com.flowcrypt.email.TestConstants
2222
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
23+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
2324
import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule
2425
import com.flowcrypt.email.rules.ClearAppSettingsRule
2526
import com.flowcrypt.email.rules.GrantPermissionRuleChooser
@@ -60,6 +61,7 @@ class ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInDatabaseFlowTest : Bas
6061

6162
@Test
6263
@FlakyTest
64+
@NotReadyForCI
6365
fun testImportKey() {
6466
doBaseActions {
6567
addTextToClipboard("private key", requireNotNull(pgpKeyDetails.privateKey))

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInRamFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.flowcrypt.email.R
1818
import com.flowcrypt.email.TestConstants
1919
import com.flowcrypt.email.database.entity.KeyEntity
2020
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
21+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
2122
import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule
2223
import com.flowcrypt.email.rules.ClearAppSettingsRule
2324
import com.flowcrypt.email.rules.GrantPermissionRuleChooser
@@ -55,6 +56,7 @@ class ComposeScreenNoKeyAvailableSingleKeyWithPassphraseInRamFlowTest : BaseComp
5556

5657
@Test
5758
@FlakyTest
59+
@NotReadyForCI
5860
fun testAddEmailToExistingKey() {
5961
doTestAddEmailToExistingKey {
6062
onView(withId(R.id.buttonOk))

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/EndPassPhraseSessionFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.flowcrypt.email.TestConstants
2929
import com.flowcrypt.email.base.BaseTest
3030
import com.flowcrypt.email.database.entity.KeyEntity
3131
import com.flowcrypt.email.junit.annotations.FlowCryptTestSettings
32+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
3233
import com.flowcrypt.email.model.KeyImportDetails
3334
import com.flowcrypt.email.rules.AddAccountToDatabaseRule
3435
import com.flowcrypt.email.rules.AddPrivateKeyToDatabaseRule
@@ -90,6 +91,7 @@ class EndPassPhraseSessionFlowTest : BaseTest() {
9091

9192
@Test
9293
@FlakyTest
94+
@NotReadyForCI
9395
fun testEndPassPhraseSessionButton() {
9496
//as tests run a bit differently need to run PassPhrasesInRAMService manually at this stage
9597
PassPhrasesInRAMService.start(getTargetContext())

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/MainSignInFragmentFlowTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class MainSignInFragmentFlowTest : BaseSignTest() {
299299

300300
@Test
301301
@FlakyTest
302+
@NotReadyForCI
302303
fun testFailAttesterSubmit() {
303304
setupAndClickSignInButton(genMockGoogleSignInAccountJson(EMAIL_FES_ENFORCE_ATTESTER_SUBMIT))
304305
unregisterCountingIdlingResource()

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/MessageDetailsFlowTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import com.flowcrypt.email.api.retrofit.response.model.GenericMsgBlock
5353
import com.flowcrypt.email.api.retrofit.response.model.InlineAttMsgBlock
5454
import com.flowcrypt.email.api.retrofit.response.model.MsgBlock
5555
import com.flowcrypt.email.api.retrofit.response.model.PublicKeyMsgBlock
56+
import com.flowcrypt.email.junit.annotations.NotReadyForCI
5657
import com.flowcrypt.email.matchers.CustomMatchers.Companion.withEmptyRecyclerView
5758
import com.flowcrypt.email.matchers.CustomMatchers.Companion.withRecyclerViewItemCount
5859
import com.flowcrypt.email.model.KeyImportDetails
@@ -217,6 +218,7 @@ class MessageDetailsFlowTest : BaseMessageDetailsFlowTest() {
217218

218219
@Test
219220
@FlakyTest
221+
@NotReadyForCI
220222
fun testDecryptionError_KEY_MISMATCH_MissingKeyErrorImportKey() {
221223
testMissingKey(
222224
getMsgInfo(
@@ -267,6 +269,7 @@ class MessageDetailsFlowTest : BaseMessageDetailsFlowTest() {
267269

268270
@Test
269271
@FlakyTest
272+
@NotReadyForCI
270273
fun testDecryptionError_FORMAT_BadlyFormattedMsg() {
271274
val msgInfo = getMsgInfo(
272275
path = "messages/info/encrypted_msg_info_text_error_badly_formatted.json",
@@ -297,6 +300,7 @@ class MessageDetailsFlowTest : BaseMessageDetailsFlowTest() {
297300

298301
@Test
299302
@FlakyTest
303+
@NotReadyForCI
300304
fun testDecryptionError_NO_MDC() {
301305
val msgInfo = getMsgInfo(
302306
path = "messages/info/encrypted_msg_info_error_no_mdc.json",
@@ -356,6 +360,7 @@ class MessageDetailsFlowTest : BaseMessageDetailsFlowTest() {
356360

357361
@Test
358362
@FlakyTest
363+
@NotReadyForCI
359364
fun testMissingKeyErrorChooseFromFewPubKeys() {
360365
val msgInfo = getMsgInfo(
361366
path = "messages/info/encrypted_msg_info_text_with_missing_key.json",
@@ -692,6 +697,7 @@ class MessageDetailsFlowTest : BaseMessageDetailsFlowTest() {
692697

693698
@Test
694699
@FlakyTest
700+
@NotReadyForCI
695701
fun testSignedMsgClearSignBroken() {
696702
val msgInfo = getMsgInfo(
697703
path = "messages/info/signed_msg_clearsign_broken.json",

0 commit comments

Comments
 (0)