From e235216cc49a6ceee4395e981e80edc6ba3836f1 Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Wed, 8 Mar 2023 17:37:15 +0200 Subject: [PATCH] Added EnterpriseTestsFilter.| #2162 --- .../ADB_Print_enterprise_tests.xml | 17 ++++++ .../Run_enterprise_UI_tests.xml | 55 +++++++++++++++++++ .../email/junit/annotations/EnterpriseTest.kt | 14 +++++ .../junit/filters/EnterpriseTestsFilter.kt | 22 ++++++++ .../ui/FesDuringSetupEnterpriseFlowTest.kt | 4 +- 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 .idea/runConfigurations/ADB_Print_enterprise_tests.xml create mode 100644 .idea/runConfigurations/Run_enterprise_UI_tests.xml create mode 100644 FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/annotations/EnterpriseTest.kt create mode 100644 FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/filters/EnterpriseTestsFilter.kt diff --git a/.idea/runConfigurations/ADB_Print_enterprise_tests.xml b/.idea/runConfigurations/ADB_Print_enterprise_tests.xml new file mode 100644 index 0000000000..c022a61090 --- /dev/null +++ b/.idea/runConfigurations/ADB_Print_enterprise_tests.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_enterprise_UI_tests.xml b/.idea/runConfigurations/Run_enterprise_UI_tests.xml new file mode 100644 index 0000000000..d508d9da9f --- /dev/null +++ b/.idea/runConfigurations/Run_enterprise_UI_tests.xml @@ -0,0 +1,55 @@ + + + + + \ No newline at end of file diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/annotations/EnterpriseTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/annotations/EnterpriseTest.kt new file mode 100644 index 0000000000..19d8231153 --- /dev/null +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/annotations/EnterpriseTest.kt @@ -0,0 +1,14 @@ +/* + * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com + * Contributors: DenBond7 + */ + +package com.flowcrypt.email.junit.annotations + +/** + * Via this annotation, we can mark a class or a method that should be run only for enterprise testing. + * + * @author Denys Bondarenko + */ +@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) +annotation class EnterpriseTest diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/filters/EnterpriseTestsFilter.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/filters/EnterpriseTestsFilter.kt new file mode 100644 index 0000000000..49be19df07 --- /dev/null +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/junit/filters/EnterpriseTestsFilter.kt @@ -0,0 +1,22 @@ +/* + * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com + * Contributors: DenBond7 + */ + +package com.flowcrypt.email.junit.filters + +import com.flowcrypt.email.junit.annotations.EnterpriseTest +import org.junit.runner.Description + +/** + * @author Denys Bondarenko + */ +class EnterpriseTestsFilter : ReadyForCIFilter() { + override fun evaluateTest(description: Description?): Boolean { + val annotationClass = EnterpriseTest::class.java + return super.evaluateTest(description) + && isAnnotationPresentAtClassOrMethod(description, annotationClass) + } + + override fun describe() = "Filter tests that should be run only for enterprise testing" +} diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/FesDuringSetupEnterpriseFlowTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/FesDuringSetupEnterpriseFlowTest.kt index 3a1501aa07..eaf139089c 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/FesDuringSetupEnterpriseFlowTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/FesDuringSetupEnterpriseFlowTest.kt @@ -20,6 +20,7 @@ import com.flowcrypt.email.api.retrofit.response.base.ApiError import com.flowcrypt.email.api.retrofit.response.model.ClientConfiguration import com.flowcrypt.email.api.retrofit.response.model.Key import com.flowcrypt.email.extensions.exceptionMsg +import com.flowcrypt.email.junit.annotations.EnterpriseTest import com.flowcrypt.email.rules.ClearAppSettingsRule import com.flowcrypt.email.rules.GrantPermissionRuleChooser import com.flowcrypt.email.rules.RetryRule @@ -34,7 +35,6 @@ import okhttp3.mockwebserver.RecordedRequest import org.hamcrest.Matchers.containsString import org.hamcrest.Matchers.`is` import org.hamcrest.Matchers.not -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain @@ -49,7 +49,7 @@ import java.util.concurrent.TimeUnit */ @MediumTest @RunWith(AndroidJUnit4::class) -@Ignore("not completed") +@EnterpriseTest class FesDuringSetupEnterpriseFlowTest : BaseFesDuringSetupFlowTest() { @get:Rule var ruleChain: TestRule = RuleChain